xref: /csrg-svn/sys/vax/stand/srt0.c (revision 14279)
1 /*	srt0.c	6.1	83/07/29	*/
2 
3 #include "../vax/mtpr.h"
4 #define	LOCORE
5 #include "../vax/cpu.h"
6 
7 /*
8  * Startup code for standalone system
9  * Non-relocating version -- for programs which are loaded by boot
10  */
11 
12 	.globl	_end
13 	.globl	_edata
14 	.globl	_main
15 	.globl	__rtt
16 	.globl	_configure
17 	.globl	_cpu
18 	.globl	_openfirst
19 
20 	.set	HIGH,31		# mask for total disable
21 
22 entry:	.globl	entry
23 	.word	0x0
24 	mtpr	$HIGH,$IPL		# just in case
25 #ifdef REL
26 	movl	$RELOC,sp
27 #else
28 	movl	$RELOC-0x2400,sp
29 #endif
30 start:
31 	movl	aedata,r0
32 clr:
33 	clrl	(r0)+
34 	cmpl	r0,sp
35 	jlss	clr
36 #ifdef REL
37 	movc3	aedata,*$0,(sp)
38 /*
39  * Reclear bss segment separately from text and data
40  * since movc3 can't move more than 64K bytes
41  */
42 dclr:
43 	clrl	(r3)+
44 	cmpl	r3,$_end
45 	jlss	dclr
46 /* this loop shouldn't be necessary, but is when booting from an ra81 */
47 xclr:
48 	clrl	(r3)+
49 	cmpl	r3,$0x100000
50 	jlss	xclr
51 	jmp	*abegin
52 begin:
53 #endif
54 	mtpr	$0,$SCBB
55 	calls	$0,_configure
56 	movl	$1,_openfirst
57 	calls	$0,_main
58 #ifndef TP
59 	jmp	start
60 #else
61 	ret
62 #endif
63 
64 	.data
65 #ifdef REL
66 abegin:	.long	begin
67 aedata:	.long	_edata-RELOC
68 #else
69 aedata:	.long	_edata
70 #endif
71 
72 __rtt:
73 	.word	0x0
74 	jmp	start
75 
76 	.globl	_badloc
77 _badloc:
78 	.word	0
79 	movl	$1,r0
80 	movl	4(ap),r3
81 	movl	$4,r2
82 	movab	9f,(r2)
83 	tstl	(r3)
84 1:	clrl	r0			# made it w/o machine checks
85 2:	movl	$4,r2
86 	clrl	(r2)
87 	ret
88 	.align	2
89 9:
90 	casel	_cpu,$1,$VAX_MAX
91 0:
92 	.word	8f-0b		# 1 is 780
93 	.word	5f-0b		# 2 is 750
94 	.word	5f-0b		# 3 is 730
95 5:
96 	mtpr	$0xf,$MCESR
97 	brb	1f
98 8:
99 	mtpr	$0,$SBIFS
100 1:
101 	addl2	(sp)+,sp		# discard mchchk trash
102 	movab	2b,(sp)
103 	rei
104