mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-22 03:22:39 +02:00
kern: swap tpidr_el1/cntv_cval_el0 as scratch vs exception stack
This commit is contained in:
parent
c39bce4620
commit
e2f21cbd84
@ -232,7 +232,7 @@ namespace ams::kern::arch::arm64::cpu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void SetExceptionThreadStackTop(uintptr_t top) {
|
ALWAYS_INLINE void SetExceptionThreadStackTop(uintptr_t top) {
|
||||||
SetTpidrEl1(top);
|
cpu::SetCntvCvalEl0(top);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE void SwitchThreadLocalRegion(uintptr_t tlr) {
|
ALWAYS_INLINE void SwitchThreadLocalRegion(uintptr_t tlr) {
|
||||||
|
@ -74,6 +74,7 @@ namespace ams::kern::arch::arm64::cpu {
|
|||||||
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntkCtlEl1, cntkctl_el1)
|
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntkCtlEl1, cntkctl_el1)
|
||||||
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntpCtlEl0, cntp_ctl_el0)
|
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntpCtlEl0, cntp_ctl_el0)
|
||||||
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntpCvalEl0, cntp_cval_el0)
|
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntpCvalEl0, cntp_cval_el0)
|
||||||
|
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(CntvCvalEl0, cntv_cval_el0)
|
||||||
|
|
||||||
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(Daif, daif)
|
MESOSPHERE_CPU_DEFINE_SYSREG_ACCESSORS(Daif, daif)
|
||||||
|
|
||||||
|
@ -95,9 +95,10 @@ _ZN3ams4kern5board8nintendo2nx13KSleepManager15CpuSleepHandlerEmm:
|
|||||||
mrs x2, tpidr_el1
|
mrs x2, tpidr_el1
|
||||||
stp x1, x2, [x0], #0x10
|
stp x1, x2, [x0], #0x10
|
||||||
|
|
||||||
/* Save the virtual resumption entrypoint. */
|
/* Save the virtual resumption entrypoint and cntv_cval_el0. */
|
||||||
adr x1, 77f
|
adr x1, 77f
|
||||||
stp x1, xzr, [x0], #0x10
|
mrs x2, cntv_cval_el0
|
||||||
|
stp x1, x2, [x0], #0x10
|
||||||
|
|
||||||
/* Get the current core id. */
|
/* Get the current core id. */
|
||||||
mrs x0, mpidr_el1
|
mrs x0, mpidr_el1
|
||||||
@ -245,12 +246,13 @@ _ZN3ams4kern5board8nintendo2nx13KSleepManager11ResumeEntryEm:
|
|||||||
msr tcr_el1, x1
|
msr tcr_el1, x1
|
||||||
msr mair_el1, x2
|
msr mair_el1, x2
|
||||||
|
|
||||||
/* Get sctlr, tpidr, and the entrypoint. */
|
/* Get sctlr, tpidr, the entrypoint, and cntv_cval_el0. */
|
||||||
ldp x1, x2, [x0], #0x10
|
ldp x1, x2, [x0], #0x10
|
||||||
ldp x3, xzr, [x0], #0x10
|
ldp x3, x4, [x0], #0x10
|
||||||
|
|
||||||
/* Set the global context back into x18/tpidr. */
|
/* Set the global context back into x18/tpidr. */
|
||||||
msr tpidr_el1, x2
|
msr tpidr_el1, x2
|
||||||
|
msr cntv_cval_el0, x4
|
||||||
dsb sy
|
dsb sy
|
||||||
isb
|
isb
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user