From bd1b8e692a23ea692c738ccd62abebcd4515db2c Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 25 Oct 2022 06:05:57 +0000 Subject: [PATCH] STACK_OFFSET was to support it varying when compiling some code for either 32bit or 64bit. With the elimination of 32bit sparc bits it was just a superfluous indirection of BIAS. Also, CCFSZ is gone. ok miod@ --- sys/arch/sparc64/include/asm.h | 4 ++-- sys/arch/sparc64/sparc64/machdep.c | 11 ++++------- sys/arch/sparc64/sparc64/vm_machdep.c | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/arch/sparc64/include/asm.h b/sys/arch/sparc64/include/asm.h index 2d8ffffc7b2..a9d327e0ba8 100644 --- a/sys/arch/sparc64/include/asm.h +++ b/sys/arch/sparc64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.15 2022/08/30 16:26:29 miod Exp $ */ +/* $OpenBSD: asm.h,v 1.16 2022/10/25 06:05:57 guenther Exp $ */ /* $NetBSD: asm.h,v 1.15 2000/08/02 22:24:39 eeh Exp $ */ /* @@ -41,7 +41,7 @@ #ifndef _MACHINE_ASM_H_ #define _MACHINE_ASM_H_ -/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */ +/* Pull in CC64FSZ and BIAS from frame.h */ #ifndef _LOCORE #define _LOCORE #endif diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 86dd016421f..d9e8311c7c2 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.203 2022/10/23 23:39:41 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.204 2022/10/25 06:05:57 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -255,10 +255,7 @@ cpu_startup(void) * Set up registers on exec. */ -#define STACK_OFFSET BIAS #define CPOUTREG(l,v) copyout(&(v), (l), sizeof(v)) -#undef CCFSZ -#define CCFSZ CC64FSZ /* ARGSUSED */ void @@ -333,7 +330,7 @@ setregs(struct proc *p, struct exec_package *pack, vaddr_t stack, tf->tf_npc = tf->tf_pc + 4; tf->tf_global[2] = tf->tf_pc; stack -= sizeof(struct rwindow); - tf->tf_out[6] = stack - STACK_OFFSET; + tf->tf_out[6] = stack - BIAS; #ifdef NOTDEF_DEBUG printf("setregs: setting tf %p sp %p pc %p\n", (long)tf, (long)tf->tf_out[6], (long)tf->tf_pc); @@ -410,7 +407,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip, struct sigframe sf; tf = p->p_md.md_tf; - oldsp = tf->tf_out[6] + STACK_OFFSET; + oldsp = tf->tf_out[6] + BIAS; /* * Compute new user stack addresses, subtract off @@ -485,7 +482,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip, tf->tf_global[1] = (vaddr_t)catcher; tf->tf_pc = addr; tf->tf_npc = addr + 4; - tf->tf_out[6] = newsp - STACK_OFFSET; + tf->tf_out[6] = newsp - BIAS; return 0; } diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c index e6e653d1c7e..4a7ecb9a2fc 100644 --- a/sys/arch/sparc64/sparc64/vm_machdep.c +++ b/sys/arch/sparc64/sparc64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.41 2022/10/21 18:55:42 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.42 2022/10/25 06:05:57 guenther Exp $ */ /* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */ /* @@ -72,7 +72,6 @@ * The offset of the topmost frame in the kernel stack. */ #define TOPFRAMEOFF (USPACE-sizeof(struct trapframe)-CC64FSZ) -#define STACK_OFFSET BIAS #ifdef DEBUG char cpu_forkname[] = "cpu_fork()"; @@ -176,7 +175,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, rp->rw_local[1] = (long)arg; /* and its argument */ npcb->pcb_pc = (long)proc_trampoline - 8; - npcb->pcb_sp = (long)rp - STACK_OFFSET; + npcb->pcb_sp = (long)rp - BIAS; /* Need to create a %tstate if we're forking from proc0. */ if (p1 == &proc0) -- 2.20.1