Integration of many changes from Matthias Pfaller plus some of mine.

Several had:  _MACHINE_ICU_H_ -> _NS32K_ICU_H_

cpu.h		* Removed definition of cpu_swapout.
		* Added definition of cpu_wait.

frame.h		* added struct switchframe

icu.h		* tweeked ints_off

param.h		* More derived constants.
		* Alot of things taken over from i386/include/param.h.

pcb.h		* Removed pcb_flags (was unused) and pcb_pl.
		  The current priority level is now stored
		  in the switch frame by cpu_switch.

pmap.h		* Taken over from i386/include/pmap.h.

psl.h		* Add USERMODE definition

trap.h		* T_INTERRUPT -> T_AST

types.h		* Remove __FORK_BRAINDAMAGE

vmparam.h	* Taken over from i386/include/vmparam.h.
		  Added definition of INTSTACK.
This commit is contained in:
phil 1996-02-01 00:03:25 +00:00
parent 429c5e2f3b
commit 63d5234cbf
10 changed files with 176 additions and 292 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.12 1995/06/28 02:55:56 cgd Exp $ */
/* $NetBSD: cpu.h,v 1.13 1996/02/01 00:03:25 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -38,8 +38,9 @@
* @(#)cpu.h 5.4 (Berkeley) 5/9/91
*/
#ifndef _MACHINE_CPU_H_
#define _MACHINE_CPU_H_
#ifndef _NS532_CPU_H_
#define _NS532_CPU_H_
/*
* Definitions unique to ns532 cpu support.
*
@ -54,8 +55,7 @@
* referenced in generic code
*/
#define cpu_swapin(p) /* nothing */
#define cpu_set_init_frame(p,fp) (p)->p_md.md_regs = fp
#define cpu_swapout(p) panic("cpu_swapout: can't get here");
#define cpu_wait(p) /* nothing */
/* XXX needed? PAN
* function vs. inline configuration;
@ -75,15 +75,11 @@
#define clockframe intrframe
#define CLKF_USERMODE(framep) ((framep)->if_psr & PSR_USR)
#define CLKF_USERMODE(framep) USERMODE((framep)->if_psr)
#define CLKF_BASEPRI(framep) ((framep)->if_pl == imask[IPL_ZERO])
#define CLKF_PC(framep) ((framep)->if_pc)
#define CLKF_INTR(frame) (0) /* XXX should have an interrupt stack */
#ifdef _KERNEL
#include <machine/icu.h>
#endif
/*
* Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode.
@ -96,7 +92,6 @@ int want_resched; /* resched() was called */
* interrupt. On the pc532, request an ast to send us through trap(),
* marking the proc as needing a profiling tick.
*/
#define profile_tick(p, framep) ((p)->p_flag |= P_OWEUPC, setsoftast())
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
/*
@ -105,6 +100,11 @@ int want_resched; /* resched() was called */
*/
#define signotify(p) setsoftast()
/*
* We need a machine-independent name for this.
*/
#define DELAY(n) { volatile int N = (n); while (--N > 0); }
/*
* CTL_MACHDEP definitions.
*/
@ -116,4 +116,4 @@ int want_resched; /* resched() was called */
{ "console_device", CTLTYPE_STRUCT }, \
}
#endif
#endif /* !_NS532_CPU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: frame.h,v 1.4 1994/10/26 08:24:28 cgd Exp $ */
/* $NetBSD: frame.h,v 1.5 1996/02/01 00:03:27 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -96,6 +96,16 @@ struct syscframe {
u_short sf_psr;
};
/*
* Stack frame inside cpu_switch()
*/
struct switchframe {
long sf_pl;
long sf_reg[5];
long sf_fp;
int sf_pc;
};
/*
* Signal frame
*/
@ -105,6 +115,6 @@ struct sigframe {
struct sigcontext *sf_scp;
sig_t sf_handler;
struct sigcontext sf_sc;
} ;
};
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: icu.h,v 1.5 1995/08/25 07:52:18 phil Exp $ */
/* $NetBSD: icu.h,v 1.6 1996/02/01 00:03:29 phil Exp $ */
/*
* Copyright (c) 1993 Philip A. Nelson.
@ -35,8 +35,8 @@
/* icu.h: defines for use with the ns32532 icu. */
#ifndef _MACHINE_ICU_H_
#define _MACHINE_ICU_H_
#ifndef _NS532_ICU_H_
#define _NS532_ICU_H_
/* We don't use vector interrupts, but make it right anyway */
#define VEC_ICU 0x10
@ -106,8 +106,8 @@ enum {HIGH_LEVEL, LOW_LEVEL, RISING_EDGE, FALLING_EDGE} int_modes;
#define IEDGE 0
#define IPOLARITY 0
#define ints_off bicpsrw PSR_I
#define ints_on bispsrw PSR_I
#define ints_off bicpsrw PSL_I ; nop
#define ints_on bispsrw PSL_I
/* SCSI controllers */
#define AIC6250 0
@ -131,4 +131,4 @@ scsi_select_ctlr(int ctlr)
return(old);
}
#endif /* !LOCORE */
#endif /* _MACHINE_ICU_H_ */
#endif /* _NS532_ICU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.12 1995/06/26 06:56:05 cgd Exp $ */
/* $NetBSD: param.h,v 1.13 1996/02/01 00:03:30 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -64,32 +64,27 @@
#define ALIGNBYTES (sizeof(int) - 1)
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#define NBPG 4096 /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */
#define NPTEPG (NBPG/(sizeof (struct pte)))
#define NBPDR (1024*NBPG) /* bytes/page dir */
#define PDROFSET (NBPDR-1) /* byte offset into page dir */
#define PDRSHIFT 22 /* LOG2(NBPDR) */
#define NBPG (1 << PGSHIFT) /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
#define KERNBASE 0xFE000000 /* start of kernel virtual */
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define DEV_BSIZE (1 << DEV_BSHIFT)
#define BLKDEV_IOSIZE 4096 /* Was 2048 (pan) */
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
#define CLSIZE 1
#define CLSIZELOG2 0
#define CLSIZE (1 << CLSIZELOG2)
/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
#define SSIZE 1 /* initial stack size/NBPG */
#define SINCR 1 /* increment of stack/NBPG */
#define UPAGES 2 /* pages of u-area */
#define USPACE (UPAGES * NBPG)
#define USPACE (UPAGES * NBPG) /* total size of u-area */
/*
* Constants related to network buffer management.
@ -109,14 +104,18 @@
#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
#ifndef NMBCLUSTERS
#ifdef GATEWAY
#define NMBCLUSTERS 512 /* map size, max cluster allocation */
#else
#define NMBCLUSTERS 256 /* map size, max cluster allocation */
#endif
#endif
/*
* Size of kernel malloc arena in CLBYTES-sized logical pages
*/
#ifndef NKMEMCLUSTERS
#define NKMEMCLUSTERS (2048*1024/CLBYTES)
#define NKMEMCLUSTERS (2 * 1024 * 1024/CLBYTES)
#endif
/*
@ -135,32 +134,26 @@
#define btodb(x) ((x) >> DEV_BSHIFT)
#define dbtob(x) ((x) << DEV_BSHIFT)
/*
* Map a ``block device block'' to a file system block.
* This should be device dependent, and will be if we
* add an entry to cdevsw/bdevsw for that purpose.
* This should be device dependent, and should use the bsize
* field from the disk label.
* For now though just use DEV_BSIZE.
*/
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
/*
* Mach derived conversion macros
*/
#define ns532_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1))
#define ns532_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1))
#define ns532_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
#define ns532_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
#define ns532_btod(x) ((unsigned)(x) >> PDRSHIFT)
#define ns532_dtob(x) ((unsigned)(x) << PDRSHIFT)
#define ns532_round_pdr(x) ((((unsigned)(x)) + PDOFSET) & ~PDOFSET)
#define ns532_trunc_pdr(x) ((unsigned)(x) & ~PDOFSET)
#define ns532_btod(x) ((unsigned)(x) >> PDSHIFT)
#define ns532_dtob(x) ((unsigned)(x) << PDSHIFT)
#define ns532_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
#define ns532_trunc_page(x) ((unsigned)(x) & ~PGOFSET)
#define ns532_btop(x) ((unsigned)(x) >> PGSHIFT)
#define ns532_ptob(x) ((unsigned)(x) << PGSHIFT)
#ifndef _KERNEL
#define DELAY(n) { volatile int N = (n); while (--N > 0); }
#endif
/* Macros to read and write from absolute addresses. */
#define WR_ADR(type,adr,val) (*((volatile type *)(adr))=(val))

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcb.h,v 1.6 1995/03/28 18:18:24 jtc Exp $ */
/* $NetBSD: pcb.h,v 1.7 1996/02/01 00:03:32 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -72,13 +72,11 @@ struct pcb {
long pcb_ksp; /* Kernel stack -- sp0. */
long pcb_kfp; /* Kernel fp. */
long pcb_ptb; /* ptb0 */
long pcb_pl; /* "processor level" */
long pcb_ptb; /* ptb0, ptb1 */
/*
* Software pcb (extension)
*/
u_short pcb_flags; /* Used? PAN */
caddr_t pcb_onfault; /* copyin/out fault recovery */
};

