git: 787bf3bcd6ee - main - arm64: Use the new PCB macros in swtch.S
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Mar 2023 15:30:32 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=787bf3bcd6ee0fe36b331b9342a0dd14e915a270 commit 787bf3bcd6ee0fe36b331b9342a0dd14e915a270 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2023-03-22 13:42:00 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2023-03-22 15:08:03 +0000 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 --- sys/arm64/arm64/genassym.c | 1 + 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