xref: /csrg-svn/sys/tahoe/stand/srt0.c (revision 30313)
1 /*	srt0.c	1.4	86/12/19	*/
2 
3 #include "../machine/mtpr.h"
4 #define	LOCORE
5 
6 /*
7  * Startup code for standalone system
8  */
9 
10 	.globl	_end
11 	.globl	_main
12 	.globl	__rtt
13 	.globl	_openfirst
14 	.globl	_start
15 
16 	.set	HIGH,31		# mask for total disable
17 
18 #ifndef	REL
19 	.globl	_device_space
20 _device_space:			# Tapemaster config block, etc.
21 	.space	0x1000-RELOC
22 
23 	.globl	_entry
24 _entry:
25 	.word	0x00			# 'call' by relsrt0.
26 #endif
27 _start:
28 	mtpr	$HIGH,$IPL		# just in case
29 #ifdef REL
30 	movl	$BOOTRELOC,sp
31 
32 	movl	$RELOC,r0	/* source address to copy from */
33 	movl	$BOOTRELOC,r1	/* destination address */
34 	movl	aedata,r2	/* length to copy */
35 	addl2	r2,r0
36 	addl2	r2,r1
37 mvloop:
38 	decl	r0
39 	decl	r1
40 	movb	(r0),(r1)
41 	decl	r2
42 	bgeq	mvloop
43 
44 /*
45  * zero bss
46  */
47 	movab	_edata,r1	/* destination address */
48 	subl3	aend,aedata,r2	/* length to zero */
49 zloop:
50 	movb	$0,(r1)
51 	incl	r1
52 	decl	r2
53 	bgeq	zloop
54 
55 	mtpr	$0,$PACC
56 	mtpr	$0,$PADC
57 	jmp	*abegin
58 #endif
59 
60 begin:
61 	movl	fp,ofp
62 	movl	$1,_openfirst
63 	callf	$4,_main
64 #ifdef REL
65 	halt
66 #endif
67 	ret
68 
69 __rtt:
70 	.word	0x0
71 #ifdef REL
72 	halt
73 #endif
74 	movl	ofp,fp
75 	ret
76 
77 	.data
78 abegin:	.long	begin
79 #ifdef REL
80 aend:	.long	_end-BOOTRELOC
81 aedata:	.long	_edata-BOOTRELOC
82 #else
83 aend:	.long	_end-RELOC
84 aedata:	.long	_edata-RELOC
85 #endif
86 ofp:	.long	0
87