View File

@ -1,6 +1,7 @@
/* $NetBSD: pmap.h,v 1.7 1995/05/11 16:53:07 jtc Exp $ */
/* $NetBSD: pmap.h,v 1.8 1996/02/01 00:03:34 phil Exp $ */
/*
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
@ -49,111 +50,41 @@
* from hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
*/
#ifndef _MACHINE_PMAP_H_
#define _MACHINE_PMAP_H_
#ifndef _NS532_PMAP_H_
#define _NS532_PMAP_H_
#include <machine/cpufunc.h>
#include <machine/pte.h>
/*
* 532 page table entry and page table directory
* Phil Nelson, 12/92
*
* modified from the 386 stuff by W.Jolitz, 8/89
* 386 page table entry and page table directory
* W.Jolitz, 8/89
*/
struct pde /* First level PTE */
{
unsigned long
pd_v:1, /* valid bit */
pd_prot:2, /* access control */
pd_mbz1:4, /* reserved, must be zero */
pd_u:1, /* hardware maintained 'used' bit */
pd_mbz2:1, /* reserved, must be zero */
:3, /* reserved for software */
pd_pfnum:20; /* physical page frame number of pte's*/
};
#define PD_MASK 0xffc00000 /* page directory address bits */
#define PT_MASK 0x003ff000 /* page table address bits */
#define PD_SHIFT 22 /* page directory address shift */
#define PG_SHIFT 12 /* page table address shift */
struct pte
{
unsigned int
pg_v:1, /* valid bit */
pg_prot:2, /* access control */
pg_mbz1:3, /* reserved, must be zero */
pg_nc:1, /* 'uncacheable page' bit */
pg_u:1, /* hardware maintained 'used' bit */
pg_m:1, /* hardware maintained modified bit */
pg_w:1, /* software, wired down page */
:2, /* software (unused) */
pg_pfnum:20; /* physical page frame number */
};
#define PG_V 0x00000001
#define PG_RO 0x00000000
#define PG_RW 0x00000002
#define PG_u 0x00000004
#define PG_PROT 0x00000006 /* all protection bits . */
#define PG_W 0x00000200 /* Wired bit (user def) */
#define PG_N 0x00000040 /* Non-cacheable */
#define PG_M 0x00000100
#define PG_U 0x00000080
#define PG_FRAME 0xfffff000
#define PG_NOACC 0
#define PG_KR 0x00000000
#define PG_KW 0x00000002
#define PG_URKR 0x00000004
#define PG_URKW 0x00000004
#define PG_UW 0x00000006
/* Garbage for current bastardized pager that assumes a hp300 */
#define PG_NV 0
#define PG_CI 0
/*
* Page Protection Exception bits
*/
#define PGEX_TEX 0x03 /* Which exception. */
#define PGEX_DDT 0x04 /* Data direction: 0 => read */
#define PGEX_UST 0x08 /* user/super 0 => supervisor */
#define PGEX_STT 0xf0 /* CPU status. */
#define PGEX_P PGEX_TEX /* Protection violation vs. not present */
#define PGEX_W PGEX_DDT /* during a Write cycle */
#define PGEX_U PGEX_UST /* access from User mode (UPL) */
typedef struct pde pd_entry_t; /* page directory entry */
typedef struct pte pt_entry_t; /* Mach page table entry */
/*
* One page directory, shared between
* kernel and user modes.
*/
#define NS532_PAGE_SIZE NBPG
#define NS532_PDR_SIZE NBPDR
#define NS532_KPDES 8 /* KPT page directory size */
#define NS532_UPDES NBPDR/sizeof(struct pde)-8 /* UPT page directory size */
#define UPTDI 0x3f6 /* ptd entry for u./kernel&user stack */
#define PTDPTDI 0x3f7 /* ptd entry that points to ptd! */
#define KPTDI_FIRST 0x3f8 /* start of kernel virtual pde's */
#define KPTDI_LAST 0x3ff /* last of kernel virtual pde's */
#define KPTDI 0x3f8 /* start of kernel virtual pde's */
#define NKPDE 8
#define APTDPTDI 0x3fe /* start of alternate page directory */
/*
* Address of current and alternate address space page table maps
* and directories.
*/
#ifdef _KERNEL
extern struct pte PTmap[], APTmap[], Upte;
extern struct pde PTD[], APTD[], PTDpde, APTDpde, Upde;
extern pt_entry_t *Sysmap;
extern pt_entry_t PTmap[], APTmap[];
extern pd_entry_t PTD[], APTD[], PTDpde, APTDpde;
extern pt_entry_t *Sysmap;
extern int IdlePTD; /* physical address of "Idle" state directory */
extern int PTDpaddr; /* physical address of kernel PTD */
void pmap_bootstrap __P((vm_offset_t start));
boolean_t pmap_testbit __P((vm_offset_t, int));
void pmap_changebit __P((vm_offset_t, int, int));
__pure u_int pmap_page_index __P((vm_offset_t));
#endif
/*
@ -165,25 +96,24 @@ extern int IdlePTD; /* physical address of "Idle" state directory */
#define vtopte(va) (PTmap + ns532_btop(va))
#define kvtopte(va) vtopte(va)
#define ptetov(pt) (ns532_ptob(pt - PTmap))
#define vtophys(va) (ns532_ptob(vtopte(va)->pg_pfnum) | ((int)(va) & PGOFSET))
#define ispt(va) ((va) >= UPT_MIN_ADDRESS && (va) <= KPT_MAX_ADDRESS)
#define vtophys(va) \
((*vtopte(va) & PG_FRAME) | ((unsigned)(va) & ~PG_FRAME))
#define avtopte(va) (APTmap + ns532_btop(va))
#define ptetoav(pt) (NS532_ptob(pt - APTmap))
#define avtophys(va) (ns532_ptob(avtopte(va)->pg_pfnum) | ((int)(va) & PGOFSET))
#define ptetoav(pt) (ns532_ptob(pt - APTmap))
#define avtophys(va) \
((*avtopte(va) & PG_FRAME) | ((unsigned)(va) & ~PG_FRAME))
/*
* macros to generate page directory/table indicies
*/
#define pdei(va) (((va)&PD_MASK)>>PD_SHIFT)
#define ptei(va) (((va)&PT_MASK)>>PG_SHIFT)
#define pdei(va) (((va) & PD_MASK) >> PDSHIFT)
#define ptei(va) (((va) & PT_MASK) >> PGSHIFT)
/*
* Pmap stuff
*/
struct pmap {
typedef struct pmap {
pd_entry_t *pm_pdir; /* KVA of page directory */
boolean_t pm_pdchanged; /* pdir changed */
short pm_dref; /* page directory ref count */
@ -191,51 +121,81 @@ struct pmap {
simple_lock_data_t pm_lock; /* lock on pmap */
struct pmap_statistics pm_stats; /* pmap statistics */
long pm_ptpages; /* more stats: PT pages */
};
typedef struct pmap *pmap_t;
/*
* Macros for speed
*/
#define PMAP_ACTIVATE(pmapp, pcbp) \
if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \
(pcbp)->pcb_ptb = \
pmap_extract(pmap_kernel(),(vm_offset_t)(pmapp)->pm_pdir); \
if ((pmapp) == &curproc->p_vmspace->vm_pmap) \
_load_ptb0((pcbp)->pcb_ptb); \
(pmapp)->pm_pdchanged = FALSE; \
}
#define PMAP_DEACTIVATE(pmapp, pcbp)
} *pmap_t;
/*
* For each vm_page_t, there is a list of all currently valid virtual
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
* mappings of that page. An entry is a pv_entry, the list is pv_table.
*/
typedef struct pv_entry {
struct pv_entry {
struct pv_entry *pv_next; /* next pv_entry */
pmap_t pv_pmap; /* pmap where mapping lies */
vm_offset_t pv_va; /* virtual address for mapping */
int pv_flags; /* flags */
} *pv_entry_t;
};
#define PV_ENTRY_NULL ((pv_entry_t) 0)
struct pv_page;
#define PV_CI 0x01 /* all entries must be cache inhibited */
#define PV_PTPAGE 0x02 /* entry maps a page table page */
struct pv_page_info {
TAILQ_ENTRY(pv_page) pgi_list;
struct pv_entry *pgi_freelist;
int pgi_nfree;
};
/*
* This is basically:
* ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
*/
#define NPVPPG 340
struct pv_page {
struct pv_page_info pvp_pgi;
struct pv_entry pvp_pv[NPVPPG];
};
#ifdef _KERNEL
extern struct pmap kernel_pmap_store;
struct pv_entry *pv_table; /* array of entries, one per page */
pv_entry_t pv_table; /* array of entries, one per page */
struct pmap kernel_pmap_store;
#define pa_index(pa) atop(pa - vm_first_phys)
#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
#define pmap_kernel() (&kernel_pmap_store)
#define pmap_kernel() (&kernel_pmap_store)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
#define pmap_update() tlbflush()
static __inline void
pmap_clear_modify(vm_offset_t pa)
{
pmap_changebit(pa, 0, ~PG_M);
}
static __inline void
pmap_clear_reference(vm_offset_t pa)
{
pmap_changebit(pa, 0, ~PG_U);
}
static __inline void
pmap_copy_on_write(vm_offset_t pa)
{
pmap_changebit(pa, PG_RO, ~PG_RW);
}
static __inline boolean_t
pmap_is_modified(vm_offset_t pa)
{
return pmap_testbit(pa, PG_M);
}
static __inline boolean_t
pmap_is_referenced(vm_offset_t pa)
{
return pmap_testbit(pa, PG_U);
}
static __inline vm_offset_t
pmap_phys_address(int ppn)
{
return ns532_ptob(ppn);
}
#endif /* _KERNEL */
#endif
#endif /* _NS532_PMAP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.13 1995/09/26 20:16:21 phil Exp $ */
/* $NetBSD: psl.h,v 1.14 1996/02/01 00:03:36 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -38,8 +38,8 @@
* @(#)psl.h 5.2 (Berkeley) 1/18/91
*/
#ifndef _MACHINE_PSL_H_
#define _MACHINE_PSL_H_
#ifndef _NS532_PSL_H_
#define _NS532_PSL_H_
/*
* 32532 processor status longword.
@ -59,6 +59,7 @@
#define PSL_USERSET (PSL_USER | PSL_US | PSL_I)
#define PSL_USERSTATIC (PSL_USER | PSL_US | PSL_I)
#define USERMODE(psr) (((psr) & PSL_USER) == PSL_USER)
/* The PSR versions ... */
#define PSR_USR PSL_USER
@ -237,4 +238,4 @@ splx_di(register int ncpl)
#endif /* !LOCORE */
#endif /* _KERNEL */
#endif /* _MACHINE_PSL_H_ */
#endif /* _NS532_PSL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.h,v 1.3 1994/10/26 08:24:44 cgd Exp $ */
/* $NetBSD: trap.h,v 1.4 1996/02/01 00:03:38 phil Exp $ */
/*
* Mach Operating System
@ -58,7 +58,7 @@
#define T_WATCHPOINT 17 /* watchpoint */
/* To allow for preemption */
#define T_INTERRUPT 18 /* trap code from interrupt! */
#define T_AST 18 /* asynchronous system trap */
/* To include system/user mode in the trap information. */
#define T_USER 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: types.h,v 1.12 1995/12/09 04:41:41 mycroft Exp $ */
/* $NetBSD: types.h,v 1.13 1996/02/01 00:03:40 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -70,6 +70,5 @@ typedef unsigned long long u_int64_t;
typedef int32_t register_t;
#define __SWAP_BROKEN
#define __FORK_BRAINDAMAGE
#endif /* _MACHTYPES_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.6 1995/02/14 18:52:29 phil Exp $ */
/* $NetBSD: vmparam.h,v 1.7 1996/02/01 00:03:43 phil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -38,8 +38,8 @@
* @(#)vmparam.h 5.9 (Berkeley) 5/12/91
*/
#ifndef _MACHINE_VMPARAM_H_
#define _MACHINE_VMPARAM_H_
#ifndef _NS532_VMPARAM_H_
#define _NS532_VMPARAM_H_
/*
* Machine dependent constants for 532.
@ -56,11 +56,13 @@
* Immediately after the user structure is the page table map, and then
* kernal address space.
*/
#define USRTEXT 0x1000 /* For NetBSD... */
#define USRSTACK 0xFDBFE000
#define BTOPUSRSTACK (0xFDC00-(UPAGES)) /* btop(USRSTACK) */
#define LOWPAGES 0
#define HIGHPAGES UPAGES
#define USRTEXT CLBYTES /* For NetBSD... */
#define USRSTACK VM_MAXUSER_ADDRESS
/*
* INTSTACK is a temporary stack for the idle process and cpu_exit.
*/
#define INTSTACK (0xffc00000 + NBPG - 4)
/*
* Virtual memory related constants, all in bytes
@ -89,20 +91,20 @@
#define DMTEXT 1024 /* swap allocation for text */
/*
* Sizes of the system and user portions of the system page table.
* PTEs for mapping user space into the kernel for phyio operations.
* One page is enough to handle 4Mb of simultaneous raw IO operations.
*/
#define SYSPTSIZE (2*NPTEPG)
#define USRPTSIZE (2*NPTEPG)
#ifndef USRIOSIZE
#define USRIOSIZE (1 * NPTEPG) /* 4mb */
#endif
/*
* Size of User Raw I/O map
* PTEs for system V style shared memory.
* This is basically slop for kmempt which we actually allocate (malloc) from.
*/
#define USRIOSIZE 64
/*
* The size of the clock loop.
*/
#define LOOPPAGES (maxfree - firstfree)
#ifndef SHMMAXPGS
#define SHMMAXPGS (1 * NPTEPG) /* 4mb */
#endif
/*
* The time for a process to be blocked before being very swappable.
@ -133,98 +135,19 @@
#define SAFERSS 8 /* nominal ``small'' resident set size
protected against replacement */
/*
* DISKRPM is used to estimate the number of paging i/o operations
* which one can expect from a single disk controller.
*/
#define DISKRPM 60
/*
* Klustering constants. Klustering is the gathering
* of pages together for pagein/pageout, while clustering
* is the treatment of hardware page size as though it were
* larger than it really is.
*
* KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
* units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
*/
#define KLMAX (4/CLSIZE)
#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
#define KLIN (4/CLSIZE) /* default data/stack in klust */
#define KLTXT (4/CLSIZE) /* default text in klust */
#define KLOUT (4/CLSIZE)
/*
* KLSDIST is the advance or retard of the fifo reclaim for sequential
* processes data space.
*/
#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
#if 0
/*
* Paging thresholds (see vm_sched.c).
* Strategy of 1/19/85:
* lotsfree is 512k bytes, but at most 1/4 of memory
* desfree is 200k bytes, but at most 1/8 of memory
* minfree is 64k bytes, but at most 1/2 of desfree
*/
#define LOTSFREE (512 * 1024)
#define LOTSFREEFRACT 4
#define DESFREE (200 * 1024)
#define DESFREEFRACT 8
#define MINFREE (64 * 1024)
#define MINFREEFRACT 2
#endif
/*
* There are two clock hands, initially separated by HANDSPREAD bytes
* (but at most all of user memory). The amount of time to reclaim
* a page once the pageout process examines it increases with this
* distance and decreases as the scan rate rises.
*/
#define HANDSPREAD (2 * 1024 * 1024)
/*
* The number of times per second to recompute the desired paging rate
* and poke the pagedaemon.
*/
#define RATETOSCHEDPAGING 4
/*
* Believed threshold (in megabytes) for which interleaved
* swapping area is desirable.
*/
#define LOTSOFMEM 2
#define mapin(pte, v, pfnum, prot) \
{(*(int *)(pte) = ((pfnum)<<PGSHIFT) | (prot)) ; }
/*
* Mach derived constants
*/
/* user/kernel map constants */
#define VM_MIN_ADDRESS ((vm_offset_t)0)
#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDBFE000)
#define UPT_MIN_ADDRESS ((vm_offset_t)0xFDC00000)
#define UPT_MAX_ADDRESS ((vm_offset_t)0xFDFF7000)
#define VM_MAX_ADDRESS UPT_MAX_ADDRESS
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFDFF7000)
#define UPDT VM_MIN_KERNEL_ADDRESS
#define KPT_MIN_ADDRESS ((vm_offset_t)0xFDFF8000)
#define KPT_MAX_ADDRESS ((vm_offset_t)0xFDFFF000)
#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF7FF000)
#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDC00000)
#define VM_MAX_ADDRESS ((vm_offset_t)0xFDFF7000)
#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFE000000)
#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF800000)
/* virtual sizes (bytes) for various kernel submaps */
#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
/* # of kernel PT pages (initial only, can grow dynamically) */
#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */
/* pcb base */
#define pcbb(p) ((u_int)(p)->p_addr)
#endif