From c7f37f81ee1add28858edc0540e8b8f3311ec094 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 1 Dec 2020 14:09:09 -0800 Subject: [PATCH] kern: fix sleep save/resume for new x18/tpidr scheme --- .../nintendo/nx/kern_k_sleep_manager_asm.s | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libraries/libmesosphere/source/board/nintendo/nx/kern_k_sleep_manager_asm.s b/libraries/libmesosphere/source/board/nintendo/nx/kern_k_sleep_manager_asm.s index 4478b2418..bdc23c714 100644 --- a/libraries/libmesosphere/source/board/nintendo/nx/kern_k_sleep_manager_asm.s +++ b/libraries/libmesosphere/source/board/nintendo/nx/kern_k_sleep_manager_asm.s @@ -29,8 +29,8 @@ .type _ZN3ams4kern5board8nintendo2nx13KSleepManager15CpuSleepHandlerEmm, %function _ZN3ams4kern5board8nintendo2nx13KSleepManager15CpuSleepHandlerEmm: /* Save arguments. */ - mov x17, x0 - mov x18, x1 + mov x16, x0 + mov x17, x1 /* Enable access to FPU registers. */ mrs x1, cpacr_el1 @@ -40,12 +40,13 @@ _ZN3ams4kern5board8nintendo2nx13KSleepManager15CpuSleepHandlerEmm: isb /* Save callee-save registers. */ - stp x19, x20, [x0], #0x10 - stp x21, x22, [x0], #0x10 - stp x23, x24, [x0], #0x10 - stp x25, x26, [x0], #0x10 - stp x27, x28, [x0], #0x10 - stp x29, x30, [x0], #0x10 + stp x18, x19, [x0], #0x10 + stp x20, x21, [x0], #0x10 + stp x22, x23, [x0], #0x10 + stp x24, x25, [x0], #0x10 + stp x26, x27, [x0], #0x10 + stp x28, x29, [x0], #0x10 + stp x30, xzr, [x0], #0x10 /* Save stack pointer. */ mov x1, sp @@ -113,8 +114,8 @@ _ZN3ams4kern5board8nintendo2nx13KSleepManager15CpuSleepHandlerEmm: 1: /* Suspend. */ LOAD_IMMEDIATE_32(x0, 0xC4000001) LOAD_IMMEDIATE_32(x1, 0x0201001B) - mov x2, x18 - mov x3, x17 + mov x2, x17 + mov x3, x16 smc #1 0: b 0b @@ -190,12 +191,13 @@ _ZN3ams4kern5board8nintendo2nx13KSleepManager11ResumeEntryEm: isb /* Restore callee-save registers. */ - ldp x19, x20, [x0], #0x10 - ldp x21, x22, [x0], #0x10 - ldp x23, x24, [x0], #0x10 - ldp x25, x26, [x0], #0x10 - ldp x27, x28, [x0], #0x10 - ldp x29, x30, [x0], #0x10 + ldp x18, x19, [x0], #0x10 + ldp x20, x21, [x0], #0x10 + ldp x22, x23, [x0], #0x10 + ldp x24, x25, [x0], #0x10 + ldp x26, x27, [x0], #0x10 + ldp x28, x29, [x0], #0x10 + ldp x30, xzr, [x0], #0x10 /* Restore stack pointer. */ ldr x1, [x0], #8