aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
AgeCommit message (Collapse)Author
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.
2015-02-09Scheduler refactor Pt. 1Kevin Hartman
* Simplifies scheduling logic, specifically regarding thread status. It should be much clearer which statuses are valid for a thread at any given point in the system. * Removes dead code from thread.cpp. * Moves the implementation of resetting a ThreadContext to the corresponding core's implementation. Other changes: * Fixed comments in arm interfaces. * Updated comments in thread.cpp * Removed confusing, useless, functions like MakeReady() and ChangeStatus() from thread.cpp. * Removed stack_size from Thread. In the CTR kernel, the thread's stack would be allocated before thread creation.
2015-02-03core: Fix some warnings on OSXLioncash
2015-02-02Kernel: Make WaitObjects share ownership of Threads waiting on themYuri Kunde Schlesner
During normal operation, a thread waiting on an WaitObject and the object hold mutual references to each other for the duration of the wait. If a process is forcefully terminated (The CTR kernel has a SVC to do this, TerminateProcess, though no equivalent exists for threads.) its threads would also be stopped and destroyed, leaving dangling pointers in the WaitObjects. The solution is to simply have the Thread remove itself from WaitObjects when it is stopped. The vector of Threads in WaitObject has also been changed to hold SharedPtrs, just in case. (Better to have a reference cycle than a crash.)
2015-02-02Kernel: Fix bug in HandleTable::CloseYuri Kunde Schlesner
2015-02-02Kernel: Remove Object::GetHandle (it's not used anymore :D)Yuri Kunde Schlesner
2015-02-02Kernel: Introduce unique Object ids for debuggingYuri Kunde Schlesner
2015-01-21Kernel: Renamed some functions for clarity.bunnei
- ReleaseNextThread->WakeupNextThread - ReleaseAllWaitingThreads->WakeupAllWaitingThreads.