1 /* 2 * Copyright (c) 1982, 1986 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 * @(#)srt0.c 7.3 (Berkeley) 04/02/87 7 */ 8 9 #include "../vax/mtpr.h" 10 #define LOCORE 11 #include "../vax/cpu.h" 12 13 /* 14 * Startup code for standalone system 15 * Non-relocating version -- for programs which are loaded by boot 16 * Relocating version for boot* 17 */ 18 19 .globl _end 20 .globl _edata 21 .globl _main 22 .globl __rtt 23 .globl _configure 24 .globl _cpu 25 .globl _openfirst 26 .globl _boothowto 27 .globl _bootdev 28 29 .set HIGH,31 # mask for total disable 30 31 entry: .globl entry 32 .word 0x0 33 mtpr $HIGH,$IPL # just in case 34 #ifdef REL 35 movl $RELOC,sp 36 #else 37 movl $RELOC-0x2400,sp 38 #endif 39 start: 40 movl aedata,r0 41 clr: 42 clrl (r0)+ 43 cmpl r0,sp 44 jlss clr 45 #ifdef REL 46 movc3 aedata,*$0,(sp) 47 /* 48 * Reclear bss segment separately from text and data 49 * since movc3 can't move more than 64K bytes 50 */ 51 dclr: 52 clrl (r3)+ 53 cmpl r3,$_end 54 jlss dclr 55 /* this loop shouldn't be necessary, but is when booting from an ra81 */ 56 xclr: 57 clrl (r3)+ 58 cmpl r3,$0x100000 59 jlss xclr 60 jmp *abegin 61 begin: 62 #endif 63 movl r11,_boothowto 64 movl r10,_bootdev 65 again: 66 mtpr $0,$SCBB 67 calls $0,_configure 68 movl $1,_openfirst 69 calls $0,_main 70 #ifdef REL 71 jmp again 72 #else 73 ret 74 #endif 75 76 .data 77 #ifdef REL 78 abegin: .long begin 79 aedata: .long _edata-RELOC 80 #else 81 aedata: .long _edata 82 #endif 83 _bootdev: .long 0 84 _boothowto: .long 0 85 .text 86 87 __rtt: 88 .word 0x0 89 #ifdef REL 90 halt 91 #else 92 jmp start 93 #endif 94 95 .globl _badaddr 96 _badaddr: 97 .word 0 98 movl $1,r0 99 movl 4(ap),r3 100 movl 8(ap),r4 101 movl $4,r2 102 movab 9f,(r2) 103 bbc $0,r4,1f; tstb (r3) 104 1: bbc $1,r4,1f; tstw (r3) 105 1: bbc $2,r4,1f; tstl (r3) 106 1: clrl r0 # made it w/o machine checks 107 2: movl $4,r2 108 clrl (r2) 109 ret 110 .align 2 111 9: 112 casel _cpu,$1,$VAX_MAX 113 0: 114 .word 8f-0b # 1 is 780 115 .word 5f-0b # 2 is 750 116 .word 5f-0b # 3 is 730 117 .word 6f-0b # 4 is 8600 118 5: 119 mtpr $0xf,$MCESR 120 brb 1f 121 6: 122 mtpr $0,$EHSR 123 brb 1f 124 8: 125 mtpr $0,$SBIFS 126 1: 127 addl2 (sp)+,sp # discard mchchk trash 128 movab 2b,(sp) 129 rei 130