Commit Graph

234 Commits (4c3c608d59b8c8d8a9bbccc1b55efcab346e650f)

Author SHA1 Message Date
bunnei 4c3c608d59
Merge pull request #894 from lioncash/object
kernel: Move object class to its own source files
7 years ago
Lioncash 6058c84b79 kernel/thread: Make GetFreeThreadLocalSlot()'s loop indices size_t
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.
7 years ago
Lioncash fac0e42b2f kernel/thread: Make GetFreeThreadLocalSlot() reference parameter a const reference
This function only reads the data being referenced, it doesn't modify
it, so we can turn the reference into a const reference.
7 years ago
Lioncash 9a50a4f2cc kernel/thread: Make GetFreeThreadLocalSlot() internally linked
This function isn't used outside of this translation unit, so we can
make it internally linked.
7 years ago
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.
7 years ago
Lioncash a2304fad16 kernel: Remove unnecessary includes
Removes unnecessary direct dependencies in some headers and also gets
rid of indirect dependencies that were being relied on to be included.
7 years ago
MerryMage 44646e2ea0 core_timing: Split off utility functions into core_timing_util 7 years ago
bunnei fe2498a650
Merge pull request #751 from Subv/tpidr_el0
CPU: Save and restore the TPIDR_EL0 system register on every context switch
7 years ago
Subv d84eb9dac6 CPU: Save and restore the TPIDR_EL0 system register on every context switch.
Note that there's currently a dynarmic bug preventing this register from being written.
7 years ago
Lioncash dbfe82773d thread: Convert ThreadStatus into an enum class
Makes the thread status strongly typed, so implicit conversions can't
happen. It also makes it easier to catch mistakes at compile time.
7 years ago
bunnei 85421f3406
Merge pull request #690 from lioncash/move
core/memory, core/hle/kernel: Use std::move where applicable
7 years ago
Lioncash 46458e7284 core/memory, core/hle/kernel: Use std::move where applicable
Avoids pointless copies
7 years ago
Lioncash 3a4841e403 core: Don't construct instance of Core::System, just to access its live instance
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.
7 years ago
James Rowe 0d46f0df12 Update clang format 7 years ago
James Rowe 638956aa81 Rename logging macro back to LOG_* 7 years ago
Michael Scire 9d71ce88ce Kernel/Arbiters: Implement WaitForAddress 7 years ago
Subv 9cd87a6352 Kernel/Threads: A thread waking up by timeout from a WaitProcessWideKey may 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.
7 years ago
Subv c02d7c8ce7 Kernel/Thread: Corrected a typo that caused the affinity mask to never be changed. 7 years ago
Subv d1f9c750a6 Kernel/Thread: Corrected a typo in an assert about the processor id. 7 years ago
bunnei 46ec9a9bc9 thread: Rename mask to affinity_masks. 7 years ago
bunnei fbd7afefaa thread: Support core change on ResumeFromWait and improve ChangeCore. 7 years ago
bunnei 4822765fef thread: Initialize ideal_core and mask members. 7 years ago
bunnei 8aa5d25f82 threading: Reschedule only on cores that are necessary. 7 years ago
bunnei 6ea8b3ef60 thread: Implement ChangeCore function. 7 years ago
bunnei a434fdcb10 core: Implement multicore support. 7 years ago
Lioncash 0197e28cc9
core_timing: Namespace all functions and constants in core_timing's header
All of these variables and functions are related to timings and should be within the namespace.
7 years ago
Lioncash 8475496630
general: Convert assertion macros over to be fmt-compatible 7 years ago
Lioncash 40dee76c57
kernel: Migrate logging macros to fmt-compatible ones 7 years ago
Subv 46572d027d Kernel: Implemented mutex priority inheritance.
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.
7 years ago
Subv be155f4d9d Kernel: Remove unused ConditionVariable class. 7 years ago
Subv 5fdfbfe25a Kernel: Remove old and unused Mutex code. 7 years ago
Subv e81a2080eb Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.
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.
7 years ago
bunnei b27ab46bde memory: Fix stack region. 7 years ago
bunnei e353b9fb3d thread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB. 7 years ago
bunnei 8581404482 kernel: Move stack region outside of application heap. 7 years ago
bunnei 8be7131033 MemoryState: Add additional memory states and improve naming. 7 years ago
bunnei 7d6653268f core: Move process creation out of global state. 7 years ago
Jules Blok c74af07c49 thread: Clear the process list on shutdown. 7 years ago
bunnei ac81c02ed9 kernel: Use Scheduler class for threading. 7 years ago
bunnei cec0d4f191 kernel: Remove unused address_arbiter code. 7 years ago
Subv 94ee8fc97b Kernel/IPC: Add a small delay after each SyncRequest to prevent thread starvation.
Ported from citra PR #3091

The delay specified here is from a Nintendo 3DS, and should be measured in a Nintendo Switch.

This change is enough to prevent Puyo Puyo Tetris's main thread starvation.
7 years ago
Lioncash c1146d2a5f
thread: Silence formatting specifier warnings 7 years ago
Subv 2a3f8e8484 Kernel: Allow chaining WaitSynchronization calls inside a wakeup callback. 7 years ago
B3n30 82151d407d CoreTiming: Reworked CoreTiming (cherry-picked from Citra #3119)
* CoreTiming: New CoreTiming; Add Test for CoreTiming
7 years ago
bunnei b172f0d770 arm: Remove SkyEye/Dyncom code that is ARMv6-only. 7 years ago
bunnei 1cb978eb82 thread: Keep track of the initially created handle.
This is kinda crufty, but we need it for now to update guest state variables.
7 years ago
bunnei b6087e35b5 thread: Main thread should set thread handle to reg 1. 7 years ago
bunnei 7ccd8de863 thread: Remove THUMB mode flag. 7 years ago
bunnei eed4f2e229 thread: Main thread should be ready by default, all others dormant. 7 years ago
bunnei ebd4b1422d kernel: Various 64-bit fixes in memory/process/thread 7 years ago