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