aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
Commit message (Collapse)AuthorAgeFilesLines
* core/core: Replace includes with forward declarations where applicableLioncash2018-08-311-1/+2
| | | | | | | | | | | The follow-up to 88597535d629ea9a265f8bf0f00a9ce4dd5dc218, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
* kernel: Eliminate kernel global stateLioncash2018-08-281-101/+18
| | | | | | | | | | | | | | | | | | | | | | 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.
* core: Namespace all code in the arm subdirectory under the Core namespaceLioncash2018-08-241-2/+2
| | | | Gets all of these types and interfaces out of the global namespace.
* Core::CoreTiming: add UnscheduleEventThreadsafeB3n302018-08-131-1/+1
|
* Merge pull request #1042 from Subv/racesbunnei2018-08-121-2/+9
|\ | | | | Fixed a bunch of race conditions when running in multicore mode.
| * Kernel/Threads: Lock the HLE mutex when executing the wakeup callback.Subv2018-08-121-0/+5
| | | | | | | | Another thread might be in the middle of a reschedule, thus altering the state of the schedulers.
| * Kernel/Thread: Always use the threadsafe option when scheduling wakeups.Subv2018-08-121-2/+4
| | | | | | | | | | | | WakeAfterDelay might be called from any host thread, so err on the side of caution and use the thread-safe CoreTiming::ScheduleEventThreadsafe. Note that CoreTiming is still far from thread-safe, there may be more things we have to work on for it to be up to par with what we want.
* | Kernel/Mutex: Don't duplicate threads in the mutex waiter list.Subv2018-08-121-0/+21
|/ | | | | | | | | | Exit from AddMutexWaiter early if the thread is already waiting for a mutex owned by the owner thread. This accounts for the possibility of a thread that is waiting on a condition variable being awakened twice in a row. Also added more validation asserts. This should fix one of the random crashes in Breath Of The Wild.
* kernel/thread: Fix potential crashes introduced in ↵Lioncash2018-08-031-0/+11
| | | | | | | | 3bcf090d37e20e0096954c478179487d071bb37b This amends cases where crashes can occur that were missed due to the odd way the previous code was set up (using 3DS memory regions that don't exist).
* core/memory: Get rid of 3DS leftoversLioncash2018-08-031-31/+2
| | | | Removes leftover code from citra that isn't needed.
* Merge pull request #894 from lioncash/objectbunnei2018-08-031-1/+1
|\ | | | | kernel: Move object class to its own source files
| * kernel: Move object class to its own source filesLioncash2018-08-011-1/+1
| | | | | | | | | | | | 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.
* | kernel/thread: Make GetFreeThreadLocalSlot()'s loop indices size_tLioncash2018-08-021-8/+5
| | | | | | | | | | | | Avoids using a u32 to compare against a range of size_t, which can be a source of warnings. While we're at it, compress a std::tie into a structured binding.
* | kernel/thread: Make GetFreeThreadLocalSlot() reference parameter a const ↵Lioncash2018-08-021-1/+2
| | | | | | | | | | | | | | reference This function only reads the data being referenced, it doesn't modify it, so we can turn the reference into a const reference.
* | kernel/thread: Make GetFreeThreadLocalSlot() internally linkedLioncash2018-08-021-1/+1
|/ | | | | This function isn't used outside of this translation unit, so we can make it internally linked.
* kernel: Remove unnecessary includesLioncash2018-07-311-2/+4
| | | | | Removes unnecessary direct dependencies in some headers and also gets rid of indirect dependencies that were being relied on to be included.
* core_timing: Split off utility functions into core_timing_utilMerryMage2018-07-241-0/+1
|
* Merge pull request #751 from Subv/tpidr_el0bunnei2018-07-211-0/+1
|\ | | | | CPU: Save and restore the TPIDR_EL0 system register on every context switch
| * CPU: Save and restore the TPIDR_EL0 system register on every context switch.Subv2018-07-201-0/+1
| | | | | | | | Note that there's currently a dynarmic bug preventing this register from being written.
* | thread: Convert ThreadStatus into an enum classLioncash2018-07-191-24/+23
|/ | | | | Makes the thread status strongly typed, so implicit conversions can't happen. It also makes it easier to catch mistakes at compile time.
* Merge pull request #690 from lioncash/movebunnei2018-07-181-1/+1
|\ | | | | core/memory, core/hle/kernel: Use std::move where applicable
| * core/memory, core/hle/kernel: Use std::move where applicableLioncash2018-07-181-1/+1
| | | | | | | | Avoids pointless copies
* | core: Don't construct instance of Core::System, just to access its live instanceLioncash2018-07-181-6/+6
|/ | | | | | | | | This would result in a lot of allocations and related object construction, just to toss it all away immediately after the call. These are definitely not intentional, and it was intended that all of these should have been accessing the static function GetInstance() through the name itself, not constructed instances.
* Update clang formatJames Rowe2018-07-021-1/+1
|
* Rename logging macro back to LOG_*James Rowe2018-07-021-5/+5
|
* Kernel/Arbiters: Implement WaitForAddressMichael Scire2018-06-211-0/+6
|
* Kernel/Threads: A thread waking up by timeout from a WaitProcessWideKey may ↵Subv2018-06-021-2/+5
| | | | | | | | | | | | already have an assigned lock owner. This situation may happen like so: Thread 1 with low priority calls WaitProcessWideKey with timeout. Thread 2 with high priority calls WaitProcessWideKey without timeout. Thread 3 calls SignalProcessWideKey - Thread 2 acquires the lock and awakens. - Thread 1 can't acquire the lock and is put to sleep with the lock owner being Thread 2. Thread 1's timeout expires, with the lock owner still being set to Thread 2.
* Kernel/Thread: Corrected a typo that caused the affinity mask to never be ↵Subv2018-05-301-2/+2
| | | | changed.
* Kernel/Thread: Corrected a typo in an assert about the processor id.Subv2018-05-301-1/+1
|
* thread: Rename mask to affinity_masks.bunnei2018-05-101-2/+2
|
* thread: Support core change on ResumeFromWait and improve ChangeCore.bunnei2018-05-101-37/+68
|
* thread: Initialize ideal_core and mask members.bunnei2018-05-101-0/+2
|
* threading: Reschedule only on cores that are necessary.bunnei2018-05-101-1/+1
|
* thread: Implement ChangeCore function.bunnei2018-05-101-1/+52
|
* core: Implement multicore support.bunnei2018-05-101-8/+8
|
* core_timing: Namespace all functions and constants in core_timing's headerLioncash2018-04-301-1/+2
| | | | All of these variables and functions are related to timings and should be within the namespace.
* general: Convert assertion macros over to be fmt-compatibleLioncash2018-04-271-2/+2
|
* kernel: Migrate logging macros to fmt-compatible onesLioncash2018-04-251-7/+8
|
* Kernel: Implemented mutex priority inheritance.Subv2018-04-231-2/+39
| | | | | | | Verified with a hwtest and implemented based on reverse engineering. Thread A's priority will get bumped to the highest priority among all the threads that are waiting for a mutex that A holds. Once A releases the mutex and ownership is transferred to B, A's priority will return to normal and B's priority will be bumped.
* Kernel: Remove unused ConditionVariable class.Subv2018-04-201-9/+0
|
* Kernel: Remove old and unused Mutex code.Subv2018-04-201-3/+0
|
* Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.Subv2018-04-201-1/+12
| | | | | | | | | | Switch mutexes are no longer kernel objects, they are managed in userland and only use the kernel to handle the contention case. Mutex addresses store a special flag value (0x40000000) to notify the guest code that there are still some threads waiting for the mutex to be released. This flag is updated when a thread calls ArbitrateUnlock. TODO: * Fix svcWaitProcessWideKey * Fix svcSignalProcessWideKey * Remove the Mutex class.
* memory: Fix stack region.bunnei2018-03-311-1/+1
|
* thread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB.bunnei2018-03-181-18/+3
|
* kernel: Move stack region outside of application heap.bunnei2018-03-161-1/+1
|
* MemoryState: Add additional memory states and improve naming.bunnei2018-03-161-1/+1
|
* core: Move process creation out of global state.bunnei2018-03-141-2/+2
|
* thread: Clear the process list on shutdown.Jules Blok2018-02-271-1/+3
|
* kernel: Use Scheduler class for threading.bunnei2018-02-181-155/+14
|
* kernel: Remove unused address_arbiter code.bunnei2018-02-181-34/+0
|