|
|
1.1.1.2 ! root 1: /* kernel.h - disable, enable, halt, restore, isodd */ 1.1 root 2: 3: /* Symbolic constants used throughout Xinu */ 4: 5: typedef char Bool; /* Boolean type */ 6: 1.1.1.2 ! root 7: /* Machine size definitions */ ! 8: ! 9: typedef char CHAR; /* sizeof the unit the holds a character*/ ! 10: typedef int WORD; /* maximum of (int, char *) */ ! 11: typedef char *PTR; /* sizeof a char. or fcnt. pointer */ ! 12: typedef int INT; /* sizeof compiler integer */ ! 13: typedef int REG; /* sizeof machine register */ ! 14: ! 15: /* Machine dependent type definitions */ ! 16: ! 17: #ifdef lsi11 ! 18: #define SAVEDPS CHAR /* Saved processor status type */ ! 19: #else ! 20: #define SAVEDPS INT ! 21: #endif ! 22: ! 23: #define SYSCALL WORD /* System call declaration */ ! 24: #define LOCAL static WORD /* Local procedure declaration */ ! 25: #define INTPROC WORD /* Interrupt procedure " */ ! 26: #define PROCESS WORD /* Process declaration */ 1.1 root 27: #define FALSE 0 /* Boolean constants */ 28: #define TRUE 1 29: #define NULL (char *)0 /* Null pointer for linked lists*/ 30: #define RESCHYES 1 /* tell ready to reschedule */ 31: #define RESCHNO 0 /* tell ready not to resch. */ 1.1.1.2 ! root 32: #define MINSTK 800 /* minimum process stack size */ ! 33: #define NULLSTK 800 /* process 0 stack size */ ! 34: #define OK 1 /* returned when system call ok */ ! 35: ! 36: /* Machine dependent constants */ ! 37: ! 38: #ifdef lsi11 ! 39: #define SP 6 /* reg. 6 is stack pointer */ ! 40: #define PC 7 /* reg. 7 is program counter */ ! 41: #define PS 8 /* proc. status in 8th reg. loc */ ! 42: #define INITPS 0 /* initial proc. status */ ! 43: #define MININT 0x8000 /* minimum integer (-32768) */ ! 44: #define MAXINT 0x7fff /* maximum integer */ ! 45: #define MINLONG 0x8000 /* minimum long (-32768) */ ! 46: #define MAXLONG 0x7fff /* maximum long */ 1.1 root 47: #define SYSERR -1 /* returned when sys. call fails*/ 1.1.1.2 ! root 48: #define DISABLE 0340 /* PS to disable interrupts */ ! 49: ! 50: #else ! 51: #define SSP 15 /* Supervisor stack pointer */ ! 52: #define PS 16 ! 53: #define PC 17 ! 54: #define USP 18 /* User stack pointer */ ! 55: #define INITPS 0x2000 /* initial proc. status */ ! 56: #define MININT 0x80000000 ! 57: #define MAXINT 0x7fffffff ! 58: #define MAXLONG 0x7fffffff ! 59: #define MINLONG 0x80000000 ! 60: #define SYSERR -1 ! 61: #define DISABLE 0x2700 ! 62: #endif 1.1 root 63: 1.1.1.2 ! root 64: /* initialization constants */ 1.1 root 65: 1.1.1.2 ! root 66: #define INITARGC 1 /* initial process argc */ ! 67: #define INITSTK 1000 /* initial process stack size */ 1.1 root 68: #define INITPRIO 20 /* initial process priority */ 69: #define INITNAME "main" /* initial process name */ 1.1.1.2 ! root 70: #define INITRET userret /* processes return address */ 1.1 root 71: #define INITREG 0 /* initial register contents */ 72: #define QUANTUM 10 /* clock ticks until preemption */ 73: 1.1.1.2 ! root 74: /* misc. utility inline functions */ 1.1 root 75: 1.1.1.2 ! root 76: #define isodd(x) (01&(WORD)(x)) ! 77: ! 78: /* Machine dependent machine status functions */ ! 79: ! 80: #ifdef lsi11 ! 81: #define disable(ps) asm("mfps ~ps");asm("mtps $0340") ! 82: #define restore(ps) asm("mtps ~ps") /* restore interrupt status */ ! 83: #define enable() asm("mtps $000")/* enable interrupts */ ! 84: #define pause() asm("wait") /* machine "wait for interr." */ ! 85: #define halt() asm("halt") /* machine halt instruction */ ! 86: ! 87: #else ! 88: /* Note: disable and restore are now true procedures */ ! 89: #define enable() asm(" movw #0x2000, sr") ! 90: /* machine wait for intr. */ ! 91: #define pause() asm("pause: jmp pause") ! 92: /* machine halt instruction */ ! 93: #define halt() asm("halt: jmp halt") ! 94: #endif 1.1 root 95: 96: extern int rdyhead, rdytail; 1.1.1.2 ! root 97: ! 98: #ifdef RTCLOCK 1.1 root 99: extern int preempt; 1.1.1.2 ! root 100: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.