xref: /csrg-svn/sys/vax/stand/srt0.c (revision 30547)
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.2 (Berkeley) 02/21/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 
27 	.set	HIGH,31		# mask for total disable
28 
29 entry:	.globl	entry
30 	.word	0x0
31 	mtpr	$HIGH,$IPL		# just in case
32 #ifdef REL
33 	movl	$RELOC,sp
34 #else
35 	movl	$RELOC-0x2400,sp
36 #endif
37 start:
38 	movl	aedata,r0
39 clr:
40 	clrl	(r0)+
41 	cmpl	r0,sp
42 	jlss	clr
43 #ifdef REL
44 	movc3	aedata,*$0,(sp)
45 /*
46  * Reclear bss segment separately from text and data
47  * since movc3 can't move more than 64K bytes
48  */
49 dclr:
50 	clrl	(r3)+
51 	cmpl	r3,$_end
52 	jlss	dclr
53 /* this loop shouldn't be necessary, but is when booting from an ra81 */
54 xclr:
55 	clrl	(r3)+
56 	cmpl	r3,$0x100000
57 	jlss	xclr
58 	jmp	*abegin
59 begin:
60 #endif
61 	mtpr	$0,$SCBB
62 	calls	$0,_configure
63 	movl	$1,_openfirst
64 	calls	$0,_main
65 #ifndef TP
66 	jmp	start
67 #else
68 	ret
69 #endif
70 
71 	.data
72 #ifdef REL
73 abegin:	.long	begin
74 aedata:	.long	_edata-RELOC
75 #else
76 aedata:	.long	_edata
77 #endif
78 
79 __rtt:
80 	.word	0x0
81 #ifdef	REL
82 	halt
83 #else
84 	jmp	start
85 #endif
86 
87 	.globl	_badaddr
88 _badaddr:
89 	.word	0
90 	movl	$1,r0
91 	movl	4(ap),r3
92 	movl	8(ap),r4
93 	movl	$4,r2
94 	movab	9f,(r2)
95 	bbc	$0,r4,1f; tstb	(r3)
96 1:	bbc	$1,r4,1f; tstw	(r3)
97 1:	bbc	$2,r4,1f; tstl	(r3)
98 1:	clrl	r0			# made it w/o machine checks
99 2:	movl	$4,r2
100 	clrl	(r2)
101 	ret
102 	.align	2
103 9:
104 	casel	_cpu,$1,$VAX_MAX
105 0:
106 	.word	8f-0b		# 1 is 780
107 	.word	5f-0b		# 2 is 750
108 	.word	5f-0b		# 3 is 730
109 	.word	6f-0b		# 4 is 8600
110 5:
111 	mtpr	$0xf,$MCESR
112 	brb	1f
113 6:
114 	mtpr	$0,$EHSR
115 	brb	1f
116 8:
117 	mtpr	$0,$SBIFS
118 1:
119 	addl2	(sp)+,sp		# discard mchchk trash
120 	movab	2b,(sp)
121 	rei
122