- Kill NOREDZONE.

- Make the redzone conditional on DIAGNOSTIC.
- Give amd64 an additional page for the uarea. 2 is not enough.
This commit is contained in:
ad 2008-12-20 12:41:19 +00:00
parent ae6c4143ce
commit 5e34fbf90e
8 changed files with 25 additions and 35 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.36 2008/12/18 11:45:40 cegger Exp $ */
/* $NetBSD: vm_machdep.c,v 1.37 2008/12/20 12:42:36 ad Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.36 2008/12/18 11:45:40 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.37 2008/12/20 12:42:36 ad Exp $");
#include "opt_user_ldt.h"
@ -257,11 +257,13 @@ cpu_lwp_free2(struct lwp *l)
static void
setredzone(struct lwp *l)
{
#ifdef DIAGNOSTIC
vaddr_t addr;
addr = USER_TO_UAREA(l->l_addr);
pmap_remove(pmap_kernel(), addr, addr + PAGE_SIZE);
pmap_update(pmap_kernel());
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.9 2008/10/26 00:08:15 mrg Exp $ */
/* $NetBSD: param.h,v 1.10 2008/12/20 12:42:36 ad Exp $ */
#ifdef __x86_64__
@ -58,7 +58,11 @@
#define SSIZE 1 /* initial stack size/NBPG */
#define SINCR 1 /* increment of stack/NBPG */
#ifdef DIAGNOSTIC
#define UPAGES 4 /* pages of u-area (1 for redzone) */
#else
#define UPAGES 3 /* pages of u-area */
#endif
#define USPACE (UPAGES * NBPG) /* total size of u-area */
#define INTRSTACKSIZE 4096

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC_TINY,v 1.115 2008/11/12 12:36:01 ad Exp $
# $NetBSD: GENERIC_TINY,v 1.116 2008/12/20 12:41:19 ad Exp $
#
# GENERIC_TINY -- suitable default for 4M machines
# No EISA, PCI, or SCSI.
@ -28,9 +28,6 @@ maxusers 8 # estimated number of users
#options REALBASEMEM=... # size of base memory
#options REALEXTMEM=... # size of extended memory
# Save a physical page per process by not setting a kernel stack red zone.
options NOREDZONE
# Standard system options
options INSECURE # disable kernel security levels - X needs this

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL_TINY,v 1.121 2008/11/12 12:36:02 ad Exp $
# $NetBSD: INSTALL_TINY,v 1.122 2008/12/20 12:41:19 ad Exp $
#
# This kernel should be derived from INSTALL (which is derived
# from GENERIC) with some features commented out.
@ -30,9 +30,6 @@ maxusers 2 # estimated number of users
# I/O address.
#options CONSDEVNAME="\"com\"",CONADDR=0x3f8,CONSPEED=9600
# Save a physical page per process by not setting a kernel stack red zone.
options NOREDZONE
# The following options override the memory sizes passed in from the boot
# block. Use them *only* if the boot block is unable to determine the correct
# values. Note that the BIOS may *correctly* report less than 640k of base

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i386,v 1.340 2008/11/20 10:53:08 ad Exp $
# $NetBSD: files.i386,v 1.341 2008/12/20 12:41:19 ad Exp $
#
# new style config file for i386 architecture
#
@ -44,9 +44,6 @@ defflag opt_pcibios.h PCIBIOS PCIBIOSVERBOSE
PCIBIOS_INTR_GUESS PCIINTR_DEBUG
defparam opt_pcibios.h PCIBIOS_IRQS_HINT
# No unmapped page below kernel stack
defflag NOREDZONE
# kernel stack debug
defflag opt_kstack_dr0.h KSTACK_CHECK_DR0

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.141 2008/11/19 18:35:59 ad Exp $ */
/* $NetBSD: vm_machdep.c,v 1.142 2008/12/20 12:41:19 ad Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.141 2008/11/19 18:35:59 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.142 2008/12/20 12:41:19 ad Exp $");
#include "opt_user_ldt.h"
#include "opt_mtrr.h"
@ -108,9 +108,7 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.141 2008/11/19 18:35:59 ad Exp $");
#include "npx.h"
#ifndef NOREDZONE
static void setredzone(struct lwp *l);
#endif
void
cpu_proc_fork(struct proc *p1, struct proc *p2)
@ -186,9 +184,8 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
*tf = *l1->l_md.md_regs;
tf->tf_trapno = T_ASTFLT;
#ifndef NOREDZONE
setredzone(l2);
#endif
/*
* If specified, give the child a different stack.
*/
@ -215,9 +212,8 @@ cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
void
cpu_swapin(struct lwp *l)
{
#ifndef NOREDZONE
setredzone(l);
#endif
}
void
@ -264,20 +260,20 @@ cpu_lwp_free2(struct lwp *l)
/* nothing */
}
#ifndef NOREDZONE
/*
* Set a red zone in the kernel stack after the u. area.
*/
static void
setredzone(struct lwp *l)
{
#ifdef DIAGNOSTIC
vaddr_t addr;
addr = USER_TO_UAREA(l->l_addr);
pmap_remove(pmap_kernel(), addr, addr + PAGE_SIZE);
pmap_update(pmap_kernel());
#endif /* DIAGNOSTIC */
}
#endif
/*
* Convert kernel VA to physical address

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.67 2007/10/18 15:28:37 yamt Exp $ */
/* $NetBSD: param.h,v 1.68 2008/12/20 12:41:19 ad Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -101,11 +101,11 @@
#include "opt_noredzone.h"
#endif
#ifndef UPAGES
#ifdef NOREDZONE
#define UPAGES 2 /* pages of u-area */
#else
#define UPAGES 3
#endif /*NOREDZONE */
# ifdef DIAGNOSTIC
# define UPAGES 3 /* 2 + 1 page for redzone */
# else
# define UPAGES 2 /* normal pages of u-area */
# endif /* DIAGNOSTIC */
#endif /* !defined(UPAGES) */
#define USPACE (UPAGES * NBPG) /* total size of u-area */
#define INTRSTACKSIZE 8192

View File

@ -1,4 +1,4 @@
# $NetBSD: files.xen,v 1.90 2008/11/20 10:53:09 ad Exp $
# $NetBSD: files.xen,v 1.91 2008/12/20 12:41:19 ad Exp $
# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp
# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp
@ -16,9 +16,6 @@ defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
# delay before cpu_reset() for reboot.
defparam CPURESET_DELAY
# No unmapped page below kernel stack
defflag NOREDZONE
# Beep on halt
defflag opt_beep.h BEEP_ONHALT
defparam opt_beep.h BEEP_ONHALT_COUNT=3