const.h


#ifndef _CONST_H
#define _CONST_H

/* Hardware constants */
#define PAGESIZE    512 /* page size in bytes */
#define BEGINTRAP   0   /* beginning of trap areas */
#define BEGININTR   0220    /* beginning of interrupt areas */
#define BEGINDEVREG 01400   /* beginning of device registers */

/* utility constants */
#define TRUE        1
#define FALSE       0
#define HIDDEN      static      
#define NULL        0177777
#define NOPROC      -1
#define SECOND      1000000L

/* trap types */
#define PROGTRAP    0   /* program trap */
#define MMTRAP      1   /* memory management trap */
#define SYSTRAP     2   /* system call trap */
#define TRAPTYPES   3   /* number of trap types */

/* program trap codes */
#define ILOPCODE    0   /* illegal opcode */
#define NONSUPINSTR 1   /* nonsupported instruction */
#define PRIVINSTR   2   /* privileged instruction */
#define ILLINSTR    3   /* ill formed instruction */
#define ODDADD      4   /* odd address */
#define NONPAGEAL   5   /* non page alignment */
#define NONEXISTMEM 6   /* non existent memory */
#define STKLIMYELLOW    7   /* stack limit yellow */
#define STKLIMRED   8   /* stack limit red */
#define ZERODIV     9   /* zero divide */

/* memory management trap codes */
#define ACCESSPROT  0   /* access protection violation */
#define PAGEMISS    1   /* missing page */
#define INVPAGE     2   /* invalid page number */
#define SEGMISS     3   /* missing segment */

/* device operation codes */
#define IOREAD      0
#define IOWRITE     1
#define IOSEEK      2

/* device completion codes */
#define NORMAL      0
#define HARDFAILURE 1
#define ILOP        2
#define ILBUF       3
#define ILAMOUNT    4
#define ILTRACK     5
#define ILSECTOR    6
#define ENDOFINPUT  7
#define NOSUCHDEV   8
#define DEVNOTREADY 9

/* device numbers according to the position of their device registers */
#define TERM0       0
#define TERM1       1
#define TERM2       2
#define TERM3       3
#define TERM4       4
#define PRINT0      5
#define PRINT1      6
#define DISK0       7
#define DISK1       8
#define DISK2       9
#define DISK3       10
#define DRUM0       11
#define DRUM1       12
#define DRUM2       13
#define DRUM3       14
    
/* operations */
#define MIN(A,B)    ((A) < (B) ? A : B)
#define MAX(A,B)    ((A) < (B) ? B : A)
#define EVEN(A)     (((unsigned)A & 01) == 0)

#ifdef SUPPORT
#define MAXTHREAD   30
#define MAXMSG      30
#define MAXPROC     12
#else
#define MAXTHREAD   20
#define MAXMSG      20
#define MAXPROC     20
#endif

#endif


[INDICE CODICE]