|
|
1.1 root 1: /* startup.s - start */
2:
3: #include <procreg.h>
4: #include <conf.h>
5: #include <kernel.h>
6: #include <mach.h>
7:
8: #define PSLDISAB 0x001f0000 /* initial PSL -- interrupts */
9: /* disabled, on kernel stack, */
10: /* kernel mode */
11:
12: /*----------------------------------------------------------------------------
13: * Xinu system entry point -- first location beyond interrupt vectors
14: * assumption: processor is in kernel mode on entry
15: *----------------------------------------------------------------------------
16: */
17: .text
18: .globl start
19: .globl _restart
20: start: /* boot utility entry pt */
21: _restart: /* shell reboot cmd entry pt */
22: nop; nop /* == .word 0x0101; can jmp to */
23: /* start or calls $0, start */
24: mtpr $DISABLE, $IPL /* disable interrupts */
25: #if defined(VAX750) || defined(VAX730) || defined(VAX725) || \
26: defined(UVAX)
27: mtpr $IURSET, $IUR /* reset the bus */
28: mtpr $IURUNSET, $IUR /* unreset the bus */
29: #endif
30: mtpr $intstk, $ISP /* interrupt stack given memory */
31: mtpr $NOMAP, $MAPEN /* disable memory management */
32: movab _end, r2 /* zero out bss (just in case) */
33: movab _edata, r1
34: clrbss:
35: clrb (r1)+
36: cmpl r1, r2 /* more bss to zero? */
37: jlssu clrbss /* yes => back to clrbss */
38: mtpr $lowcore, $SCBB /* sys ctrl blck pts to vectors */
39: mtpr _nullpcb, $PCBB /* PCBB points to null process' */
40: /* process control block entry */
41: /* in proctab[] */
42: /* set up nulluser's proc ctrl */
43: movl _nullpcb, r1 /* block--init all general reg */
44: addl3 $72, r1, r0 /* clear fp first, then r12-r0 */
45: pcbloop: /* then 4 stack pointers */
46: clrl -(r0)
47: cmpl r0, r1
48: jgtru pcbloop
49: moval kernstk, (r0) /* stack pointer given memory-- */
50: /* kernstk used for now */
51: movab pcbcont, 72(r0) /* PC points to pcbcont */
52: movl $PSLDISAB, 76(r0) /* initial psl, interrupts */
53: /* disabled, on kernel stack */
54: movl $INITBR, 80(r0) /* set P0BR */
55: movl $INITLR, 84(r0) /* AST lvl set to none pending, */
56: /* P0LR set to 0 */
57: movl $INITBR, 88(r0) /* set P1BR */
58: clrl 92(r0) /* set P1LR */
59: ldpctx /* load new context */
60: rei /* resume at pcbcont */
61: pcbcont: /* set all pertinent internal */
62: /* processor registers */
63: /* (it may not be necessary */
64: /* to set all of these) */
65: /* (r0 is now 0) */
66: mtpr r0, $SISR /* clear software intrpt summary*/
67: mtpr r0, $ICCS /* clear interval clock csr */
68: mtpr r0, $RXCS /* clr cons recv intrrpt enable */
69: mfpr $SID, r1 /* get system id register value */
70: bicl2 $SYSTYPE, r1 /* mask off system id */
71: movl r1, _machinesid /* move machine system id */
72: mfpr $RXDB, r1 /* clear incoming byte if any */
73: mtpr r0, $TXCS /* clear cons trans int enable */
74: #if defined(VAX750) || defined(VAX730) || defined(VAX725) || \
75: defined(UVAX)
76: mtpr $3, $TBDR /* disable translation buffer */
77: mtpr $MCESRCLR, $MCESR /* clear machine check error reg*/
78: mtpr r0, $CAER /* clear cache error register */
79: mtpr r0, $CADR /* enable cache */
80: #endif
81: #if defined(VAX780) || defined(VAX785)
82: mtpr r0, $SBIFS /* clear SBI fault and status */
83: mtpr r0, $SBIER /* clear SBI error register */
84: #endif
85: #if defined(VAX8600)
86: mtpr $0, $EHSR /* clear error handling status */
87: #endif
88: mtpr r0, $TBIA /* clear trans buffer inval all */
89: calls $0, sizmem /* _maxaddr set to max address */
90: movl _maxaddr, sp /* switch stack to high memory */
91: calls $0, _nulluser /* Run C startup routine */
92: /* nulluser should never return */
93: pushab errmes /* trap return to startup */
94: calls $1, _kprintf
95: jmp __halt
96:
97: .data 1
98: errmes:
99: .ascii "error--nulluser returned to startup\n\0"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.