Commit graph

5660 commits

Author SHA1 Message Date
bunnei
264bb5abf7 core: hle: kernel: KPageTable: Operate: Assert lock ownership. 2022-01-22 01:33:26 -08:00
bunnei
0137f2e6e1 core: hle: kernel: KPageTable: SetHeapSize: Cleanup & take physical memory lock. 2022-01-22 01:33:26 -08:00
bunnei
6d8e498f76 core: hle: kernel: Refactor Un/MapPhysicalMemory to remove unnecessary methods. 2022-01-22 01:33:26 -08:00
bunnei
b8b1b58f36 core: hle: kernel: Rename Un/Map to Un/MapMeory. 2022-01-22 01:33:26 -08:00
bunnei
68c8a1b170
Merge pull request #7737 from bunnei/fix-dummy-thread-leak
Various fixes to HLE service thread management
2022-01-21 22:34:47 -08:00
bunnei
cef7649bed
Merge pull request #7752 from Morph1984/SetCpuOverclockEnabled
service: apm: Stub ISession SetCpuOverclockEnabled
2022-01-21 17:13:52 -08:00
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.
2022-01-21 17:12:06 -08:00
Lioncash
12bf8ca929 service/wlan: Update function tables 2022-01-21 16:35:51 -05:00
Lioncash
8dd6dc9a29 service/usb: Update function tables 2022-01-21 16:31:57 -05:00
Lioncash
43039d95ac service/set: Update function tables 2022-01-21 16:26:12 -05:00
Lioncash
7ba6f68a8d service/ns: Update function tables 2022-01-21 16:21:35 -05:00
Lioncash
19c11e2fd2 service/nim: Update unknown function table entries 2022-01-21 16:17:40 -05:00
Lioncash
888bc10c17 service/friend: Update unknown function table entries 2022-01-21 16:08:46 -05:00
Lioncash
54150f5afa service/filsystem: Update fsp-srv function table 2022-01-21 16:07:01 -05:00
Lioncash
3da43ad2a9 service/btm: Update function tables 2022-01-21 15:59:41 -05:00
Lioncash
0f7337c522 service/audio: Update audctl unknown function names 2022-01-21 15:50:38 -05:00
Lioncash
29e3636e0a service/am: Update omm function tables 2022-01-21 15:40:08 -05:00
Lioncash
a271cf89cf service/acc: Update unknown function names
Switchbrew has the function names now.
2022-01-21 15:33:22 -05:00
Morph
a396473201 service: apm: Stub ISession SetCpuOverclockEnabled
Since we don't currently support CPU overclocking within the emulated system, this can be stubbed for now, like APM IsCpuOverclockEnabled.

- Used by Gravity Rider Zero
2022-01-20 21:07:26 -05:00
bunnei
f6815086a1 hle: kernel: Remove redundant tracking of dummy threads.
- These are already tracked by kernel's registered_objects member.
2022-01-20 17:08:00 -08:00
bunnei
91ff6d4cb3 hle: kernel: KThread: DummyThread can be waited, ensure wait_queue is not nullptr. 2022-01-20 17:08:00 -08:00
bunnei
46a620f9d7 hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled. 2022-01-20 17:08:00 -08:00
bunnei
0b37e7cb39 hle: kernel: service_thread: Ensure dummy thread is closed & destroyed on thread exit. 2022-01-20 17:08:00 -08:00
bunnei
384e24d3e9 hle: kernel: KServerSession: Remove hack for CompleteSyncRequest.
- This does not appear to be necessary anymore.
2022-01-20 17:08:00 -08:00
bunnei
ad53dc22fd 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.
2022-01-20 17:08:00 -08:00
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.
2022-01-20 17:08:00 -08:00
bunnei
11a380c3da hle: kernel: KScheduler: Ensure dummy threads are never scheduled.
- These are only used by host threads for locking.
2022-01-20 17:08:00 -08:00
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.
2022-01-20 17:08:00 -08:00
Morph
dc471700ca
Merge pull request #7726 from german77/clamp
service/hid: Initialize applet_resource on SetNpadAnalogStickUseCenterClamp
2022-01-19 14:31:15 -08:00
german77
8fa0416fee service/hid: Initialize applet_resource on SetNpadAnalogStickUseCenterClamp 2022-01-19 14:20:31 -06:00
bunnei
b5e83bcc7b
Merge pull request #7701 from bunnei/clear-mem-pages
Kernel Memory Updates (Part 3): Clear KMemoryManager pages & other fixes
2022-01-18 21:20:42 -08:00
bunnei
101d86897b
Merge pull request #7712 from bunnei/fix-thread-exit
Accurately implement thread exit
2022-01-17 18:08:24 -08:00
Valeri
84786dde00
hle: remove no-op code
Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there.
2022-01-17 13:51:12 +03:00
bunnei
5eda606952
Merge pull request #7711 from bunnei/fix-service-thread-race-v2
hle: kernel: Fix service_threads access to be thread safe V2.
2022-01-14 22:22:39 -08:00
bunnei
b54cbc985e hle: kernel: k_memory_manager: Clear pages on allocation & free.
- Heap pages should be zero'd.
- Also explicitly passed along heap allocation option.
2022-01-14 21:16:33 -08:00
bunnei
4064e03568
Merge pull request #7707 from german77/slow-update
service/hid: Decrease motion update rate
2022-01-14 17:13:30 -08:00
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.
2022-01-14 16:44:14 -08:00
bunnei
d8b3f665db core: hle: kernel: KProcess: Integrate with KWorkerTask and add unimplemented DoWorkerTaskImpl. 2022-01-14 16:44:14 -08:00
bunnei
03884b7ea6 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
c905044e1b core: hle: kernel: Instantiate a kernel instance of KWorkerTaskManager. 2022-01-14 16:44:14 -08:00
bunnei
bf32fcc817 core: hle: kernel: Add KWorkerTask and KWorkerTaskManager.
- These primitives are used to dispatch asynchronous kernel tasks from KThread and KProcess.
2022-01-14 16:43:59 -08:00
bunnei
cc112f971e 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.
2022-01-14 16:02:57 -08:00
Mai M
b2d45a4072
Merge pull request #7699 from bunnei/fix-service-thread-race
hle: kernel: Fix service_threads access to be thread safe.
2022-01-14 00:46:16 -05:00
bunnei
2147240e47 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.
2022-01-13 21:26:10 -08:00
Narr the Reg
8185509683
service/hid: Decrease motion update rate
Motion stops working in Mario Tennis in swing mode if the update rate is too fast even when HW it updates at the same speed. 10ms it's the minimum period that the game needs to start working again.
2022-01-12 22:55:33 -06:00
bunnei
49a0e4330e hle: kernel: k_page_table: Update SetProcessMemoryPermission. 2022-01-11 16:28:11 -08:00
bunnei
6ac44f3bdc hle: service: ldr: UnmapCodeMemory BSS only when set. 2022-01-11 16:28:11 -08:00
bunnei
6123b6ea45 hle: kernel: k_page_table: ReadAndWrite -> UserReadWrite. 2022-01-11 16:28:11 -08:00
bunnei
081669c334 hle: kernel: k_page_table: Rename *ProcessCodeMemory -> *CodeMemory. 2022-01-11 16:28:11 -08:00
bunnei
af4696657c core: hle: kernel: svc: Updates to SetMemoryAttribute and SetMemoryPermission. 2022-01-08 12:18:14 -08:00