also be able to run benchmarks from packages.
[minix.git] / kernel / const.h
blobaa0ec7a7d7a86107967268949e712e60197bd93e
1 /* General macros and constants used by the kernel. */
2 #ifndef CONST_H
3 #define CONST_H
5 #include <minix/config.h>
6 #include <minix/bitmap.h>
8 #include "config.h"
9 #include "debug.h"
11 /* Translate an endpoint number to a process number, return success. */
12 #define isokendpt(e,p) isokendpt_d((e),(p),0)
13 #define okendpt(e,p) isokendpt_d((e),(p),1)
15 /* Constants used in virtual_copy(). Values must be 0 and 1, respectively. */
16 #define _SRC_ 0
17 #define _DST_ 1
19 #define get_sys_bit(map,bit) \
20 ( MAP_CHUNK(map.chunk,bit) & (1 << CHUNK_OFFSET(bit) )
21 #define get_sys_bits(map,bit) \
22 ( MAP_CHUNK(map.chunk,bit) )
23 #define set_sys_bit(map,bit) \
24 ( MAP_CHUNK(map.chunk,bit) |= (1 << CHUNK_OFFSET(bit) )
25 #define unset_sys_bit(map,bit) \
26 ( MAP_CHUNK(map.chunk,bit) &= ~(1 << CHUNK_OFFSET(bit) )
28 #define reallock do { int d; d = intr_disabled(); intr_disable(); locklevel++; if(d && locklevel == 1) { minix_panic("reallock while interrupts disabled first time", __LINE__); } } while(0)
30 #define realunlock do { if(!intr_disabled()) { minix_panic("realunlock while interrupts enabled", __LINE__); } if(locklevel < 1) { minix_panic("realunlock while locklevel below 1", __LINE__); } locklevel--; if(locklevel == 0) { intr_enable(); } } while(0)
32 /* Disable/ enable hardware interrupts. The parameters of lock() and unlock()
33 * are used when debugging is enabled. See debug.h for more information.
35 #define lock reallock
36 #define unlock realunlock
38 #ifdef CONFIG_IDLE_TSC
39 #define IDLE_STOP if(idle_active) { read_tsc_64(&idle_stop); idle_active = 0; }
40 #else
41 #define IDLE_STOP
42 #endif
44 /* args to intr_init() */
45 #define INTS_ORIG 0 /* restore interrupts */
46 #define INTS_MINIX 1 /* initialize interrupts for minix */
48 /* for kputc() */
49 #define END_OF_KMESS 0
51 #endif /* CONST_H */