Liam
2c56e94702
kernel: make current thread pointer thread local
3 years ago
bunnei
9da4e62573
Merge pull request #8483 from liamwhite/fire-emblem-three-semaphores
...
kernel: wait for threads to stop on pause
3 years ago
Liam
24d7aaf43c
kernel: wait for threads to stop on pause
3 years ago
Liam
744a208763
kernel: fix some uses of disable_count
3 years ago
Liam
888f499188
kernel: implement KProcess suspension
3 years ago
Liam
084d7d6b01
common: Change semantics of UNREACHABLE to unconditionally crash
3 years ago
Liam
07922abffc
core/debugger: Support reading guest thread names
3 years ago
Morph
99ceb03a1c
general: Convert source file copyright comments over to SPDX
...
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
3 years ago
bunnei
3f0b93925f
core: hle: kernel: k_thread: Rework dummy thread waiting.
3 years ago
lat9nq
6bcbbb29e7
k_thread: Fix data race
...
TSan reports a data race between writing at cpp:1162 and reading at
h:262. Make the thread_state atomic to prevent this.
3 years ago
ameerj
ade596121b
core: Reduce unused includes
3 years ago
bunnei
813b2ef253
core: hle: kernel: k_process: Implement thread local storage accurately.
3 years ago
bunnei
4a28d8cebb
core: hle: kernel: k_thread: Ensure host Fiber is freed.
3 years ago
bunnei
59add00d4a
hle: kernel: KThread: Improve Increment/Decrement RunningThreadCount.
...
- Previously implementation was incorrect, and would occasionally underflow.
3 years ago
bunnei
615fb40416
hle: kernel: KThread: Ensure host (dummy) threads block on locking.
...
- But do not enter the priority queue, as otherwise they will be scheduled.
- Allows dummy threads to use guest synchronization primitives.
3 years ago
bunnei
91ff6d4cb3
hle: kernel: KThread: DummyThread can be waited, ensure wait_queue is not nullptr.
3 years ago
bunnei
46a620f9d7
hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled.
3 years ago
bunnei
5ffec69dc7
hle: kernel: KThread: Ensure dummy threads never call EndWait.
...
- These are only used by host threads for locking and will never have a wait_queue.
3 years ago
bunnei
f6cbb14dce
hle: kernel: KThread: Rename thread_type_for_debugging -> thread_type.
...
- This will be used to ensure that we do not schedule dummy threads.
3 years ago
bunnei
f499c8177e
core: hle: kernel: KThread: Integrate with KWorkerTask and implement DoWorkerTaskImpl.
...
- This is used to terminate a thread asynchronously after it has been exited.
- This fixes a crash that can occur in Pokemon Sword/Shield because a thread is incorrectly closed on svcExitThread, then, the thread is destroyed on svcCloseHandle while it is still scheduled.
- Instead, we now wait for the thread to no longer be scheduled on all cores before destroying it from KWorkerTaskManager, which is accurate to HOS behavior.
3 years ago
bunnei
03884b7ea6
core: hle: kernel: KThread: Replace Suspend with UpdateState & various updates.
...
- This makes our implementations of these more closely match HOS.
3 years ago
bunnei
3a89723d97
core: hle: kernel: Implement thread pinning.
...
- We largely had the mechanics in place for thread pinning, this change hooks these up.
- Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_thread_pinning.cpp .
3 years ago
bunnei
a0c7d93b84
core: hle: kernel: KThread: X18 should be a cryptographically random number.
...
- This was added with firmware 11.0.0 (https://switchbrew.org/wiki/11.0.0 ).
- X18 is OR'd by kernel with 1, to make sure it is odd.
3 years ago
bunnei
0d1bdfc1d4
hle: kernel: Remove unnecessary virtual specifier on CancelWait.
3 years ago
bunnei
a2384a18fa
hle: kernel: k_thread: Skip reschedule on DisableDispatch with SC.
3 years ago
bunnei
42697527ba
hle: kernel: k_thread: Rename sleeping_queue -> wait_queue.
3 years ago
bunnei
0d9afdedc4
hle: kernel: k_thread: Treat dummy threads as a special type.
3 years ago
bunnei
abbea575cf
hle: kernel: Add a flag for indicating that the kernel is currently shutting down.
3 years ago
bunnei
8f4ff06c4c
hle: kernel: Cleanup to match coding style.
3 years ago
bunnei
f62c7091a2
hle: kernel: KThread: Migrate to updated KThreadQueue (part 2).
3 years ago
bunnei
b0671c7cfa
hle: kernel: KThread: Migrate to updated KThreadQueue (part 1).
3 years ago
bunnei
2f89456041
hle: kernel: KThread: Remove tracking of sync object from threads.
3 years ago
bunnei
bc1399204b
hle: kernel: Update KThreadQueue and migrate KSynchronizationObject.
3 years ago
bunnei
3dc803a430
core: hle: kernel: Disable dispatch count tracking on single core.
...
- This would have limited value, and would be a mess to handle properly.
3 years ago
bunnei
04daefa488
core: hle: kernel: k_thread: Add KScopedDisableDispatch.
3 years ago
ameerj
7c4b6aab2e
core: Remove unused includes
4 years ago
bunnei
0c8594b225
Revert "kernel: Various improvements to scheduler"
4 years ago
bunnei
aef0ca6f0d
core: hle: kernel: Disable dispatch count tracking on single core.
...
- This would have limited value, and would be a mess to handle properly.
4 years ago
bunnei
01af2f4162
core: hle: kernel: k_thread: Add KScopedDisableDispatch.
4 years ago
Morph
12c1766997
general: Replace RESULT_SUCCESS with ResultSuccess
...
Transition to PascalCase for result names.
4 years ago
Lioncash
16ff0161b3
k_thread: Move dereference after null check in Initialize()
...
Prevents a -Wnonnull warning on GCC.
4 years ago
Lioncash
2f62bae9e3
kernel: Eliminate variable shadowing
...
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
4 years ago
bunnei
4b03e6e776
hle: kernel: Migrate to KHandleTable.
4 years ago
bunnei
2a7eff57a8
hle: kernel: Rename Process to KProcess.
4 years ago
bunnei
bf380b8584
hle: kernel: Remove deprecated Object class.
4 years ago
bunnei
84bb772003
hle: kernel: KThread: Remove incorrect resource release.
4 years ago
bunnei
c2f6f2ba7a
hle: kernel: KThread: Add missing resource hint release.
4 years ago
bunnei
086db71e94
hle: kernel: Migrate KSharedMemory to KAutoObject.
4 years ago
bunnei
479bd50b96
hle: kernel: Migrate KThread to KAutoObject.
4 years ago
bunnei
47af34003b
hle: kernel: KThread: Rework dummy threads & fix memory leak.
...
- Dummy threads are created on thread local storage for all host threads.
- Fixes a leak by removing creation of fibers, which are not applicable here.
4 years ago