From owner-dev-commits-src-all@freebsd.org Mon Jan 25 14:09:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C90F4E32F5; Mon, 25 Jan 2021 14:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DPWvs353nz4SrJ; Mon, 25 Jan 2021 14:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D06717C32; Mon, 25 Jan 2021 14:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10PE9jWC049936; Mon, 25 Jan 2021 14:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10PE9jr8049935; Mon, 25 Jan 2021 14:09:45 GMT (envelope-from git) Date: Mon, 25 Jan 2021 14:09:45 GMT Message-Id: <202101251409.10PE9jr8049935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 7937837f11b6 - stable/12 - arm64: remove pcb_pc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7937837f11b648193cb1ad44947eb941b63cc197 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 14:09:45 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7937837f11b648193cb1ad44947eb941b63cc197 commit 7937837f11b648193cb1ad44947eb941b63cc197 Author: mhorne AuthorDate: 2020-12-21 16:16:09 +0000 Commit: Mitchell Horne 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;