home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) param.h 2.3 88/05/18
- *
- * Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
- * Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
- * This Module contains Proprietary Information of
- * The Santa Cruz Operation, Microsoft Corporation
- * and AT&T, and should be treated as Confidential.
- */
-
- /*
- * THIS FILE CONTAINS CODE WHICH IS SPECIFIC TO THE
- * INTEL 80286 CPU AND MAY REQUIRE MODIFICATION
- * WHEN ADAPTING XENIX TO NEW HARDWARE.
- */
-
- /*
- * Adjustable parameters
- */
- #ifdef M_I8086
- #define HZ 20 /* Ticks/second of the clock */
- #define SSIZE 1024 /* initial stack size (bytes) */
- #define KSSIZE 1024 /* size of per process kernel stack */
- #endif
-
- #ifdef M_I286
- #define HZ 50 /* Ticks/second of the clock */
- #define SSIZE 4096 /* initial stack size (bytes) */
- #define KSSIZE 1024 /* size of per process kernel stack */
- #define OFFUSRPG 0 /* address of U page (for fpsup.s) */
- #endif
-
- #ifdef M_I386
- #define HZ 50 /* Ticks/second of the clock */
- #define SSIZE 4096 /* initial stack size (bytes) */
- #define KSSIZE 2048 /* size of per process kernel stack */
-
- #define USIZE (u.u_procp->p_usize)
- /* size of user block (pages) */
- #define MAXUSIZE 17 /* maximum size of user block (*4k bytes) */
- /* min size of user block (*4k bytes) */
- #define MINUSIZE btoc(sizeof(struct user))
-
- #define KERNTBASE 40 /* page directory index for kernel text -
- this is then moved to KERNBASE + KERNTBASE */
-
- #define KERNTADDR (ctob((KERNTBASE)*NEPT))
- /* kernel text base linear address */
-
- #define KERNBASE 950 /* page directory index where kernel resides */
- #define KERNADDR (ctob((KERNBASE)*NEPT)) /* kernel base linear address */
-
- #define SPTOFFS 24 /* page directory offset of
- sptmap from base of kernel */
- #define SPTADDR (ctob((SPTOFFS)*NEPT)) /* kernel data address of
- sptmapped address space */
- #define SPTBASE (KERNBASE+SPTOFFS) /* page directory index for
- sptmapped address space */
- #define TEXTBASE 600 /* page directory index for first text pt */
- #define DATABASE 0 /* page directory index for first data pt */
- #define SHMBASE 400 /* page directory index for first shdata pt */
- #define PHYSBASE 500 /* pdi for physmem mapped into user space */
- #define SHLBBASE 640 /* pdi for shared library text */
- #define WEITBASE 1023 /* pdi for mem-mapped weitek coprocessor */
-
-
-
- #define TXTPDENT 10 /* number of text page directory entries */
- #define DATAPDENT 100 /* number of data page directory entries */
- #define SHMPDENT 25 /* number of shared data page dir entries */
- #define PHYSPDENT 1 /* number of physmem page dir entries */
- #define SHLBPDENT 128 /* " for shared libraries, these are sparse */
- #define WEITDENT 1 /* " for weitek coprocessor */
-
- #define WEITEK_START 0xFFC00000
- #define WEITEK_END 0xFFC08000
-
- #define TAU (HZ/4) /* working set scanning period */
- /* 64K/PGSIZE = num 4K pages per 286 seg */
- #define N386PAGEPS (0x10000/PGSIZE)
- #endif
-
- #define SINCR 1024 /* increment of stack (bytes) (not used)*/
- #define NOFILE 60 /* max open files per process */
- #define CDLIMIT (1L<<21) /* default max write address */
- #define CANBSIZ 256 /* max size of typewriter line */
- #define MSGBUFS 128 /* Characters saved from error messages */
- #define NCARGS 5120 /* # characters in exec arglist */
- #define MAXTTYS 16 /* Max # open ttys */
- #define NIOSTAT 50 /* max number of bufs to keep stats for */
- #define MAXPID 30000 /* max process id */
- #define MAXUID 60000 /* max user id */
- #define MAXLINK 1000 /* max links */
- #define BSSIZE 256 /* bytes in bootstring buffer */
- #define NCARGS 5120 /* # characters in exec arglist */
- #define MINBUF 40 /* minimum # of buffers */
- #define NSEG 2 /* max seg/user (see user.h) 8086 only */
-
- /*
- * These are temp to implement statfs without FSS.
- * This should be replaced by var nfstyp in an FSS kernel.
- */
-
- #define NFSTYP 1 /* Refers to fstypsw entries, not block size */
-
- #define Fs1b 1 /* 512 byte blocks */
- #define Fs2b 2 /* 1024 byte blocks */
- #define S5FSTYP Fs2b
-
- /*
- * priorities
- * probably should not be
- * altered too much
- */
-
- #define PSWP 0
- #define PINOD 10
- #define PRIBIO 20
- #define PZERO 25
- #define NZERO 20
- #define PCATCH 0400
- #define PMASK 0177
- #define PPIPE 26
- #define PWAIT 30
- #define PSLEP 40
- #define PUSER 50
- #define PIDLE 127
-
- /*
- * fundamental constants of the implementation--
- * cannot be changed easily
- */
-
- #define NBPW sizeof(int) /* number of bytes in an integer */
- /*
- * *** WARNING ***
- * Some io devices may have a problem
- * if BSIZE is greater than MMPGSZ
- * If BSIZE changes, so must NSBFILL, BSHIFT,
- * NSHIFT, LINOPB
- */
- #define BSIZE 1024 /* size of secondary block (bytes) */
- #define BSHIFT 10 /* LOG2(BSIZE) */
- #define BMASK (BSIZE - 1) /* BSIZE-1 */
- #define BSLOP 0 /* must be 0 for current copyio implemtation*/
- #define NINDIR (BSIZE/sizeof(daddr_t))
- #define NSHIFT 8 /* LOG2(NINDIR) */
- #define NMASK (NINDIR - 1) /* NINDIR-1 */
- #define INOPB (BSIZE/sizeof(struct dinode)) /* # inodes per block */
- #define LINOPB 4 /* LOG2(INOPB) */
- #define INOSHIFT 4 /* LOG2(INOPB) */
- #ifndef NULL /* bs for util including param and stdio */
- #define NULL ((char *)0)
- #endif
- #define NODEV (dev_t)(-1)
- #define ROOTINO ((ino_t)2) /* i number of all roots */
- #define SUPERB ((daddr_t)1) /* block number of the super block */
- #define DIRSIZ 14 /* max characters per directory */
- #define NICINOD 100 /* number of superblock inodes */
- #define NICFREE 100 /* number of superblock free blocks */
- #define NSBFILL 371 /* aligns s_magic, .. at end of super block */
-
- #ifdef M_I386
- #define NCPS 1 /* Number of clicks per segment */
- #define NBPC 4096 /* Number of bytes per click */
- #define NDPC 4 /* number of blocks per click */
- #define BPCSHIFT 12 /* LOG2(NBPC) if exact */
- #endif
-
- #define FsBSIZE(dev) BSIZE
- #define FsBSHIFT(dev) BSHIFT
- #define FsNINDIR(dev) NINDIR
- #define FsBMASK(dev) BMASK
- #define FsBOFF(dev, x) ((x)&BMASK)
- #define FsBNO(dev, x) (x>>BSHIFT)
- #define FsINOPB(dev) INOPB
- #define FsLTOP(dev, b) (b)
- #define FsPTOL(dev, b) (b)
- #define FsNMASK(dev) NMASK
- #define FsNSHIFT(dev) NSHIFT
- #define FsITOD(dev, x) itod(x)
- #define FsITOO(dev, x) itoo(x)
- #define FsINOS(dev, x) ((x&~07)+1)
-
- /*
- * MMU parameters.
- */
-
- #ifdef M_I8086
- #define PAGESIZE 16 /* size of memory allocation unit */
- #define MMPGSZ PAGESIZE
- #define PAGEMASK (PAGESIZE - 1) /* PAGESIZE - 1 */
- #define LPGSIZE 4 /* log 2 of pagesize */
- #define LMMPGSZ LPGSIZE
- #define MMPGMASK PAGEMASK
- #define NPAGEPS 0x1000 /* 64k/MMPGSZ = number of pages/seg */
- #define MAXPAGES 0xA000
- #define MAXPAGE MAXPAGES
- #define UPGSIZE sizeof(struct user)
- #define USIZE btoms(UPGSIZE)
- #define STACKSTART(ss) (USRSTACK - mstob(ss))
- #endif
-
- #ifdef M_I286
- #define MMPGSZ 512 /* bytes/page in the MMU */
- #define LMMPGSZ 9 /* log2(MMPGSZ) */
- #define NPAGEPS 128 /* 64k/MMPGSZ = number of pages per segment */
- #define MAXPAGES 32768L
- #define USIZE (u.u_procp->p_usize)
- #endif
-
- #ifndef M_I386
- #ifndef M_I8086
- #ifndef M_I286
- ERROR ****))))) /* error if none defined */
- #endif
- #endif
- #endif
-
- #ifdef M_I8086 /* error if any two defined */
- #ifdef M_I286
- ERROR ****)))))
- #endif
- #ifdef M_I386
- ERROR ****)))))
- #endif
- #endif
-
- #ifdef M_I286
- #ifdef M_I386
- ERROR ****)))))
- #endif
- #endif
-
-
- /* true if bp is not mapped out */
- #ifdef M_I386
- #define issabuf(bp) (1)
- #else
- #define issabuf(bp) (bp->b_paddr <= ktop(sabuf[v.v_sabuf]))
- #endif
-
- #ifdef M_I8086
- #define ptok(x) ((caddr_t)x)
- #define ktop(x) ((paddr_t)(unsigned)x)
- #define copypsize(rpp,rip) rpp->p_size = rip->p_size;
- #define USRSTACK u.u_topstk
- #define URSBC 14 /* User stk Reg Save area Byte Cnt */
- #endif
-
- #ifdef M_I286
- #define ptok(x) ((caddr_t)((unsigned) x - (unsigned) kmemstart))
- #define ktop(x) ((paddr_t)(unsigned) x + kmemstart)
- #define copypsize(rpp,rip) rpp->p_usize = rip->p_usize; \
- rpp->p_lsize = rip->p_lsize
- #define USRSTACK u.u_stkbot
- #define URSBC 0 /* User stk Reg Save area Byte Cnt */
- #endif
-
- #ifdef M_I386
- #define ktop(addr) ((paddr_t)addr)
- #define ptok(addr) ((caddr_t)addr)
- #define copypsize(rpp,rip) rpp->p_usize = rip->p_usize;
- #endif
-
- #define lobyte(X) (((unsigned char *)&X)[0])
- #define hibyte(X) (((unsigned char *)&X)[1])
- #define loword(X) (((ushort *)&X)[0])
- #define hiword(X) (((ushort *)&X)[1])
-
-
- /*
- * Machine-dependent bits and macros
- */
-
- #ifndef M_I386
- #define CLKONLY(ps) (((ps)&PS_PRIMASK)==0)
- #define USERMODE(ps) ((ps)&PS_USER)
- #define PTRSIZE(f) ((f)? sizeof(char far *) : sizeof(caddr_t))
-
- /*
- * 286/8086 simulated "state" definitions.
- */
-
- #define PS_USER 0x01 /* "user" mode */
- #define PS_SYS 0xFE /* for mch.a86, turns off user mode */
- #define PS_PRIMASK 0xFF00 /* previous priority */
- #define SHWDSZ (2+6) /* space on user stack for shell word */
- #endif
-
-
- #ifdef M_I386
- #define SPL0MASK 0x00
- #define USERMODE(cs) ((cs & DPL_USER) == DPL_USER)
- #define CLKONLY(mask) ((mask) == 0)
- #define USRSTACK u.u_stkbot
- #define USRSTACK286 ((caddr_t)FTOOFF(u.u_stkbot))
- #define URSBC 0 /* User stk Reg Save area Byte Cnt */
- #define PTRSIZE(f) ((f)? sizeof(caddr_t) : sizeof(short))
- #define SHWDSZ (nbpw+6) /* space on user stack for shell word */
- #endif
-
- #define NBPW286 2 /* sizeof an int on a 80286 */
-
-
- /* Conditional compilation */
-
- #define PAGEMMU /* mmu is divided in pages */
-
- #ifdef M_I386
-
- /*#define SHORTINT /* sizeof(int)==sizeof(short) */
- /*#define BYTESWAP /* byte ordering is opposite that of pdp11
- /*#define OLDFORK /* return to parent by bumping pc by 2 */
- /*#define FIXEDSTACK /* stack cannot grow */
- /*#define BUFMAPOUT /* buffers are mapped out */
- /*#define LARGECODE /* kernel supports multisegment code */
- /*#define UNOTMAPPED /* upage copied in on context switch */
-
- #else
-
- #define SHORTINT /* sizeof(int)==sizeof(short) */
- #define BUFMAPOUT /* buffers are mapped out */
- #define UNOTMAPPED /* upage copied in on context switch */
- #ifdef M_I286
- #define FIXEDSTACK /* stack cannot grow */
- #endif
- #ifdef M_I8086
- #define LARGECODE /* kernel supports multisegment code */
- #endif
-
- #endif
-