diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2023-03-22 13:42:00 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2023-03-22 15:08:03 +0000 |
commit | 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 (patch) | |
tree | 494fd7e8d5c2599de2867ee4b5e0d039434c2d7d | |
parent | 1c33a94ab06bb8274c8a50257a8b94e209a2e2ee (diff) | |
download | src-787bf3bcd6ee0fe36b331b9342a0dd14e915a270.tar.gz src-787bf3bcd6ee0fe36b331b9342a0dd14e915a270.zip |
arm64: Use the new PCB macros in swtch.S
Rather than hard coding the location of these registers in the array
use the new macros to find the correct offset.
Sponsored by: Arm Ltd
-rw-r--r-- | sys/arm64/arm64/genassym.c | 1 | ||||
-rw-r--r-- | sys/arm64/arm64/swtch.S | 48 |
2 files changed, 25 insertions, 24 deletions
diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index e444d0166360..3d88835c0f8e 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -56,6 +56,7 @@ ASSYM(PC_SSBD, offsetof(struct pcpu, pc_ssbd)); ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); +ASSYM(PCB_X19, PCB_X19); ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index e7114746f03b..538235d7b3e8 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -102,12 +102,12 @@ ENTRY(cpu_throw) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] ret END(cpu_throw) @@ -127,12 +127,12 @@ ENTRY(cpu_switch) ldr x4, [x0, #TD_PCB] /* Store the callee-saved registers */ - stp x19, x20, [x4, #PCB_REGS + 19 * 8] - stp x21, x22, [x4, #PCB_REGS + 21 * 8] - stp x23, x24, [x4, #PCB_REGS + 23 * 8] - stp x25, x26, [x4, #PCB_REGS + 25 * 8] - stp x27, x28, [x4, #PCB_REGS + 27 * 8] - stp x29, lr, [x4, #PCB_REGS + 29 * 8] + stp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 @@ -196,12 +196,12 @@ ENTRY(cpu_switch) msr tpidr_el0, x6 ldr x6, [x4, #PCB_TPIDRRO] msr tpidrro_el0, x6 - ldp x19, x20, [x4, #PCB_REGS + 19 * 8] - ldp x21, x22, [x4, #PCB_REGS + 21 * 8] - ldp x23, x24, [x4, #PCB_REGS + 23 * 8] - ldp x25, x26, [x4, #PCB_REGS + 25 * 8] - ldp x27, x28, [x4, #PCB_REGS + 27 * 8] - ldp x29, lr, [x4, #PCB_REGS + 29 * 8] + ldp x19, x20, [x4, #PCB_REGS + (PCB_X19 + 0) * 8] + ldp x21, x22, [x4, #PCB_REGS + (PCB_X19 + 2) * 8] + ldp x23, x24, [x4, #PCB_REGS + (PCB_X19 + 4) * 8] + ldp x25, x26, [x4, #PCB_REGS + (PCB_X19 + 6) * 8] + ldp x27, x28, [x4, #PCB_REGS + (PCB_X19 + 8) * 8] + ldp x29, lr, [x4, #PCB_REGS + (PCB_X19 + 10) * 8] str xzr, [x4, #PCB_REGS + 18 * 8] ret @@ -258,12 +258,12 @@ END(fork_trampoline) ENTRY(savectx) /* Store the callee-saved registers */ - stp x19, x20, [x0, #PCB_REGS + 19 * 8] - stp x21, x22, [x0, #PCB_REGS + 21 * 8] - stp x23, x24, [x0, #PCB_REGS + 23 * 8] - stp x25, x26, [x0, #PCB_REGS + 25 * 8] - stp x27, x28, [x0, #PCB_REGS + 27 * 8] - stp x29, lr, [x0, #PCB_REGS + 29 * 8] + stp x19, x20, [x0, #PCB_REGS + (PCB_X19 + 0) * 8] + stp x21, x22, [x0, #PCB_REGS + (PCB_X19 + 2) * 8] + stp x23, x24, [x0, #PCB_REGS + (PCB_X19 + 4) * 8] + stp x25, x26, [x0, #PCB_REGS + (PCB_X19 + 6) * 8] + stp x27, x28, [x0, #PCB_REGS + (PCB_X19 + 8) * 8] + stp x29, lr, [x0, #PCB_REGS + (PCB_X19 + 10) * 8] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 |