aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
AgeCommit message (Collapse)Author
2018-04-23Kernel: Implemented mutex priority inheritance.Subv
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.
2018-04-20Kernel: Remove unused ConditionVariable class.Subv
2018-04-20Kernel: Remove old and unused Mutex code.Subv
2018-04-20Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.Subv
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.
2018-03-31memory: Fix stack region.bunnei
2018-03-18thread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB.bunnei
2018-03-16kernel: Move stack region outside of application heap.bunnei
2018-03-16MemoryState: Add additional memory states and improve naming.bunnei
2018-03-14core: Move process creation out of global state.bunnei
2018-02-27thread: Clear the process list on shutdown.Jules Blok
2018-02-18kernel: Use Scheduler class for threading.bunnei
2018-02-18kernel: Remove unused address_arbiter code.bunnei
2018-02-18 Kernel/IPC: Add a small delay after each SyncRequest to prevent thread ↵Subv
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.
2018-02-14thread: Silence formatting specifier warningsLioncash
2018-01-08Kernel: Allow chaining WaitSynchronization calls inside a wakeup callback.Subv
2018-01-08CoreTiming: Reworked CoreTiming (cherry-picked from Citra #3119)B3n30
* CoreTiming: New CoreTiming; Add Test for CoreTiming
2018-01-02arm: Remove SkyEye/Dyncom code that is ARMv6-only.bunnei
2017-12-31thread: Keep track of the initially created handle.bunnei
This is kinda crufty, but we need it for now to update guest state variables.
2017-12-30thread: Main thread should set thread handle to reg 1.bunnei
2017-12-30thread: Remove THUMB mode flag.bunnei
2017-12-30thread: Main thread should be ready by default, all others dormant.bunnei
2017-12-29kernel: Various 64-bit fixes in memory/process/threadbunnei
2017-10-31hle: Use Switch formatted result codes.bunnei
2017-10-19hle: Fix QueryMemory response for MemoryInfo.bunnei
2017-10-09Merge remote-tracking branch 'upstream/master' into nxbunnei
# Conflicts: # src/core/CMakeLists.txt # src/core/arm/dynarmic/arm_dynarmic.cpp # src/core/arm/dyncom/arm_dyncom.cpp # src/core/hle/kernel/process.cpp # src/core/hle/kernel/thread.cpp # src/core/hle/kernel/thread.h # src/core/hle/kernel/vm_manager.cpp # src/core/loader/3dsx.cpp # src/core/loader/elf.cpp # src/core/loader/ncch.cpp # src/core/memory.cpp # src/core/memory.h # src/core/memory_setup.h
2017-10-09loader: Various improvements for NSO/NRO loaders.bunnei
2017-10-01Merge pull request #2971 from Subv/per_process_memopsSebastian Valle
Memory: Add overloads for ReadBlock and WriteBlock that operate on a specific process.
2017-10-01Kernel/Thread: Added a helper function to get a thread's command buffer VAddr.Subv
2017-09-30kernel: Various threading fixes to support 64-bit addressing.bunnei
2017-09-30Merge pull request #2967 from Subv/thread_wakeup_callbacksSebastian Valle
Kernel/Threads: When putting a thread to wait, specify a function to execute when it is awoken
2017-09-30Fixed type conversion ambiguityHuw Pascoe
2017-09-28Kernel/Threads: When putting a thread to wait, specify a function to execute ↵Subv
when it is awoken. This change makes for a clearer (less confusing) path of execution in the scheduler, now the code to execute when a thread awakes is closer to the code that puts the thread to sleep (WaitSynch1, WaitSynchN). It also allows us to implement the special wake up behavior of ReplyAndReceive without hacking up WaitObject::WakeupAllWaitingThreads. If savestates are desired in the future, we can change this implementation to one similar to the CoreTiming event system, where we first register the callback functions at startup and assign their identifiers to the Thread callback variable instead of directly assigning a lambda to the wake up callback variable.
2017-09-26Kernel/Thread: Allow specifying which process a thread belongs to when ↵Subv
creating it. Don't automatically assume that Thread::Create will only be called when the parent process is currently scheduled. This assumption will be broken when applets or system modules are loaded.
2017-09-24memory: Add GetCurrentPageTable/SetCurrentPageTableMerryMage
Don't expose Memory::current_page_table as a global.
2017-09-15Merge pull request #2842 from Subv/switchable_page_tableB3n30
Kernel/Memory: Give each process its own page table and allow switching the current page table upon reschedule
2017-09-15Kernel/Threads: Don't clear the CPU instruction cache when performing a ↵Subv
context switch from an idle thread into a thread in the same process. We were unnecessarily clearing the cache when going from Process A -> Idle -> Process A, this caused extreme performance regressions.
2017-09-10Kernel/Memory: Switch the current page table when a new process is scheduled.Subv
2017-08-21Kernel/Threads: Don't immediately switch to the new main thread when loading ↵Subv
a new process. This is necessary for loading multiple processes at the same time. The main thread will be automatically scheduled when necessary once the scheduler runs.
2017-06-18ResultVal: Remove MoveFrom()Yuri Kunde Schlesner
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in case you already have an rvalue.
2017-05-29Kernel: Move HandleTable to a separate fileYuri Kunde Schlesner
2017-05-24Kernel: Centralize error definitions in errors.hYuri Kunde Schlesner
2017-01-11Threads: Check the process' resource limit for the max allowed priority when ↵Subv
creating a thread and remove the priority clamping code.
2017-01-11Thread: Added priority range checking to svcSetThreadPriority and removed ↵Subv
priority clamping code from Thread::SetPriority.
2017-01-06Merge pull request #2410 from Subv/sleepthreadbunnei
Don't yield execution in SleepThread(0) if there are no available threads to run
2017-01-06Merge pull request #2408 from Subv/priority_boostingbunnei
Kernel: Removed the priority boost code for starved threads.
2017-01-05Kernel: Don't attempt to yield execution in SleepThread(0) if there are no ↵Subv
available threads to run. With this we avoid an useless temporary deschedule of the current thread.
2017-01-05Kernel: Remove some unused functions.Subv
2017-01-05Kernel: Removed the priority boost code for starved threads.Subv
After hwtesting and reverse engineering the kernel, it was found that the CTROS scheduler performs no priority boosting for threads like this, although some other forms of scheduling priority-starved threads might take place. For example, it was found that hardware interrupts might cause low-priority threads to run if the CPU is preempted in the middle of an SVC handler that deschedules the current (high priority) thread before scheduling it again.
2017-01-05Kernel: Add some asserts to enforce the invariants in the scheduler.Subv
2017-01-05Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all ↵Subv
the objects that a thread is waiting on.