Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86_64/x86_64 For 32bit execs, frob the stackframe ...



details:   https://anonhg.NetBSD.org/src/rev/6b22df911efb
branches:  trunk
changeset: 532268:6b22df911efb
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Jun 04 11:14:21 2002 +0000

description:
For 32bit execs, frob the stackframe to return via the old system call
return path.

diffstat:

 sys/arch/x86_64/x86_64/netbsd32_machdep.c |  9 ++++++++-
 sys/arch/x86_64/x86_64/vector.S           |  4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r 086bd9b94c59 -r 6b22df911efb sys/arch/x86_64/x86_64/netbsd32_machdep.c
--- a/sys/arch/x86_64/x86_64/netbsd32_machdep.c Tue Jun 04 11:12:18 2002 +0000
+++ b/sys/arch/x86_64/x86_64/netbsd32_machdep.c Tue Jun 04 11:14:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.4 2002/06/03 18:23:17 fvdl Exp $        */
+/*     $NetBSD: netbsd32_machdep.c,v 1.5 2002/06/04 11:14:22 fvdl Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -62,11 +62,14 @@
 int process_read_fpregs32(struct proc *, struct fpreg32 *);
 int process_read_regs32(struct proc *, struct reg32 *);
 
+extern void (osyscall_return) __P((void));
+
 void
 netbsd32_setregs(struct proc *p, struct exec_package *pack, u_long stack)
 {
        struct pcb *pcb = &p->p_addr->u_pcb;
        struct trapframe *tf;
+       void **retaddr;
 
        /* If we were using the FPU, forget about it. */
        if (fpuproc == p)
@@ -112,6 +115,10 @@
        tf->tf_rflags = PSL_USERSET;
        tf->tf_rsp = stack;
        tf->tf_ss = LSEL(LUDATA32_SEL, SEL_UPL);
+
+       /* XXX frob return address to return via old iret method, not sysret */
+       retaddr = (void **)tf - 1;
+       *retaddr = (void *)osyscall_return;
 }
 
 void
diff -r 086bd9b94c59 -r 6b22df911efb sys/arch/x86_64/x86_64/vector.S
--- a/sys/arch/x86_64/x86_64/vector.S   Tue Jun 04 11:12:18 2002 +0000
+++ b/sys/arch/x86_64/x86_64/vector.S   Tue Jun 04 11:14:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vector.S,v 1.4 2002/06/03 18:23:17 fvdl Exp $  */
+/*     $NetBSD: vector.S,v 1.5 2002/06/04 11:14:21 fvdl Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -330,6 +330,7 @@
 #endif /* DIAGNOSTIC */
        movq    %rsp,P_MD_REGS(%rdx)    # save pointer to frame
        call    *P_MD_SYSCALL(%rdx)
+_C_LABEL(osyscall_return):
 2:     /* Check for ASTs on exit to user mode. */
        cli
        cmpb    $0,_C_LABEL(astpending)(%rip)
@@ -415,6 +416,7 @@
  */
 
        .globl  _C_LABEL(isa_strayintr)
+       .globl  _C_LABEL(osyscall_return)
 
 /*
  * Normal vectors.



Home | Main Index | Thread Index | Old Index