diff options
| author | fvdl <fvdl@NetBSD.org> | 2005-05-22 14:52:12 +0000 |
|---|---|---|
| committer | fvdl <fvdl@NetBSD.org> | 2005-05-22 14:52:12 +0000 |
| commit | beae305307253d319bb2c33712f29c80a11ea5e3 (patch) | |
| tree | 40a80c6a37b889bccefb45bcbe50812728426cda /sys/compat/linux | |
| parent | 1bd2839e9ad0c09748950a07f9361935c5874c83 (diff) | |
Use a modified buildcontext function for Linux signals. It doesn't set
the unused segment registers, it just uses the already used values.
Diffstat (limited to 'sys/compat/linux')
| -rw-r--r-- | sys/compat/linux/arch/amd64/linux_machdep.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/compat/linux/arch/amd64/linux_machdep.c b/sys/compat/linux/arch/amd64/linux_machdep.c index 5347b70e2af..5bd30249b00 100644 --- a/sys/compat/linux/arch/amd64/linux_machdep.c +++ b/sys/compat/linux/arch/amd64/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.4 2005/05/20 12:48:27 fvdl Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.5 2005/05/22 14:52:12 fvdl Exp $ */ /*- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.4 2005/05/20 12:48:27 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.5 2005/05/22 14:52:12 fvdl Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -61,6 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.4 2005/05/20 12:48:27 fvdl Exp $ #include <compat/linux/linux_syscall.h> #include <compat/linux/linux_syscallargs.h> +static void linux_buildcontext(struct lwp *, void *, void *); + void linux_setregs(l, epp, stack) struct lwp *l; @@ -280,7 +282,7 @@ linux_sendsig(ksi, mask) * when the signal handler is called. The +24 below is a dirty * workaround, and the real problem should be fixed. */ - buildcontext(l, catcher, sp + 24); + linux_buildcontext(l, catcher, sp + 24); tf->tf_rdi = sigframe.info.lsi_signo; tf->tf_rax = 0; tf->tf_rsi = (long)&sfp->info; @@ -582,3 +584,16 @@ linux_usertrap(struct lwp *l, vaddr_t trapaddr, void *arg) return 1; } + +static void +linux_buildcontext(struct lwp *l, void *catcher, void *f) +{ + struct trapframe *tf = l->l_md.md_regs; + + tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); + tf->tf_rip = (u_int64_t)catcher; + tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); + tf->tf_rflags &= ~(PSL_T|PSL_VM|PSL_AC); + tf->tf_rsp = (u_int64_t)f; + tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); +} |
