xref: /csrg-svn/sys/tahoe/stand/srt0.c (revision 29955)
1 /*	srt0.c	1.3	86/11/03	*/
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 	.globl	_entry
19 _entry:
20 #ifndef	REL
21 	.word	0x00			# 'call' by relsrt0.
22 #endif
23 _start:
24 	mtpr	$HIGH,$IPL		# just in case
25 #ifdef REL
26 	movl	$RELOC,sp
27 
28 	movl	$0x800,r0	/* source address to copy from */
29 	movl	$RELOC,r1	/* destination address */
30 	movl	aedata,r2	/* length to copy */
31 	addl2	r2,r0
32 	addl2	r2,r1
33 mvloop:
34 	decl	r0
35 	decl	r1
36 	movb	(r0),(r1)
37 	decl	r2
38 	bgeq	mvloop
39 
40 /*
41  * zero bss
42  */
43 	movab	_edata,r1	/* destination address */
44 	subl3	aend,aedata,r2	/* length to zero */
45 zloop:
46 	movb	$0,(r1)
47 	incl	r1
48 	decl	r2
49 	bgeq	zloop
50 
51 	mtpr	$0,$PACC
52 	jmp	*abegin
53 #endif
54 
55 begin:
56 	movl	fp,ofp
57 	movl	$1,_openfirst
58 	callf	$4,_main
59 #ifdef REL
60 	halt
61 #endif
62 	ret
63 
64 __rtt:
65 	.word	0x0
66 #ifdef REL
67 	halt
68 #endif
69 	movl	ofp,fp
70 	ret
71 
72 	.data
73 abegin:	.long	begin
74 aend:	.long	_end-RELOC
75 aedata:	.long	_edata-RELOC
76 ofp:	.long	0
77