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