Date: Mon, 25 Jan 2021 14:09:45 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7937837f11b6 - stable/12 - arm64: remove pcb_pc Message-ID: <202101251409.10PE9jr8049935@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7937837f11b648193cb1ad44947eb941b63cc197 commit 7937837f11b648193cb1ad44947eb941b63cc197 Author: mhorne <mhorne@FreeBSD.org> AuthorDate: 2020-12-21 16:16:09 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2021-01-25 13:57:30 +0000 arm64: remove pcb_pc Reviewed by: markj, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 5f66d5a313bf2b2254de92b2915e48e5cf528893) --- sys/arm64/arm64/db_trace.c | 2 +- sys/arm64/arm64/exception.S | 2 +- sys/arm64/arm64/genassym.c | 1 + sys/arm64/arm64/machdep.c | 6 +++--- sys/arm64/arm64/stack_machdep.c | 2 +- sys/arm64/arm64/swtch.S | 8 ++++---- sys/arm64/arm64/vm_machdep.c | 6 +++--- sys/arm64/include/db_machdep.h | 2 +- sys/arm64/include/pcb.h | 6 +++--- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index ee20e9f14f0a..82b6e07fc261 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -111,7 +111,7 @@ db_trace_thread(struct thread *thr, int count) frame.sp = (uint64_t)ctx->pcb_sp; frame.fp = (uint64_t)ctx->pcb_x[29]; - frame.pc = (uint64_t)ctx->pcb_x[30]; + frame.pc = (uintptr_t)ctx->pcb_lr; db_stack_trace_cmd(&frame); } else db_trace_self(); diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index d3242f4ac0b7..19dd9e9d85e2 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); sub sp, sp, #128 .endif sub sp, sp, #(TF_SIZE + 16) - stp x29, x30, [sp, #(TF_SIZE)] + stp x29, lr, [sp, #(TF_SIZE)] stp x28, x29, [sp, #(TF_X + 28 * 8)] stp x26, x27, [sp, #(TF_X + 26 * 8)] stp x24, x25, [sp, #(TF_X + 24 * 8)] diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index debe63c62659..8bd4b791d417 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -49,6 +49,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_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 90a2659d9521..c0df74bd1f6f 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -631,11 +631,11 @@ makectx(struct trapframe *tf, struct pcb *pcb) { int i; - for (i = 0; i < PCB_LR; i++) + for (i = 0; i < nitems(pcb->pcb_x); i++) pcb->pcb_x[i] = tf->tf_x[i]; - pcb->pcb_x[PCB_LR] = tf->tf_lr; - pcb->pcb_pc = tf->tf_elr; + /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */ + pcb->pcb_lr = tf->tf_elr; pcb->pcb_sp = tf->tf_sp; } diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c index 0212c6335a05..feba7e41286d 100644 --- a/sys/arm64/arm64/stack_machdep.c +++ b/sys/arm64/arm64/stack_machdep.c @@ -67,7 +67,7 @@ stack_save_td(struct stack *st, struct thread *td) frame.sp = td->td_pcb->pcb_sp; frame.fp = td->td_pcb->pcb_x[29]; - frame.pc = td->td_pcb->pcb_x[30]; + frame.pc = td->td_pcb->pcb_lr; stack_capture(st, &frame); } diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index d9921f7e9528..bc87114dd0ee 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -101,7 +101,7 @@ ENTRY(cpu_throw) ldp x24, x25, [x4, #PCB_REGS + 24 * 8] ldp x26, x27, [x4, #PCB_REGS + 26 * 8] ldp x28, x29, [x4, #PCB_REGS + 28 * 8] - ldr x30, [x4, #PCB_REGS + 30 * 8] + ldr lr, [x4, #PCB_LR] ret END(cpu_throw) @@ -132,7 +132,7 @@ ENTRY(cpu_switch) stp x24, x25, [x4, #PCB_REGS + 24 * 8] stp x26, x27, [x4, #PCB_REGS + 26 * 8] stp x28, x29, [x4, #PCB_REGS + 28 * 8] - str x30, [x4, #PCB_REGS + 30 * 8] + str lr, [x4, #PCB_LR] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 @@ -198,7 +198,7 @@ ENTRY(cpu_switch) ldp x24, x25, [x4, #PCB_REGS + 24 * 8] ldp x26, x27, [x4, #PCB_REGS + 26 * 8] ldp x28, x29, [x4, #PCB_REGS + 28 * 8] - ldr x30, [x4, #PCB_REGS + 30 * 8] + ldr lr, [x4, #PCB_LR] str xzr, [x4, #PCB_REGS + 18 * 8] ret @@ -270,7 +270,7 @@ ENTRY(savectx) stp x24, x25, [x0, #PCB_REGS + 24 * 8] stp x26, x27, [x0, #PCB_REGS + 26 * 8] stp x28, x29, [x0, #PCB_REGS + 28 * 8] - str x30, [x0, #PCB_REGS + 30 * 8] + str lr, [x0, #PCB_LR] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 8f0dfa1a15e7..1d6ccace82ed 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -104,7 +104,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Set the return value registers for fork() */ td2->td_pcb->pcb_x[8] = (uintptr_t)fork_return; td2->td_pcb->pcb_x[9] = (uintptr_t)td2; - td2->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate; td2->td_pcb->pcb_vfpcpu = UINT_MAX; @@ -175,7 +175,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) td->td_pcb->pcb_x[8] = (uintptr_t)fork_return; td->td_pcb->pcb_x[9] = (uintptr_t)td; - td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; td->td_pcb->pcb_vfpcpu = UINT_MAX; @@ -253,7 +253,7 @@ cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) td->td_pcb->pcb_x[8] = (uintptr_t)func; td->td_pcb->pcb_x[9] = (uintptr_t)arg; - td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; td->td_pcb->pcb_vfpcpu = UINT_MAX; diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index 45d548c750bc..f2fd2a57a9c3 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -43,7 +43,7 @@ typedef vm_offset_t db_addr_t; typedef long db_expr_t; -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_pc) +#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_lr) #define BKPT_INST (0xd4200000) #define BKPT_SIZE (4) diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h index bd8b1b4235a8..cbf43133e9ad 100644 --- a/sys/arm64/include/pcb.h +++ b/sys/arm64/include/pcb.h @@ -35,10 +35,10 @@ struct trapframe; -#define PCB_LR 30 struct pcb { - uint64_t pcb_x[31]; - uint64_t pcb_pc; + uint64_t pcb_x[30]; + uint64_t pcb_lr; + uint64_t _reserved; /* Was pcb_pc */ /* These two need to be in order as we access them together */ uint64_t pcb_sp; uint64_t pcb_tpidr_el0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101251409.10PE9jr8049935>