Liam
59a6d88625
kernel: implement KProcess suspension
2022-06-14 10:04:11 -04:00
Liam
c1771c98f3
common: Change semantics of UNREACHABLE to unconditionally crash
2022-06-13 20:09:00 -04:00
Liam
b3dce90004
core/debugger: Support reading guest thread names
2022-06-01 21:25:32 -04:00
Morph
2b87305d31
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.
2022-04-23 05:55:32 -04:00
bunnei
03f8a16869
core: hle: kernel: k_thread: Rework dummy thread waiting.
2022-04-11 21:15:38 -07:00
lat9nq
831f022536
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.
2022-04-03 21:47:58 -04:00
ameerj
22e01068e1
core: Reduce unused includes
2022-03-19 02:23:32 -04:00
bunnei
2b881f4ccc
core: hle: kernel: k_process: Implement thread local storage accurately.
2022-03-14 18:14:54 -07:00
bunnei
84ced13966
core: hle: kernel: k_thread: Ensure host Fiber is freed.
2022-03-14 18:14:53 -07:00
bunnei
a2731424a6
hle: kernel: KThread: Improve Increment/Decrement RunningThreadCount.
...
- Previously implementation was incorrect, and would occasionally underflow.
2022-01-22 21:09:45 -08:00
bunnei
b3f8d2491d
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.
2022-01-21 17:12:06 -08:00
bunnei
f2e870d6b6
hle: kernel: KThread: DummyThread can be waited, ensure wait_queue is not nullptr.
2022-01-20 17:08:00 -08:00
bunnei
668af26696
hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled.
2022-01-20 17:08:00 -08:00
bunnei
247a7e2205
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.
2022-01-20 17:08:00 -08:00
bunnei
cc4cbff1ca
hle: kernel: KThread: Rename thread_type_for_debugging -> thread_type.
...
- This will be used to ensure that we do not schedule dummy threads.
2022-01-20 17:08:00 -08:00
bunnei
b52516263d
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.
2022-01-14 16:44:14 -08:00
bunnei
914431487b
core: hle: kernel: KThread: Replace Suspend with UpdateState & various updates.
...
- This makes our implementations of these more closely match HOS.
2022-01-14 16:44:14 -08:00
bunnei
b12695ddc4
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 .
2021-12-30 15:50:45 -08:00
bunnei
bc45d0fc1a
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.
2021-12-23 00:03:39 -08:00
bunnei
4b2aa52da9
hle: kernel: Remove unnecessary virtual specifier on CancelWait.
2021-12-06 16:39:18 -08:00
bunnei
b5970145a5
hle: kernel: k_thread: Skip reschedule on DisableDispatch with SC.
2021-12-06 16:39:18 -08:00
bunnei
6d2bf18df9
hle: kernel: k_thread: Rename sleeping_queue -> wait_queue.
2021-12-06 16:39:18 -08:00
bunnei
826b07162a
hle: kernel: k_thread: Treat dummy threads as a special type.
2021-12-06 16:39:18 -08:00
bunnei
58da4d5a6e
hle: kernel: Add a flag for indicating that the kernel is currently shutting down.
2021-12-06 16:39:17 -08:00
bunnei
eb34276885
hle: kernel: Cleanup to match coding style.
2021-12-06 16:39:17 -08:00
bunnei
050a4270d6
hle: kernel: KThread: Migrate to updated KThreadQueue (part 2).
2021-12-06 16:39:17 -08:00
bunnei
778f03c57a
hle: kernel: KThread: Migrate to updated KThreadQueue (part 1).
2021-12-06 16:39:17 -08:00
bunnei
0ad0543cde
hle: kernel: KThread: Remove tracking of sync object from threads.
2021-12-06 16:39:17 -08:00
bunnei
e9cdb3cccb
hle: kernel: Update KThreadQueue and migrate KSynchronizationObject.
2021-12-06 16:39:17 -08:00
bunnei
01b0e5b168
core: hle: kernel: Disable dispatch count tracking on single core.
...
- This would have limited value, and would be a mess to handle properly.
2021-12-06 16:39:17 -08:00
bunnei
4bd80abd17
core: hle: kernel: k_thread: Add KScopedDisableDispatch.
2021-12-06 16:39:16 -08:00
ameerj
d27abf5546
core: Remove unused includes
2021-11-03 21:42:57 -04:00
bunnei
5e600cba3a
Revert "kernel: Various improvements to scheduler"
2021-08-25 20:59:28 -07:00
bunnei
b2f859f47c
core: hle: kernel: Disable dispatch count tracking on single core.
...
- This would have limited value, and would be a mess to handle properly.
2021-08-14 02:14:19 -07:00
bunnei
9951f24bad
core: hle: kernel: k_thread: Add KScopedDisableDispatch.
2021-08-07 12:18:47 -07:00
Morph
7ebc38a6d1
general: Replace RESULT_SUCCESS with ResultSuccess
...
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
Lioncash
2d390c1911
k_thread: Move dereference after null check in Initialize()
...
Prevents a -Wnonnull warning on GCC.
2021-05-29 00:31:38 -04:00
Lioncash
e019da0487
kernel: Eliminate variable shadowing
...
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
2021-05-08 12:33:26 -04:00
bunnei
47224d3864
hle: kernel: Migrate to KHandleTable.
2021-05-05 16:40:53 -07:00
bunnei
ad048de3d6
hle: kernel: Rename Process to KProcess.
2021-05-05 16:40:52 -07:00
bunnei
796dddf78f
hle: kernel: Remove deprecated Object class.
2021-05-05 16:40:52 -07:00
bunnei
7e716f100d
hle: kernel: KThread: Remove incorrect resource release.
2021-05-05 16:40:51 -07:00
bunnei
635fc8bda3
hle: kernel: KThread: Add missing resource hint release.
2021-05-05 16:40:51 -07:00
bunnei
11f9080d2e
hle: kernel: Migrate KSharedMemory to KAutoObject.
2021-05-05 16:40:50 -07:00
bunnei
2125abf6d9
hle: kernel: Migrate KThread to KAutoObject.
2021-05-05 16:40:50 -07:00
bunnei
75519d107f
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.
2021-03-05 17:10:57 -08:00
bunnei
845a217d5e
Revert "core: Switch to unique_ptr for usage of Common::Fiber."
2021-03-05 17:08:17 -08:00
bunnei
3322f10f84
core: Switch to unique_ptr for usage of Common::Fiber.
...
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
2021-02-27 11:56:04 -08:00
bunnei
8c9e87ab66
hle: kernel: Migrate MemoryLayout to KMemoryLayout.
2021-02-18 16:16:25 -08:00
Chloe
e62886ead0
kernel: Unify result codes ( #5890 )
...
* kernel: Unify result codes
Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.
* oops
* rename errors to svc_results
2021-02-12 15:43:01 -08:00