Commit Graph

141 Commits

Author SHA1 Message Date
Fernando Sahmkow e31425df38 General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
bunnei 8f75524e55 kernel: Initialize memory layout for new VMM. 2020-04-17 00:59:32 -04:00
Fernando Sahmkow d219a96cc8 Kernel: Address Feedback. 2020-02-22 11:18:07 -04:00
Fernando Sahmkow 5c90d22f3d Kernel: Implement Time Manager. 2020-02-22 11:18:07 -04:00
Fernando Sahmkow 179bafa7cb Kernel: Rename ThreadCallbackHandleTable and Setup Thread Ids on Kernel. 2020-02-22 11:18:06 -04:00
Fernando Sahmkow 0728dfef84 Kernel: Make global scheduler depend on KernelCore 2020-02-22 11:18:06 -04:00
Fernando Sahmkow d23d504d77 Kernel: Refactor synchronization to better match RE 2020-02-11 18:47:31 -04:00
Fernando Sahmkow 2d1984c20c System: Address Feedback 2020-01-27 09:54:11 -04:00
Fernando Sahmkow 4d6a86b03f Core: Refactor CPU Management.
This commit moves ARM Interface and Scheduler handling into the kernel.
2020-01-25 18:55:32 -04:00
Lioncash c3e43c7e81 kernel: Remove unnecessary includes
Over the course of the changes to the kernel code, a few includes are no
longer necessary, particularly with the change over to std::shared_ptr
from Boost's intrusive_ptr.
2019-12-07 22:37:05 -05:00
bunnei ec0ce96c56
core_timing: Use better reference tracking for EventType. (#3159)
* core_timing: Use better reference tracking for EventType.

- Moves ownership of the event to the caller, ensuring we don't fire events for destroyed objects.
- Removes need for unique names - we won't be using this for save states anyways.
2019-11-26 21:48:56 -05:00
bunnei 9046d4a548
kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.

- See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-24 20:15:51 -05:00
Fernando Sahmkow c32520ceb7 Kernel: Reverse global accessor removal. 2019-10-15 11:55:26 -04:00
Fernando Sahmkow 3073615dbc Kernel: Address Feedback. 2019-10-15 11:55:25 -04:00
Fernando Sahmkow e05a8c2385 Kernel: Remove global system accessor from WaitObject 2019-10-15 11:55:16 -04:00
Fernando Sahmkow 57a71f899a Add interfacing to the Global Scheduler 2019-10-15 11:55:07 -04:00
Zach Hilman fc0bf91a96 kernel: Differentiate kernel and user processes when picking ID
This allows kernel internal type processes to be assigned IDs in the KIP range while userland processes are assigned in the user range.
2019-06-10 00:28:33 -04:00
Lioncash cb2bce8006 kernel/svc: Implement svcGetProcessList
This service function simply copies out a specified number of kernel
process IDs, while simultaneously reporting the total number of
processes.
2019-04-02 00:47:14 -04:00
Lioncash bd7ec1a749 kernel/kernel: Remove unnecessary forward declaration
This is no longer necessary, as ResultVal isn't used anywhere in the
header.
2019-03-24 17:48:54 -04:00
Lioncash 8e510d5afa kernel: Make the address arbiter instance per-process
Now that we have the address arbiter extracted to its own class, we can
fix an innaccuracy with the kernel. Said inaccuracy being that there
isn't only one address arbiter. Each process instance contains its own
AddressArbiter instance in the actual kernel.

This fixes that and gets rid of another long-standing issue that could
arise when attempting to create more than one process.
2019-03-07 23:27:51 -05:00
Lioncash c161389a0f kernel/address_arbiter: Pass in system instance to constructor
Allows getting rid of reliance on the global accessor functions and
instead operating on the provided system instance.
2019-03-05 15:47:03 -05:00
Lioncash ec6664f6d6 kernel/address_arbiter: Convert the address arbiter into a class
Places all of the functions for address arbiter operation into a class.
This will be necessary for future deglobalizing efforts related to both
the memory and system itself.
2019-03-05 12:58:26 -05:00
Lioncash bd983414f6 core_timing: Convert core timing into a class
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.

Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
2019-02-15 21:50:25 -05:00
Lioncash 48d9d66dc5 core_timing: Rename CoreTiming namespace to Core::Timing
Places all of the timing-related functionality under the existing Core
namespace to keep things consistent, rather than having the timing
utilities sitting in its own completely separate namespace.
2019-02-12 12:42:17 -05:00
Lioncash 414cc1eb1f kernel: Remove the Timer class
A holdover from citra, the Horizon kernel on the switch has no
prominent kernel object that functions as a timer. At least not
to the degree of sophistication that this class provided.

As such, this can be removed entirely. This class also wasn't used at
all in any meaningful way within the core, so this was just code sitting
around doing nothing. This also allows removing a few things from the
main KernelCore class that allows it to use slightly less resources
overall (though very minor and not anything really noticeable).
2019-01-31 23:05:15 -05:00
Lioncash 8435451093 kernel/thread: Make thread_id a 64-bit value
The kernel uses a 64-bit value for the thread ID, so we shouldn't be
using a 32-bit value.
2018-12-18 22:37:03 -05:00
Lioncash 9b3a38e3d3 kernel/process: Make process_id a 64-bit value
In the actual kernel, this is a 64-bit value, so we shouldn't be using a
32-bit type to handle it.
2018-12-18 22:28:55 -05:00
Lioncash 5d46038c5c kernel/resource_limit: Clean up interface
Cleans out the citra/3DS-specific implementation details that don't
apply to the Switch. Sets the stage for implementing ResourceLimit
instances properly.

While we're at it, remove the erroneous checks within CreateThread() and
SetThreadPriority(). While these are indeed checked in some capacity,
they are not checked via a ResourceLimit instance.

In the process of moving out Citra-specifics, this also replaces the
system ResourceLimit instance's values with ones from the Switch.
2018-11-19 18:16:39 -05:00
Lioncash 90a981a03a kernel/process: Make the handle table per-process
In the kernel, there isn't a singular handle table that everything gets
tossed into or used, rather, each process gets its own handle table that
it uses. This currently isn't an issue for us, since we only execute one
process at the moment, but we may as well get this out of the way so
it's not a headache later on.
2018-10-20 16:38:32 -04:00
Lioncash 5c0408596f kernel/thread: Use a regular pointer for the owner/current process
There's no real need to use a shared pointer in these cases, and only
makes object management more fragile in terms of how easy it would be to
introduce cycles. Instead, just do the simple thing of using a regular
pointer. Much of this is just a hold-over from citra anyways.

It also doesn't make sense from a behavioral point of view for a
process' thread to prolong the lifetime of the process itself (the
process is supposed to own the thread, not the other way around).
2018-10-10 02:04:55 -04:00
Lioncash 3f17fe7133 core: Migrate current_process pointer to the kernel
Given we now have the kernel as a class, it doesn't make sense to keep
the current process pointer within the System class, as processes are
related to the kernel.

