xref: /csrg-svn/sys/tahoe/stand/srt0.c (revision 25870)
1*25870Ssam /*	srt0.c	1.1	86/01/12	*/
2*25870Ssam /*	srt0.c	4.8	81/04/03	*/
3*25870Ssam /*  Tahoe version.	82/11/09	*/
4*25870Ssam 
5*25870Ssam #include "../machine/mtpr.h"
6*25870Ssam #define	LOCORE
7*25870Ssam 
8*25870Ssam /*
9*25870Ssam  * Startup code for standalone system
10*25870Ssam  */
11*25870Ssam 
12*25870Ssam 	.globl	_end
13*25870Ssam 	.globl	_edata
14*25870Ssam 	.globl	_main
15*25870Ssam 	.globl	__rtt
16*25870Ssam 	.globl	_openfirst
17*25870Ssam 	.globl	_start
18*25870Ssam 
19*25870Ssam 	.set	HIGH,31		# mask for total disable
20*25870Ssam 
21*25870Ssam #ifndef	REL
22*25870Ssam 	.word	0x00			# 'call' by relsrt0.
23*25870Ssam #endif
24*25870Ssam _start:
25*25870Ssam 	mtpr	$HIGH,$IPL		# just in case
26*25870Ssam 	movl	$(RELOC),sp
27*25870Ssam 	movl	$RELOC,r0
28*25870Ssam 	subl2	aedata,r0
29*25870Ssam 	shar	$2,r0,r0
30*25870Ssam 	clrl	r1		/* used to clear the memory */
31*25870Ssam clr:
32*25870Ssam 	pushl	r1
33*25870Ssam 	decl	r0		/* decrement counter */
34*25870Ssam 	jgeq	clr		/* more to clear */
35*25870Ssam 
36*25870Ssam 	movl	$RELOC,sp
37*25870Ssam 	movl	$0x800,r0	/* source address to copy from */
38*25870Ssam 	movl	$RELOC,r1	/* destination address */
39*25870Ssam 	movl	aend,r2		/* length */
40*25870Ssam 	subl2	$0x800,r2
41*25870Ssam  #	movblk
42*25870Ssam  # simple loop replaces movblk - until hardware people are ready
43*25870Ssam mvloop:
44*25870Ssam 	movb	(r0),(r1)
45*25870Ssam 	incl	r0
46*25870Ssam 	incl	r1
47*25870Ssam 	decl	r2
48*25870Ssam 	bneq	mvloop
49*25870Ssam 	.globl	goup
50*25870Ssam 	mtpr	$0,$PACC
51*25870Ssam jumphigh:
52*25870Ssam 	.set	goup,jumphigh+0x800-RELOC
53*25870Ssam 	jmp	*abegin
54*25870Ssam begin:
55*25870Ssam 	movl	$1,_openfirst
56*25870Ssam 	callf	$4,_main
57*25870Ssam 	jmp	begin
58*25870Ssam 
59*25870Ssam __rtt:
60*25870Ssam 	.word	0x0
61*25870Ssam 	jmp	begin
62*25870Ssam 
63*25870Ssam 	.data
64*25870Ssam abegin:	.long	begin
65*25870Ssam aend:	.long	_end-RELOC+0x800
66*25870Ssam aedata:	.long	_edata-RELOC+0x800
67*25870Ssam 	.globl	_entry
68*25870Ssam 	.set	_entry,0x800
69