CVS commit: [netbsd-5-0] src/sys/arch/amd64/amd64
Module Name:src Committed By: bouyer Date: Fri Jun 15 09:20:48 UTC 2012 Modified Files: src/sys/arch/amd64/amd64 [netbsd-5-0]: trap.c Log Message: Fix build fallout from ticket #1772 for Xen kernels To generate a diff of this commit: cvs rdiff -u -r1.52.6.3 -r1.52.6.4 src/sys/arch/amd64/amd64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/trap.c diff -u src/sys/arch/amd64/amd64/trap.c:1.52.6.3 src/sys/arch/amd64/amd64/trap.c:1.52.6.4 --- src/sys/arch/amd64/amd64/trap.c:1.52.6.3 Tue Jun 12 20:43:59 2012 +++ src/sys/arch/amd64/amd64/trap.c Fri Jun 15 09:20:48 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.52.6.3 2012/06/12 20:43:59 riz Exp $ */ +/* $NetBSD: trap.c,v 1.52.6.4 2012/06/15 09:20:48 bouyer Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.6.3 2012/06/12 20:43:59 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.6.4 2012/06/15 09:20:48 bouyer Exp $); #include opt_ddb.h #include opt_kgdb.h @@ -183,7 +183,9 @@ trap(struct trapframe *frame) #if defined(COMPAT_10) || defined(COMPAT_IBCS2) extern char IDTVEC(oosyscall)[]; #endif +#ifndef XEN struct trapframe *vframe; +#endif void *onfault; int error; uint64_t cr2;
CVS commit: [netbsd-5-0] src/sys/arch/amd64/amd64
Module Name:src Committed By: riz Date: Tue Jun 12 23:17:58 UTC 2012 Modified Files: src/sys/arch/amd64/amd64 [netbsd-5-0]: machdep.c netbsd32_machdep.c Log Message: Pull up following revision(s) (requested by spz in ticket #1773): sys/arch/amd64/amd64/machdep.c: revision 1.184 sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.77 If the user process provided a bogus signal handler address, kill it now instead of trying to jump to the bogus address. To generate a diff of this commit: cvs rdiff -u -r1.102.4.10.2.1 -r1.102.4.10.2.2 \ src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.55.6.2 -r1.55.6.3 \ src/sys/arch/amd64/amd64/netbsd32_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.1 src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.2 --- src/sys/arch/amd64/amd64/machdep.c:1.102.4.10.2.1 Fri Apr 23 04:17:29 2010 +++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:17:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.102.4.10.2.1 2010/04/23 04:17:29 snj Exp $ */ +/* $NetBSD: machdep.c,v 1.102.4.10.2.2 2012/06/12 23:17:57 riz Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008 @@ -112,7 +112,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.10.2.1 2010/04/23 04:17:29 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.10.2.2 2012/06/12 23:17:57 riz Exp $); /* #define XENDEBUG_LOW */ @@ -628,6 +628,16 @@ sendsig(const ksiginfo_t *ksi, const sig /* Remember that we're now on the signal stack. */ if (onstack) l-l_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } void Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.3 --- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.2 Tue Sep 7 19:38:44 2010 +++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:17:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_machdep.c,v 1.55.6.2 2010/09/07 19:38:44 bouyer Exp $ */ +/* $NetBSD: netbsd32_machdep.c,v 1.55.6.3 2012/06/12 23:17:58 riz Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.6.2 2010/09/07 19:38:44 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.6.3 2012/06/12 23:17:58 riz Exp $); #include opt_compat_netbsd.h #include opt_coredump.h @@ -275,6 +275,16 @@ netbsd32_sendsig_sigcontext(const ksigin /* Remember that we're now on the signal stack. */ if (onstack) l-l_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS32) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } #endif @@ -360,6 +370,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_ /* Remember that we're now on the signal stack. */ if (onstack) l-l_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS32) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } void
CVS commit: [netbsd-5-0] src/sys/arch/amd64/amd64
Module Name:src Committed By: snj Date: Thu Apr 22 19:39:45 UTC 2010 Modified Files: src/sys/arch/amd64/amd64 [netbsd-5-0]: locore.S Log Message: Pull up following revision(s) (requested by jym in ticket #1376): sys/arch/amd64/amd64/locore.S: revision 1.56 When kernel remaps to high memory in amd64 locore, the GDT used before becomes invalid. As such, split it in two parts, one for use when system boots in low memory, and one for use when it jumps to high memory. To generate a diff of this commit: cvs rdiff -u -r1.47.8.2 -r1.47.8.2.2.1 src/sys/arch/amd64/amd64/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.47.8.2 src/sys/arch/amd64/amd64/locore.S:1.47.8.2.2.1 --- src/sys/arch/amd64/amd64/locore.S:1.47.8.2 Mon Feb 2 03:24:05 2009 +++ src/sys/arch/amd64/amd64/locore.S Thu Apr 22 19:39:44 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.47.8.2 2009/02/02 03:24:05 snj Exp $ */ +/* $NetBSD: locore.S,v 1.47.8.2.2.1 2010/04/22 19:39:44 snj Exp $ */ /* * Copyright-o-rama! @@ -274,13 +274,25 @@ #define RELOC(x) _RELOC(_C_LABEL(x)) #ifndef XEN - .globl gdt64 + .globl gdt64_lo + .globl gdt64_hi -gdt64: - .word gdt64_end-gdt64_start +#define GDT64_LIMIT gdt64_end-gdt64_start-1 + +/* Temporary gdt64, with base address in low memory */ +gdt64_lo: + .word GDT64_LIMIT .quad _RELOC(gdt64_start) .align 64 +/* Temporary gdt64, with base address in high memory */ +gdt64_hi: + .word GDT64_LIMIT + .quad gdt64_start +.align 64 + +#undef GDT64_LIMIT + gdt64_start: .quad 0x /* always empty */ .quad 0x00af9a00 /* kernel CS */ @@ -643,7 +655,7 @@ * in it to do that. */ - movl $RELOC(gdt64),%eax + movl $RELOC(gdt64_lo),%eax lgdt (%eax) movl $RELOC(farjmp64),%eax ljmp *(%eax) @@ -659,9 +671,17 @@ */ movabsq $longmode_hi,%rax jmp *%rax + longmode_hi: + + /* + * We left the identity mapped area. Base address of + * the temporary gdt64 should now be in high memory. + */ + movq $RELOC(gdt64_hi),%rax + lgdt (%rax) + /* - * We have arrived. * There's no need anymore for the identity mapping in low * memory, remove it. */
CVS commit: [netbsd-5-0] src/sys/arch/amd64/amd64
Module Name:src Committed By: snj Date: Tue Jul 21 00:37:30 UTC 2009 Modified Files: src/sys/arch/amd64/amd64 [netbsd-5-0]: trap.c Log Message: Pull up following revision(s) (requested by rmind in ticket #865): sys/arch/amd64/amd64/trap.c: revisions 1.56, 1.57 handle protection fault properly. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.52.6.1 src/sys/arch/amd64/amd64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/trap.c diff -u src/sys/arch/amd64/amd64/trap.c:1.52 src/sys/arch/amd64/amd64/trap.c:1.52.6.1 --- src/sys/arch/amd64/amd64/trap.c:1.52 Wed Oct 15 06:51:17 2008 +++ src/sys/arch/amd64/amd64/trap.c Tue Jul 21 00:37:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.52 2008/10/15 06:51:17 wrstuden Exp $ */ +/* $NetBSD: trap.c,v 1.52.6.1 2009/07/21 00:37:29 snj Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52 2008/10/15 06:51:17 wrstuden Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.6.1 2009/07/21 00:37:29 snj Exp $); #include opt_ddb.h #include opt_kgdb.h @@ -325,26 +325,35 @@ case T_STKFLT|T_USER: case T_ALIGNFLT|T_USER: #ifdef TRAP_SIGDEBUG - printf(pid %d (%s): BUS (%x) at rip %lx addr %lx\n, + printf(pid %d (%s): BUS/SEGV (%x) at rip %lx addr %lx\n, p-p_pid, p-p_comm, type, frame-tf_rip, rcr2()); frame_dump(frame); #endif KSI_INIT_TRAP(ksi); - ksi.ksi_signo = SIGBUS; ksi.ksi_trap = type ~T_USER; ksi.ksi_addr = (void *)rcr2(); switch (type) { case T_SEGNPFLT|T_USER: case T_STKFLT|T_USER: + ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_ADRERR; break; case T_TSSFLT|T_USER: + ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; break; case T_ALIGNFLT|T_USER: + ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_ADRALN; break; + case T_PROTFLT|T_USER: + ksi.ksi_signo = SIGSEGV; + ksi.ksi_code = SEGV_ACCERR; + break; default: +#ifdef DIAGNOSTIC + panic(unhandled type %x\n, type); +#endif break; } goto trapsignal; @@ -368,6 +377,9 @@ ksi.ksi_code = ILL_COPROC; break; default: +#ifdef DIAGNOSTIC + panic(unhandled type %x\n, type); +#endif break; } goto trapsignal; @@ -414,6 +426,9 @@ ksi.ksi_code = FPE_FLTDIV; break; default: +#ifdef DIAGNOSTIC + panic(unhandled type %x\n, type); +#endif break; } goto trapsignal;