This also gets rid of a subtle case where memory wouldn't be freed on
core shutdown, as the current_process pointer would never be reset,
causing the pointed to contents to continue to live.
2018-09-06 20:52:58 -04:00
Lioncash 1242c1ec0a service: Migrate global named port map to the KernelCore class
Now that we have a class representing the kernel in some capacity, we
now have a place to put the named port map, so we move it over and get
rid of another piece of global state within the core.
2018-09-02 12:35:30 -04:00
Lioncash 0cbcd6ec9a kernel: Eliminate kernel global state
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.

This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.

This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.

The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
2018-08-28 22:31:51 -04:00
Lioncash 26de4bb521 core/memory: Get rid of 3DS leftovers
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
Lioncash bf45092c61 kernel: Move object class to its own source files
General moving to keep kernel object types separate from the direct
kernel code. Also essentially a preliminary cleanup before eliminating
global kernel state in the kernel code.
2018-08-01 23:34:42 -04:00
Subv 013778aa21 Qt: Update the WaitTree widget to show info about the current mutex of each thread. 2018-04-20 21:04:34 -05:00
bunnei 8581404482 kernel: Move stack region outside of application heap. 2018-03-16 18:32:23 -04:00
bunnei 67758857e4 hle: Remove Domain and SyncObject kernel objects. 2018-01-24 22:18:54 -05:00
MerryMage e35644c005 clang-format 2018-01-16 18:05:21 +00:00
bunnei bd58c5470c kernel: Increase default stack size to 64K. 2018-01-14 17:20:55 -05:00
bunnei 4236799832 kernel: Rename Semaphore to ConditionVariable. 2018-01-08 21:41:37 -05:00
bunnei e17c0019c5 kernel: Add basic support for Domain object. 2017-12-28 23:30:21 -05:00
James Rowe 61442d6afb Merge pull request #2839 from Subv/global_kernel_lock
Kernel/HLE: Use a mutex  to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
2017-08-23 18:17:44 -06:00
Subv bca8916cea Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
This mutex is acquired in SVC::CallSVC, ie, as soon as the guest application enters the HLE kernel, and should be acquired by the aforementioned threads before modifying kernel structures.
2017-08-22 09:30:55 -05:00
Subv 65f19b51c4 Warnings: Add UNREACHABLE macros to switches that contemplate all possible values. 2017-08-21 08:34:28 -05:00
Yuri Kunde Schlesner be031989ee Kernel: Move HandleTable to a separate file 2017-05-29 17:34:39 -07:00
Yuri Kunde Schlesner 64ecf81a3c Kernel: Move WaitObject to a separate file
Now that HandleTable doesn't directly depend on WaitObject anymore, this
can be separated from the main kernel.h header.
2017-05-29 16:16:46 -07:00
Yuri Kunde Schlesner 9453223075 Kernel: Removed HandleTable::GetWaitObject
This isn't necessary anymore since plain Get works correctly for
WaitObjects.
2017-05-29 15:10:06 -07:00
Yuri Kunde Schlesner b17754f998 Kernel: Extract dynamic Object pointer cast into its own function 2017-05-29 14:42:27 -07:00
Yuri Kunde Schlesner 2cdb40d709 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00