bunnei
a8476d9db0
core: hle: kernel: KPageTable: Operate: Assert lock ownership.
5 years ago
bunnei
8f3c7cb89b
core: hle: kernel: KPageTable: SetHeapSize: Cleanup & take physical memory lock.
5 years ago
bunnei
24efadee60
core: hle: kernel: Refactor Un/MapPhysicalMemory to remove unnecessary methods.
5 years ago
bunnei
ebb9ec197e
core: hle: kernel: Rename Un/Map to Un/MapMeory.
5 years ago
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.
5 years ago
bunnei
8f2630de0a
hle: kernel: Remove redundant tracking of dummy threads.
- These are already tracked by kernel's registered_objects member.
5 years ago
bunnei
f2e870d6b6
hle: kernel: KThread: DummyThread can be waited, ensure wait_queue is not nullptr.
5 years ago
bunnei
668af26696
hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled.
5 years ago
bunnei
db3c11506b
hle: kernel: service_thread: Ensure dummy thread is closed & destroyed on thread exit.
5 years ago
bunnei
e885b0ab0d
hle: kernel: KServerSession: Remove hack for CompleteSyncRequest.
- This does not appear to be necessary anymore.
5 years ago
bunnei
af11abed3f
hle: kernel: KServerSession: Simplify CompleteSyncRequest EndWait.
- Considering is_thread_waiting is never set, so we can remove IsThreadWaiting.
- KThread::EndWait will take the scheduler lock, so we can remove the redundant lock.
5 years ago
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.
5 years ago
bunnei
f1e06f984d
hle: kernel: KScheduler: Ensure dummy threads are never scheduled.
- These are only used by host threads for locking.
5 years ago
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.
5 years ago
Valeri
01852ee857
hle: remove no-op code
Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there.
5 years ago
bunnei
4148fde355
hle: kernel: k_memory_manager: Clear pages on allocation & free.
- Heap pages should be zero'd.
- Also explicitly passed along heap allocation option.
5 years ago
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.
5 years ago
bunnei
18969b5d8e
core: hle: kernel: KProcess: Integrate with KWorkerTask and add unimplemented DoWorkerTaskImpl.
5 years ago
bunnei
914431487b
core: hle: kernel: KThread: Replace Suspend with UpdateState & various updates.
- This makes our implementations of these more closely match HOS.
5 years ago
bunnei
b6bf119a43
core: hle: kernel: Instantiate a kernel instance of KWorkerTaskManager.
5 years ago
bunnei
b722faaf7a
core: hle: kernel: Add KWorkerTask and KWorkerTaskManager.
- These primitives are used to dispatch asynchronous kernel tasks from KThread and KProcess.
5 years ago
bunnei
fbab3dc017
hle: kernel: Fix service_threads access to be thread safe V2.
- PR #7699 attempted to fix CreateServiceThread and ReleaseServiceThread to be thread safe, but inadvertently introduced a possible dead-lock.
- With this PR, we use a worker thread to manage the service thread list, allowing it only to be accessed by a single thread, and guaranteeing threads will not destroy themselves.
- Fixes a rare crash in Pokemon Sword/Shield, I've now run this game for ~12 hours non-stop and am quite confident this is a good solution for this issue.
5 years ago
bunnei
ef9186172f
hle: kernel: Fix service_threads access to be thread safe.
- CreateServiceThread and ReleaseServiceThread can be accessed by different threads, uses a lock to make this thread safe.
- Fixes a rare crash in Pokemon Sword/Shield that can occur when a new service thread is being created while an old one is being destroyed.
5 years ago
bunnei
d45b65b4d9
hle: kernel: k_page_table: Update SetProcessMemoryPermission.
5 years ago
bunnei
84a61db25b
hle: kernel: k_page_table: ReadAndWrite -> UserReadWrite.
5 years ago
bunnei
0942533d2f
hle: kernel: k_page_table: Rename *ProcessCodeMemory -> *CodeMemory.
5 years ago
bunnei
b227426ae5
core: hle: kernel: svc: Updates to SetMemoryAttribute and SetMemoryPermission.
5 years ago
bunnei
090f1c400e
core: hle: kernel: k_page_table: Update CheckMemoryState.
5 years ago
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 .
5 years ago
bunnei
714dcea191
core: hle: kernel: Updated implementation of svcSetHeapSize.
- Updates our svcSetHeapSize with latest HOS, furthermore allowing heap size to properly be extended/shrunk.
- Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_set_heap_size.cpp .
5 years ago
bunnei
555481005d
core: hle: kernel: Implement SetMemoryPermission.
- Not seen in any games yet, but validated with kernel tests.
5 years ago
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.
5 years ago
bunnei
a1f637a6d0
hle: kernel: svc: GetInfo: Fix error checking with IdleTickCount.
- Enforce tha the supplied handle is invalid, not valid.
- This gets Witcher 3 booting.
5 years ago
ameerj
1fff9ea35e
kernel: Manually destroy the current process during shut down
Avoids a memory leak.
5 years ago
bunnei
5192e8e092
core: hle: Remove global HLE lock.
- This was added early on as a hack to protect against some concurrency issues.
- It's not clear that this serves any purpose anymore, and if it does, individual components should be fixed rather than using a global recursive mutex.
5 years ago
Valeri
295b676fe6
Remove erroneous #pragma once
5 years ago
itsmeft24
9a28199c5a
Update k_code_memory.h
5 years ago
itsmeft24
4b0b2d7d1d
make KCodeMemory::GetSourceAddress const
Co-authored-by: Mai M. <mathew1800@gmail.com>
5 years ago
bunnei
5788e077cd
hle: kernel k_scheduler: EnableScheduling: Remove redundant GetCurrentThreadPointer calls.
5 years ago
bunnei
1b1ed86ec7
hle: kernel k_process: Remove unnecessary .at usage with thread pinning methods.
5 years ago
bunnei
38a6477770
hle: kernel: Remove unnecessary virtual specifier on NotifyAvailable.
5 years ago
bunnei
829c4b6144
hle: kernel: Remove unnecessary virtual specifier on EndWait.
5 years ago
bunnei
1457a75a40
hle: kernel: k_light_condition_variable: Revert unnecessary license comment changes.
5 years ago
bunnei
cd4582dc8b
hle: kernel: k_condition_variable: Revert unnecessary style changes.
5 years ago
bunnei
4b2aa52da9
hle: kernel: Remove unnecessary virtual specifier on CancelWait.
5 years ago
bunnei
273223d5f1
hle: kernel: service_thread: Force stop threads on destruction.
5 years ago
bunnei
0231cbd79f
hle: kernel: k_light_lock: Implement CancelWait.
- Fixes a crash in Megadimension Neptunia VII.
5 years ago
bunnei
d17b7268f6
hle: kernel: service_thread: Use std::jthread.
- Fixes a potential deadlock on service thread shutdown.
5 years ago
bunnei
b5970145a5
hle: kernel: k_thread: Skip reschedule on DisableDispatch with SC.
5 years ago
bunnei
6d2bf18df9
hle: kernel: k_thread: Rename sleeping_queue -> wait_queue.
5 years ago