|
|
1.1 root 1: /* kernel.h - halt, isodd, pause, min */
2:
3: /* Symbolic constants used throughout Xinu */
4:
5: #ifndef ASM
6: typedef char Bool; /* Boolean type */
7: typedef long PStype[1]; /* type of PS save location */
8: #endif ASM
9:
10: #define FALSE 0 /* Boolean constants */
11: #define TRUE 1
12: #define NULL (char *)0 /* Null pointer for linked lists*/
13: #define NULLCH '\0' /* The null character */
14: #define NULLSTR "" /* Pointer to empty string */
15: #define SYSCALL int /* System call declaration */
16: #define LOCAL static /* Local procedure declaration */
17: #define COMMAND int /* Shell command declaration */
18: #define BUILTIN int /* Shell builtin " " */
19: #define INTPROC int /* Interrupt procedure " */
20: #define PROCESS int /* Process declaration */
21: #define RESCHYES 1 /* tell ready to reschedule */
22: #define RESCHNO 0 /* tell ready not to resch. */
23: #define MINSHORT 0100000 /* minimum short integer */
24: #define MAXSHORT 077777 /* maximum short integer */
25: #define LOWBYTE 0377 /* mask for low-order 8 bits */
26: #define LOW6 077 /* mask for low-order 6 bits */
27: #define LOW16 0177777 /* mask for low-order 16 bits */
28: /* Following are indexes of */
29: /* saved values of registers */
30: /* in the process table */
31: /* register save area: */
32: #define SPINDX 0 /* kernel stack pointer */
33: #define APINDX 16 /* argument pointer */
34: #define FPINDX 17 /* frame pointer */
35: #define PCINDX 18 /* program counter */
36: #define PSINDX 19 /* program status longword */
37: #define P0BRINDX 20 /* p0 base register */
38: #define P0LRINDX 21 /* p0 length register */
39: #define P1BRINDX 22 /* p1 base register */
40: #define MINSTK 128 /* minimum process stack size */
41: #define NULLSTK 1024 /* process 0 stack size */
42: #define MAGIC 0xaaaaaaaa /* unusual value for top of stk */
43:
44: /* Universal return constants */
45:
46: #define OK 1 /* returned when system call ok */
47: #define SYSERR -1 /* returned when sys. call fails*/
48: #define EOF -2 /* returned for end-of-file */
49: #define TIMEOUT -3 /* returned " " " times out */
50: #define INTRMSG -4 /* keyboard "intr" key pressed */
51: /* (usu. defined as ^B) */
52:
53: /* Initialization constants */
54:
55: #define INITSTK 1024 /* initial process stack */
56: #define INITPRIO 20 /* initial process priority */
57: #define INITNAME "main" /* initial process name */
58: #define INITARGS 1,0 /* initial count/arguments */
59: #define INITRET userret /* INITRET=process' return point*/
60: #define INITPS 0x00000000 /* initial process PSL: */
61: /* integer oflow trap disabled, */
62: /* interrupts enabled */
63: #define INITBR 0x80000000 /* P0 & P1 base register */
64: #define INITLR 0x04000000 /* P0LR-> ASTLVL==none pending */
65: #define INITREG 0 /* initial register contents */
66: #define QUANTUM 10 /* clock ticks until preemption */
67:
68: /* Miscellaneous utility inline functions */
69:
70: #ifndef ASM
71: #define isodd(x) (01&(int)(x))
72: #define pause() asm("nop") /* pause-like instruction */
73: #define halt() asm("jmp __halt")
74: #define min(a,b) ((a) < (b) ? (a) : (b))
75: #endif ASM
76:
77: #ifndef ASM
78: extern int rdyhead, rdytail;
79: extern int preempt;
80: #endif ASM
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.