aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
AgeCommit message (Collapse)Author
2018-11-19kernel/resource_limit: Clean up interfaceLioncash
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-10-28core: Make System references const where applicableLioncash
2018-10-20kernel/process: Make the handle table per-processLioncash
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-10kernel/thread: Use a regular pointer for the owner/current processLioncash
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-04kernel/thread: Make all instance variables privateLioncash
Many of the member variables of the thread class aren't even used outside of the class itself, so there's no need to make those variables public. This change follows in the steps of the previous changes that made other kernel types' members private. The main motivation behind this is that the Thread class will likely change in the future as emulation becomes more accurate, and letting random bits of the emulator access data members of the Thread class directly makes it a pain to shuffle around and/or modify internals. Having all data members public like this also makes it difficult to reason about certain bits of behavior without first verifying what parts of the core actually use them. Everything being public also generally follows the tendency for changes to be introduced in completely different translation units that would otherwise be better introduced as an addition to the Thread class' public interface.
2018-09-06core: Migrate current_process pointer to the kernelLioncash
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-02service: Migrate global named port map to the KernelCore classLioncash
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-08-28kernel: Eliminate kernel global stateLioncash
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-13kernel/object: Tighten object against data racesLioncash
Despite being covered by a global mutex, we should still ensure that the class handles its reference counts properly. This avoids potential shenanigans when it comes to data races. Given this is the root object that drives quite a bit of the kernel object hierarchy, ensuring we always have the correct behavior (and no races) is a good thing.
2018-08-03core/memory: Get rid of 3DS leftoversLioncash
Removes leftover code from citra that isn't needed.
2018-07-31kernel: Remove unused object_address_table.cpp/.hLioncash
These source files were entirely unused throughout the rest of the codebase. This also has the benefit of getting rid of a global variable as well.
2018-07-23hle: Remove config_mem.h/.cppLioncash
This is just an unused hold-over from citra, so we can get rid of this to trim off an exposed global, among other things.
2018-07-23hle: Remove shared_page.h/.cppLioncash
This is a holdover from citra that's essentially unused.
2018-03-14core: Move process creation out of global state.bunnei
2018-01-01kernel: Add ObjectAddressTable class.bunnei
2017-05-29Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner
2017-05-29Kernel: Move WaitObject to a separate fileYuri Kunde Schlesner
Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
2017-05-24Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner
2017-01-05Kernel: Add some asserts to enforce the invariants in the scheduler.Subv
2017-01-05Kernel: Remove a thread from all of its waiting objects' waiting_threads ↵Subv
list when it is awoken. This fixes a potential bug where threads would not get removed from said list if they awoke after waiting with WaitSynchronizationN with wait_all = false
2017-01-05Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all ↵Subv
the objects that a thread is waiting on.
2017-01-04Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.Subv
2017-01-04Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.Subv
This will be useful when implementing mutex priority inheritance.
2016-12-16Kernel: remove object's waiting thread if it is deadwwylele
2016-12-14Fixed the codestyle to match our clang-format rules.Subv
2016-12-10Properly remove a thread from its wait_objects' waitlist when it is awoken ↵Subv
by a timeout.
2016-12-09WaitSynch: Removed unused variables and reduced SharedPtr copies.Subv
Define a variable with the value of the sync timeout error code. Use a boost::flat_map instead of an unordered_map to hold the equivalence of objects and wait indices in a WaitSynchN call.
2016-12-06Use boost remove_erase_if instead of the erase-remove idiomSubv
2016-12-06Improved the algorithm for GetHighestPriorityReadyThread.Subv
2016-12-04Threading: Added some utility functions and const correctness.Subv
2016-12-03Threading: Reworked the way our scheduler works.Subv
Threads will now be awakened when the objects they're waiting on are signaled, instead of repeating the WaitSynchronization call every now and then. The scheduler is now called once after every SVC call, and once after a thread is awakened from sleep by its timeout callback. This new implementation is based off reverse-engineering of the real kernel. See https://gist.github.com/Subv/02f29bd9f1e5deb7aceea1e8f019c8f4 for a more detailed description of how the real kernel handles rescheduling.
2016-11-19Kernel/Loader: Grab the system mode from the NCCH ExHeader.Subv
3dsx and elf files default to system mode 2 (96MB allocated to the application). This allows Home Menu to boot without modifications. Closes #1849
2016-09-22implement wait tree widgetwwylele
2016-09-21Use negative priorities to avoid special-casing the self-includeYuri Kunde Schlesner
2016-09-21Remove empty newlines in #include blocks.Emmanuel Gil Peyrot
This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
2016-09-18Sources: Run clang-format on everything.Emmanuel Gil Peyrot
2015-08-16Kernel: Add more infrastructure to support different memory layoutsYuri Kunde Schlesner
This adds some structures necessary to support multiple memory regions in the future. It also adds support for different system memory types and the new linear heap mapping at 0x30000000.
2015-06-28Common: Cleanup key_map includes.Emmanuel Gil Peyrot
2015-06-16kernel: Fix svcWaitSynch to always acquire requested wait objects.bunnei
2015-05-14Core/ResourceLimits: Implemented the basic structure of ResourceLimits.Subv
Implemented svcs GetResourceLimit, GetResourceLimitCurrentValues and GetResourceLimitLimitValues. Note that the resource limits do not currently keep track of used objects, since we have no way to distinguish between an object created by the application, and an object created by some HLE module once we're inside Kernel::T::Create.
2015-05-11fixup!Subv
2015-05-11Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThreadSubv
2015-05-08Kernel: Remove unused g_main_thread variableYuri Kunde Schlesner
2015-05-08Kernel: Remove g_program_idYuri Kunde Schlesner
This has been obsoleted by the field in Process.
2015-05-08Kernel: Introduce skeleton Process class to hold process dataYuri Kunde Schlesner
2015-05-07Common: Remove common.hYuri Kunde Schlesner
2015-05-01Kernel: Properly initialize and shutdown all modules.bunnei
2015-04-09Kernel: Fixed default thread priority.bunnei
2015-02-12Build: Fixed some warningsSubv
2015-02-10Asserts: break/crash program, fit to style guide; log.h->assert.harchshift
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft.