mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-10-04 07:08:51 +00:00
kern: SvcUnmapPhysicalMemory, cleanup thread pinning
This commit is contained in:
parent
5018d5604b
commit
6f72ac6dd0
10 changed files with 248 additions and 24 deletions
|
@ -145,15 +145,15 @@ namespace ams::kern::arch::arm64 {
|
|||
{
|
||||
const bool is_user_mode = (context->psr & 0xF) == 0;
|
||||
if (is_user_mode) {
|
||||
/* Handle any changes needed to the user preemption state. */
|
||||
if (GetCurrentThread().GetUserPreemptionState() != 0 && GetCurrentProcess().GetPreemptionStatePinnedThread(GetCurrentCoreId()) == nullptr) {
|
||||
/* If the user disable count is set, we may need to pin the current thread. */
|
||||
if (GetCurrentThread().GetUserDisableCount() != 0 && GetCurrentProcess().GetPinnedThread(GetCurrentCoreId()) == nullptr) {
|
||||
KScopedSchedulerLock lk;
|
||||
|
||||
/* Note the preemption state in process. */
|
||||
GetCurrentProcess().SetPreemptionState();
|
||||
/* Pin the current thread. */
|
||||
GetCurrentProcess().PinCurrentThread();
|
||||
|
||||
/* Set the kernel preemption state flag. */
|
||||
GetCurrentThread().SetKernelPreemptionState(1);
|
||||
/* Set the interrupt flag for the thread. */
|
||||
GetCurrentThread().SetInterruptFlag();
|
||||
}
|
||||
|
||||
/* Enable interrupts while we process the usermode exception. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue