Commit | Line | Data |
---|---|---|
8de65f23 | 1 | /* srt0.c 1.3 86/11/03 */ |
1e1f58c3 SL |
2 | |
3 | #include "../machine/mtpr.h" | |
4 | #define LOCORE | |
5 | ||
6 | /* | |
7 | * Startup code for standalone system | |
8 | */ | |
9 | ||
10 | .globl _end | |
1e1f58c3 SL |
11 | .globl _main |
12 | .globl __rtt | |
13 | .globl _openfirst | |
14 | .globl _start | |
15 | ||
16 | .set HIGH,31 # mask for total disable | |
17 | ||
8de65f23 MK |
18 | .globl _entry |
19 | _entry: | |
1e1f58c3 SL |
20 | #ifndef REL |
21 | .word 0x00 # 'call' by relsrt0. | |
22 | #endif | |
23 | _start: | |
24 | mtpr $HIGH,$IPL # just in case | |
8de65f23 | 25 | #ifdef REL |
1e1f58c3 | 26 | movl $RELOC,sp |
ae12cb14 | 27 | |
1e1f58c3 SL |
28 | movl $0x800,r0 /* source address to copy from */ |
29 | movl $RELOC,r1 /* destination address */ | |
8de65f23 | 30 | movl aedata,r2 /* length to copy */ |
ae12cb14 BJ |
31 | addl2 r2,r0 |
32 | addl2 r2,r1 | |
1e1f58c3 | 33 | mvloop: |
ae12cb14 BJ |
34 | decl r0 |
35 | decl r1 | |
1e1f58c3 | 36 | movb (r0),(r1) |
1e1f58c3 | 37 | decl r2 |
ae12cb14 BJ |
38 | bgeq mvloop |
39 | ||
8de65f23 MK |
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 | ||
1e1f58c3 | 51 | mtpr $0,$PACC |
1e1f58c3 | 52 | jmp *abegin |
8de65f23 | 53 | #endif |
ae12cb14 | 54 | |
1e1f58c3 | 55 | begin: |
8de65f23 | 56 | movl fp,ofp |
1e1f58c3 SL |
57 | movl $1,_openfirst |
58 | callf $4,_main | |
8de65f23 MK |
59 | #ifdef REL |
60 | halt | |
61 | #endif | |
62 | ret | |
1e1f58c3 SL |
63 | |
64 | __rtt: | |
65 | .word 0x0 | |
8de65f23 MK |
66 | #ifdef REL |
67 | halt | |
68 | #endif | |
69 | movl ofp,fp | |
70 | ret | |
1e1f58c3 SL |
71 | |
72 | .data | |
73 | abegin: .long begin | |
8de65f23 MK |
74 | aend: .long _end-RELOC |
75 | aedata: .long _edata-RELOC | |
76 | ofp: .long 0 |