Home | History | Annotate | Line # | Download | only in include
mips_param.h revision 1.5
      1 /*	$NetBSD: mips_param.h,v 1.5 1997/07/07 03:54:30 jonathan Exp $	*/
      2 
      3 /*
      4  * Architecture name.
      5  */
      6 #define	_MACHINE_ARCH	mips
      7 #define	MACHINE_ARCH	"mips"
      8 
      9 /*
     10  * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE.
     11  * On mips, UPAGES is fixed by sys/arch/mips/mips/locore code
     12  * to be the number of per-process-wired kernel-stack pages/PTES.
     13  */
     14 
     15 #define	UPAGES		2		/* pages of u-area */
     16 #define	UADDR		0xffffc000	/* address of u */
     17 #define USPACE          (UPAGES*NBPG)   /* size of u-area in bytes */
     18 #define	UVPN		(UADDR>>PGSHIFT)/* virtual page number of u */
     19 #define	KERNELSTACK	(UADDR+UPAGES*NBPG)	/* top of kernel stack */
     20 
     21 
     22 /*
     23  * Round p (pointer or byte index) up to a correctly-aligned value for all
     24  * data types (int, long, ...).   The result is u_int and must be cast to
     25  * any desired pointer type.
     26  */
     27 #define	ALIGNBYTES	7
     28 #define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     29 #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     30 
     31 #define	NBPG		4096		/* bytes/page */
     32 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     33 #define	PGSHIFT		12		/* LOG2(NBPG) */
     34 #define	NPTEPG		(NBPG/4)
     35 
     36 #define NBSEG		0x400000	/* bytes/segment */
     37 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
     38 #define	SEGSHIFT	22		/* LOG2(NBSEG) */
     39 
     40 /*
     41  * Size of kernel malloc arena in CLBYTES-sized logical pages
     42  */
     43 #ifndef NKMEMCLUSTERS
     44 #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
     45 #endif
     46 
     47 /* pages ("clicks") (4096 bytes) to disk blocks */
     48 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
     49 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
     50 
     51 /* pages to bytes */
     52 #define	ctob(x)		((x) << PGSHIFT)
     53 #define btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
     54 
     55 /* bytes to disk blocks */
     56 #define	btodb(x)	((x) >> DEV_BSHIFT)
     57 #define dbtob(x)	((x) << DEV_BSHIFT)
     58 
     59 /*
     60  * Map a ``block device block'' to a file system block.
     61  * This should be device dependent, and should use the bsize
     62  * field from the disk label.
     63  * For now though just use DEV_BSIZE.
     64  */
     65 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
     66 
     67 /*
     68  * Mach derived conversion macros
     69  */
     70 #define mips_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
     71 #define mips_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
     72 #define mips_btop(x)		((unsigned)(x) >> PGSHIFT)
     73 #define mips_ptob(x)		((unsigned)(x) << PGSHIFT)
     74 
     75 #ifdef _KERNEL
     76 #ifndef _LOCORE
     77 typedef int spl_t;
     78 extern spl_t splx __P((spl_t));
     79 extern spl_t splsoftnet __P((void)), splsoftclock __P((void));
     80 extern spl_t splhigh __P((void));
     81 extern spl_t spl0 __P((void));	/* XXX should not enable TC on 3min */
     82 
     83 extern void setsoftnet __P((void)), clearsoftnet __P((void));
     84 extern void setsoftclock __P((void)), clearsoftclock __P((void));
     85 
     86 
     87 extern int (*Mach_splnet) __P((void)), (*Mach_splbio) __P((void)),
     88 	   (*Mach_splimp) __P((void)), (*Mach_spltty) __P((void)),
     89 	   (*Mach_splclock) __P((void)), (*Mach_splstatclock) __P((void)),
     90 	   (*Mach_splnone) __P((void));
     91 #define	splnet()	((*Mach_splnet)())
     92 #define	splbio()	((*Mach_splbio)())
     93 #define	splimp()	((*Mach_splimp)())
     94 #define	spltty()	((*Mach_spltty)())
     95 #define	splclock()	((*Mach_splclock)())
     96 #define	splstatclock()	((*Mach_splstatclock)())
     97 
     98 extern void delay __P((int n));
     99 
    100 #endif	/* _LOCORE */
    101 #endif	/* _KERNEL */
    102