1: /* 2: * Copyright (c) 1987 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)scb.s 1.3 (2.11BSD GTE) 1/1/93 7: */ 8: 9: #include "DEFS.h" 10: #include "../machine/trap.h" 11: #include "../machine/mch_iopage.h" 12: #include "../machine/koverlay.h" /* for OVLY_TABLE_BASE */ 13: 14: #include "acc.h" 15: #include "css.h" 16: #include "de.h" 17: #include "dh.h" 18: #include "dhu.h" 19: #include "dhv.h" 20: #include "dn.h" 21: #include "dr.h" 22: #include "dz.h" 23: #include "ec.h" 24: #include "hk.h" 25: #include "ht.h" 26: #include "il.h" 27: #include "lp.h" 28: #include "ra.h" 29: #include "rk.h" 30: #include "rl.h" 31: #include "br.h" 32: #include "rx.h" 33: #include "si.h" 34: #include "sri.h" 35: #include "tm.h" 36: #include "ts.h" 37: #include "tms.h" 38: #include "xp.h" 39: #include "vv.h" 40: 41: /* 42: * Reference the global symbol "_end" so that ld(1) will define it for us. 43: */ 44: .globl _end 45: 46: sup = 40000 /* current supervisor previous kernel */ 47: br4 = 200 /* PS interrupt priority masks */ 48: br5 = 240 49: br6 = 300 50: br7 = 340 51: 52: 53: #ifdef KERN_NONSEP 54: .text /* vectors at text zero */ 55: #else 56: .data /* vectors at data zero */ 57: #endif 58: 59: ZERO: 60: #define SETDOT(n) . = ZERO+n 61: #define TRAP(handler, pri) .globl handler; handler; pri; 62: #define DEVTRAP(vec, handler, pri) SETDOT(vec); handler; pri; 63: 64: 65: SETDOT(0) 66: #ifdef KERN_NONSEP 67: /* 68: * If vectors at 110 and 444 are unused, autoconfig will set these 69: * to something more reasonable. On jump, this will branch to 112, 70: * which branches to 50. On trap, will vector to 444, where a 71: * T_ZEROTRAP will be simulated. 72: */ 73: 42 /* illegal instruction if jump */ 74: 777 /* trace trap at high priority if trap */ 75: #else 76: TRAP(trap, br7+T_ZEROTRAP) /* trap-to-zero trap */ 77: #endif 78: 79: SETDOT(4) /* trap vectors */ 80: TRAP(trap, br7+T_BUSFLT) /* bus error */ 81: TRAP(trap, br7+T_INSTRAP) /* illegal instruction */ 82: TRAP(trap, br7+T_BPTTRAP) /* bpt-trace trap */ 83: #ifdef INET 84: TRAP(iothndlr, br7+T_IOTTRAP) /* network uses iot */ 85: #else 86: TRAP(trap, br7+T_IOTTRAP) /* iot trap */ 87: #endif 88: TRAP(powrdown, br7+T_POWRFAIL) /* power fail */ 89: TRAP(emt, br7+T_EMTTRAP) /* emulator trap */ 90: TRAP(start, br7+T_SYSCALL) /* system (overlaid by 'syscall') */ 91: 92: #ifdef KERN_NONSEP 93: SETDOT(40) /* manual reboot entry */ 94: jmp do_panic 95: #endif 96: 97: SETDOT(44) /* manual dump entry */ 98: jmp dump 99: 100: #ifdef KERN_NONSEP 101: SETDOT(50) /* handler for jump-to-zero panic. */ 102: mov $zjmp, -(sp) 103: jsr pc, _panic 104: #endif 105: 106: DEVTRAP(60, cnrint, br4) /* KL11 console */ 107: DEVTRAP(64, cnxint, br4) 108: 109: DEVTRAP(100, hardclock, br6) /* KW11-L clock */ 110: 111: #ifdef PROFILE 112: DEVTRAP(104, _sprof, br7) /* KW11-P clock */ 113: #else 114: DEVTRAP(104, hardclock, br6) 115: #endif 116: 117: 118: SETDOT(114) 119: TRAP(trap, br7+T_PARITYFLT) /* 11/70 parity fault */ 120: 121: 122: #if NDE > 0 /* DEUNA */ 123: DEVTRAP(120, deintr, sup|br5) 124: #endif 125: 126: #if NCSS > 0 /* IMP-11A */ 127: DEVTRAP(124, cssrint,sup|br5) 128: /* note that the transmit interrupt vector is up at 274 ... */ 129: #endif 130: 131: #if NDR > 0 /* DR-11W */ 132: DEVTRAP(124, drintr, br5) 133: #endif 134: 135: #if NRAC > 0 /* RQDX? (RX50,RD51/52/53) */ 136: /* UDA50 (RA60/80/81), KLESI (RA25) */ 137: DEVTRAP(154, raintr, br5) 138: #endif 139: 140: #if NRL > 0 /* RL01/02 */ 141: DEVTRAP(160, rlintr, br5) 142: #endif 143: 144: #if NSI > 0 /* SI 9500 -- CDC 9766 disks */ 145: DEVTRAP(170, siintr, br5) 146: #endif 147: 148: #if NHK > 0 /* RK611, RK06/07 */ 149: DEVTRAP(210, hkintr, br5) 150: #endif 151: 152: #if NRK > 0 /* RK05 */ 153: DEVTRAP(220, rkintr, br5) 154: #endif 155: 156: 157: SETDOT(240) 158: TRAP(trap, br7+T_PIRQ) /* program interrupt request */ 159: TRAP(trap, br7+T_ARITHTRAP) /* floating point */ 160: TRAP(trap, br7+T_SEGFLT) /* segmentation violation */ 161: 162: #if NBR > 0 163: DEVTRAP(254, brintr, br5) /* EATON BR1537 or EATON BR1711 */ 164: #endif 165: 166: #if NXPD > 0 /* RM02/03/05, RP04/05/06 */ 167: /* DIVA, SI Eagle */ 168: DEVTRAP(254, xpintr, br5) 169: #endif 170: 171: #if NRX > 0 /* RX01 */ 172: DEVTRAP(264, rxintr, br5) 173: #endif 174: 175: #if NACC > 0 /* ACC LH/DH-11 */ 176: DEVTRAP(270, accrint, sup|br5) 177: DEVTRAP(274, accxint, sup|br5) 178: #endif 179: 180: #if NCSS > 0 /* IMP-11A */ 181: /* note that the receive interrupt vector is down at 124 ... */ 182: DEVTRAP(274, cssxint,sup|br5) 183: #endif 184: 185: #if NIL > 0 /* Interlan Ethernet */ 186: DEVTRAP(340, ilrint, sup|br5) 187: DEVTRAP(344, ilcint, sup|br5) 188: #endif 189: 190: #if NVV > 0 /* V2LNI */ 191: DEVTRAP(350, vvrint, sup|br5) 192: DEVTRAP(354, vvxint, sup|br5) 193: #endif 194: 195: #if NEC > 0 /* 3Com ethernet */ 196: /* 197: * These are almost certainly wrong for any given site since the 198: * 3Com seems to be somewhat randomly configured. Pay particular 199: * attention to the interrupt priority levels: if they're too low 200: * you'll get recursive interrupts; if they're too high you'll lock 201: * out important interrupts (like the clock). 202: */ 203: DEVTRAP(400, ecrint, sup|br6) 204: DEVTRAP(404, eccollide,sup|br4) 205: DEVTRAP(410, ecxint, sup|br6) 206: #endif 207: 208: #if NSRI > 0 /* SRI DR11-C ARPAnet IMP */ 209: DEVTRAP(500, srixint, sup|br5) 210: DEVTRAP(504, srirint, sup|br5) 211: #endif 212: 213: 214: /* 215: * End of floating vectors. Endvec should be past vector space if NONSEP, 216: * should be at least 450. 217: * 218: */ 219: SETDOT(1000) 220: CONST(GLOBAL, endvec, .) 221: 222: /* 223: * The overlay tables are initialized by boot. Ovhndlr, cret and call use 224: * them to perform kernel overlay switches. The tables contain an arrays of 225: * segment addresses and descriptors. Note: don't use SPACE macro as it 226: * allocates it's space in bss, not data space ... 227: */ 228: . = ZERO+OVLY_TABLE_BASE 229: .globl ova, ovd 230: ova: .=.+40 /* overlay addresses */ 231: ovd: .=.+40 /* overlay descriptors */ 232: 233: /* 234: * FLASH! for overlaid programs /boot kindly lets us know where our 235: * load image stops by depositing a value at the end of the overlay tables. 236: * Needless to say this had been clobbering something all along, but the 237: * effect was rather nasty (crash) when the 'last interrupt vector' location 238: * was overwritten! Not sure whether to fix /boot or leave room here, so 239: * for now just add a "pad" word. 240: */ 241: INT(LOCAL, physend, 0) 242: 243: /* 244: * _lastiv is used for assigning vectors to devices which have programmable 245: * vectors. Usage is to decrement _lastiv by 4 before use. The routine 246: * _nextiv (in mch_xxx.s) will do this, returning the assigned vector in r0. 247: */ 248: INT(GLOBAL, _lastiv, endvec) 249: 250: .text 251: TEXTZERO: / base of system program text 252: 253: #ifndef KERN_NONSEP 254: /* 255: * this is text location 0 for separate I/D kernels. 256: */ 257: mov $zjmp,-(sp) 258: jsr pc,_panic 259: /*NOTREACHED*/ 260: #endif 261: 262: STRING(LOCAL, zjmp, <jump to 0\0>) 263: 264: #ifndef KERN_NONSEP 265: /* 266: * Unmap is called from _doboot to turn off memory management. The "return" 267: * is arranged by putting a jmp at unmap+2 (data space). 268: */ 269: ASENTRY(unmap) 270: reset 271: /* 272: * The next instruction executed is from unmap+2 in physical memory, 273: * which is unmap+2 in data space. 274: */ 275: #endif 276: 277: /* 278: * Halt cpu in its tracks ... 279: */ 280: ENTRY(halt) 281: halt 282: /* NOTREACHED */ 283: 284: /* 285: * CGOOD and CBAD are used by autoconfig. All unused vectors are set to CBAD 286: * before probing the devices. 287: */ 288: ASENTRY(CGOOD) 289: mov $1,_conf_int 290: rtt 291: ASENTRY(CBAD) 292: mov $-1,_conf_int 293: rtt 294: 295: /* 296: * Routine to call panic, take dump and reboot; entered by manually loading 297: * the PC with 040 and continuing. Note that putting this here is calculated 298: * to waste as little text space as possible for separate I&D kernels. 299: * Currently the zero jmp, unmap, halt, CGOOD, and CBAD routines leave the 300: * separate I&D assembly counter at 034, so the ". = 40" below only wastes 301: * 4 bytes. This is safe since any attempt to set the assembly counter back 302: * will cause an error indicating that the assembly counter is higher than 303: * 040 meaning things need to be rearranged ... 304: */ 305: #ifndef KERN_NONSEP 306: . = TEXTZERO+040 307: #endif 308: 309: do_panic: 310: mov $1f,-(sp) 311: STRING(LOCAL, 1, <forced from console\0>) 312: jsr pc, _panic 313: /* NOTREACHED */ 314: 315: 316: /* 317: * Start of locore interrupt entry thunks. 318: */ 319: #define HANDLER(handler) .globl _/**/handler; \ 320: handler: jsr r0,call; jmp _/**/handler 321: 322: HANDLER(cnrint) /* KL-11, DL-11 */ / cnrint: jsr r0,call; jmp _cnrint 323: HANDLER(cnxint) / cnxint: jsr r0,call; jmp _cnxint 324: 325: HANDLER(hardclock) / hardclock: jsr r0,call; jmp _hardclock 326: 327: #if NDR > 0 /* DR-11W */ 328: HANDLER(drintr) / drintr: jsr r0,call; jmp _drintr 329: #endif 330: 331: #if NRAC > 0 /* RQDX? (RX50,RD51/52/53) */ 332: HANDLER(raintr) /* UDA50 (RA60/80/81), KLESI (RA25) */ / raintr: jsr r0,call; jmp _raintr 333: #endif 334: 335: #if NRL > 0 /* RL01/02 */ 336: HANDLER(rlintr) / rlintr: jsr r0,call; jmp _rlintr 337: #endif 338: 339: #if NSI > 0 /* SI 9500 -- CDC 9766 disks */ 340: HANDLER(siintr) / siintr: jsr r0,call; jmp _siintr 341: #endif 342: 343: #if NLP > 0 /* Line Printer */ 344: HANDLER(lpintr) / lpintr: jsr r0,call; jmp _lpintr 345: #endif 346: 347: #if NHK > 0 /* RK611, RK06/07 */ 348: HANDLER(hkintr) / hkintr: jsr r0,call; jmp _hkintr 349: #endif 350: 351: #if NRK > 0 /* RK05 */ 352: HANDLER(rkintr) / rkintr: jsr r0,call; jmp _rkintr 353: #endif 354: 355: #if NBR > 0 356: HANDLER(brintr) /* EATON BR1537/BR1711 */ / brintr: jsr r0,call; jmp _brintr 357: #endif 358: 359: #if NXPD > 0 /* RM02/03/05, RP04/05/06 */ 360: HANDLER(xpintr) /* DIVA, SI Eagle */ / xpintr: jsr r0,call; jmp _xpintr 361: #endif 362: 363: #if NRX > 0 /* RX01/02 */ 364: HANDLER(rxintr) / rxintr: jsr r0,call; jmp _rxintr 365: #endif 366: 367: #if NHT > 0 /* TJU77, TWU77, TJE16, TWE16 */ 368: HANDLER(htintr) / htintr: jsr r0,call; jmp _htintr 369: #endif 370: 371: #if NTM > 0 /* TM-11 */ 372: HANDLER(tmintr) / tmintr: jsr r0,call; jmp _tmintr 373: #endif 374: 375: #if NTS > 0 /* TS-11 */ 376: HANDLER(tsintr) / tsintr: jsr r0,call; jmp _tsintr 377: #endif 378: 379: #if NTMSCP > 0 380: HANDLER(tmsintr) /* TMSCP (TU81/TK50) */ / tmsintr: jsr r0,call; jmp _tmsintr 381: #endif 382: 383: #if NDH > 0 /* DH-11 */ 384: HANDLER(dhrint) / dhrint: jsr r0,call; jmp _dhrint 385: HANDLER(dhxint) / dhxint: jsr r0,call; jmp _dhxint 386: #endif 387: 388: #if NDM > 0 /* DM-11 */ 389: HANDLER(dmintr) / dmintr: jsr r0,call; jmp _dmintr 390: #endif 391: 392: #if NDHU > 0 /* DHU */ 393: HANDLER(dhurint) / dhurint: jsr r0,call; jmp _dhurint 394: HANDLER(dhuxint) / dhuxint: jsr r0,call; jmp _dhuxint 395: #endif 396: 397: #if NDHV > 0 /* DHV */ 398: HANDLER(dhvrint) / dhvrint: jsr r0,call; jmp _dhvrint 399: HANDLER(dhvxint) / dhvxint: jsr r0,call; jmp _dhvxint 400: #endif 401: 402: #if NDN > 0 /* DN11 */ 403: HANDLER(dnint) / dnint: jsr r0,call; jmp _dnint 404: #endif 405: 406: #if NDZ > 0 /* DZ */ 407: HANDLER(dzrint) / dzrint: jsr r0,call; jmp _dzrint 408: #endif