|
|
1.1 ! root 1: /* (-lgl ! 2: * COHERENT Version 3.0 ! 3: * Copyright (c) 1982, 1990 by Mark Williams Company. ! 4: * All rights reserved. May not be copied without permission. ! 5: -lgl) */ ! 6: /* ! 7: * Machine dependent definitions. ! 8: * 8086/8088 Coherent, IBM PC. ! 9: */ ! 10: #ifndef __SYS_MACHINE_H__ ! 11: #define __SYS_MACHINE_H__ ! 12: ! 13: #include <common/feature.h> ! 14: #include <sys/const.h> ! 15: #include <sys/types.h> ! 16: ! 17: /* ! 18: * Offsets for registers. ! 19: */ ! 20: #define OIP -3 ! 21: ! 22: /* ! 23: * Functions. ! 24: * blockn - block number from byte number ! 25: * blocko - block offset from byte number ! 26: * nbnrem - offset into indirect block from block number ! 27: * nbndiv - residual indirect mapping from block number ! 28: * btocru - byte to click (saddr_t) rounding up ! 29: * btocrd - byte to click rounding down ! 30: * bruc - byte rounded up to click boundary ! 31: * ctob - click to byte ! 32: * ctokrd - click to Kbyte rounding down ! 33: * stod - saddr_t to daddr_t conversion for swapper. ! 34: */ ! 35: #define blockn(n) ((n)>>9) ! 36: #define blocko(n) ((n)&(512-1)) ! 37: #define nbnrem(b) ((int)(b)&(128-1)) ! 38: #define nbndiv(b) ((b)>>7) ! 39: /* A click is a 16 byte paragraph, but they are allocated in chunks ! 40: * of 512 bytes so that disk and memory segments have same granularity. ! 41: */ ! 42: /* The following macros are no longer valid in protected mode. ! 43: * #define btocru(n) ((saddr_t) (((n+511)>>9) << 5)) ! 44: * #define btocrd(n) ((saddr_t) ((n)>>4)) ! 45: * #define bruc(n) ((n+511)&~511) ! 46: * #define ctob(n) ((n)<<4) ! 47: * #define ctokrd(n) ((n)>>6) ! 48: * #define stod(n) ((daddr_t)((n)>>5)) ! 49: */ ! 50: ! 51: /* ! 52: * Simple functions. ! 53: */ ! 54: #define msetppc(v) (((int *)((char *)&u+UPASIZE))[OIP] = (v)) ! 55: #define sxalloc(s, f) ((f&SFHIGH)?shalloc(s):smalloc(s)) ! 56: #define vsegpair(v) (v),sds ! 57: ! 58: /* The following macro is no longer valid in protected mode. ! 59: * #define psegpair(p) (int)((p)&0xF),((int)((p)>>4)) ! 60: */ ! 61: ! 62: /* ! 63: * For mapping auxiliary segment in exec. ! 64: */ ! 65: #define asave(o) ! 66: #define arest(o) ! 67: #define abase(s) (sas=s, 0) ! 68: #define adone(s) ! 69: ! 70: /* ! 71: * Buffers are not mapped. ! 72: */ ! 73: #define bsave(o) ! 74: #define brest(o) ! 75: #define bmapv(p) ! 76: #define bconv(p) (p) ! 77: /* #define bvirt(p) (p-ctob(sds)) */ ! 78: ! 79: /* ! 80: * Clist are not mapped. ! 81: */ ! 82: #define csave(o) ! 83: #define crest(o) ! 84: #define cmapv(p) ! 85: #define cconv(p) (p) ! 86: #define cvirt(p) ((CLIST *)(p)) ! 87: ! 88: /* ! 89: * Drivers are not mapped. ! 90: */ ! 91: #define dsave(o) ! 92: #define drest(o) ! 93: #define dmapv(s) ! 94: #define dvirt() 0 ! 95: #define dcopy(dst,src) ! 96: ! 97: /* ! 98: * Register structure. ! 99: */ ! 100: typedef union mreg_u { ! 101: unsigned m_reg [1]; ! 102: unsigned m_int; ! 103: } MREG; ! 104: ! 105: /* ! 106: * Segmenation prototype. ! 107: */ ! 108: typedef struct mproto { ! 109: saddr_t *mp_cbp; ! 110: saddr_t *mp_dbp; ! 111: unsigned mp_csl; ! 112: unsigned mp_dsl; ! 113: vaddr_t mp_svb; ! 114: vaddr_t mp_svl; ! 115: } MPROTO; ! 116: ! 117: /* ! 118: * Set jump and return structure. ! 119: */ ! 120: typedef struct menv_s { ! 121: int me_di; ! 122: int me_si; ! 123: int me_bp; ! 124: int me_sp; ! 125: int me_pc; ! 126: int me_fw; ! 127: int me_depth; /* Stack depth */ ! 128: } MENV; ! 129: ! 130: /* ! 131: * Context structure. ! 132: */ ! 133: typedef struct mcon_s { ! 134: int mc_di; ! 135: int mc_si; ! 136: int mc_bp; ! 137: int mc_sp; ! 138: int mc_pc; ! 139: int mc_fw; ! 140: int mc_depth; /* Stack depth */ ! 141: } MCON; ! 142: ! 143: /* ! 144: * General register structure. ! 145: */ ! 146: typedef struct mgen { ! 147: } MGEN; ! 148: ! 149: #if __KERNEL__ ! 150: ! 151: /* ! 152: * Global variables. ! 153: */ ! 154: extern unsigned sas; /* System auxiliary segment */ ! 155: extern unsigned scs; /* System code segment */ ! 156: extern unsigned sds; /* System data segment */ ! 157: ! 158: extern saddr_t uasa; /* Currently active uarea segment */ ! 159: ! 160: #endif /* __KERNEL__ */ ! 161: ! 162: #endif /* ! defined (__SYS_MACHINE_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.