change the layout in u-area and reduce UPAGES.

This commit is contained in:
yamt 2008-01-08 13:15:01 +00:00
parent 74e0872eca
commit 42f654a26b
4 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.81 2008/01/05 22:48:31 yamt Exp $ */
/* $NetBSD: machdep.c,v 1.82 2008/01/08 13:15:01 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007
@ -120,7 +120,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.81 2008/01/05 22:48:31 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.82 2008/01/08 13:15:01 yamt Exp $");
/* #define XENDEBUG_LOW */
@ -432,7 +432,7 @@ x86_64_proc0_tss_ldt_init(void)
pcb->pcb_flags = 0;
pcb->pcb_fs = 0;
pcb->pcb_gs = 0;
pcb->pcb_rsp0 = (u_int64_t)l->l_addr + USPACE - 16;
pcb->pcb_rsp0 = (USER_TO_UAREA(l->l_addr) + KSTACK_SIZE - 16) & ~0xf;
pcb->pcb_iopl = SEL_KPL;
pcb->pcb_ldt_sel = pmap_kernel()->pm_ldt_sel =

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.28 2008/01/05 21:47:19 yamt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.29 2008/01/08 13:15:01 yamt 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.28 2008/01/05 21:47:19 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.29 2008/01/08 13:15:01 yamt Exp $");
#include "opt_coredump.h"
#include "opt_user_ldt.h"
@ -175,7 +175,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
*/
l2->l_md.md_astpending = 0;
pcb->pcb_rsp0 = (u_int64_t)l2->l_addr + USPACE - 16;
pcb->pcb_rsp0 = (USER_TO_UAREA(l2->l_addr) + KSTACK_SIZE - 16) & ~0xf;
/*
* Copy the trapframe.
@ -303,8 +303,10 @@ cpu_coredump(struct lwp *l, void *iocookie, struct core *chdr)
static void
setredzone(struct lwp *l)
{
pmap_remove(pmap_kernel(), (vaddr_t)l->l_addr + PAGE_SIZE,
(vaddr_t)l->l_addr + 2 * PAGE_SIZE);
vaddr_t addr;
addr = USER_TO_UAREA(l->l_addr);
pmap_remove(pmap_kernel(), addr, addr + PAGE_SIZE);
pmap_update(pmap_kernel());
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.7 2008/01/05 21:47:19 yamt Exp $ */
/* $NetBSD: param.h,v 1.8 2008/01/08 13:15:02 yamt Exp $ */
#ifdef _KERNEL
#include <machine/cpu.h>
@ -56,7 +56,7 @@
#define SSIZE 1 /* initial stack size/NBPG */
#define SINCR 1 /* increment of stack/NBPG */
#define UPAGES 5 /* pages of u-area */
#define UPAGES 3 /* pages of u-area */
#define USPACE (UPAGES * NBPG) /* total size of u-area */
#define INTRSTACKSIZE 4096

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.8 2008/01/05 21:47:20 yamt Exp $ */
/* $NetBSD: proc.h,v 1.9 2008/01/08 13:15:02 yamt Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
@ -34,6 +34,7 @@
#ifndef _AMD64_PROC_H
#define _AMD64_PROC_H
#include <sys/user.h> /* for sizeof(struct user) */
#include <machine/frame.h>
/*
@ -58,4 +59,8 @@ struct mdproc {
#define MDP_USEDMTRR 0x0008 /* has set volatile MTRRs */
#define MDP_IRET 0x0010 /* return via iret, not sysret */
#define UAREA_USER_OFFSET (USPACE - ALIGN(sizeof(struct user)))
#define KSTACK_LOWEST_ADDR(l) ((void *)USER_TO_UAREA((l)->l_addr))
#define KSTACK_SIZE UAREA_USER_OFFSET
#endif /* _AMD64_PROC_H */