Commit | Line | Data |
---|---|---|
05e3da35 KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Computer Consoles Inc. | |
7 | * | |
8 | * %sccs.include.proprietary.c% | |
9 | * | |
10 | * @(#)srt0.c 7.2 (Berkeley) %G% | |
11 | */ | |
1e1f58c3 | 12 | |
b28b3a13 | 13 | #include "../include/mtpr.h" |
1e1f58c3 SL |
14 | #define LOCORE |
15 | ||
16 | /* | |
17 | * Startup code for standalone system | |
18 | */ | |
19 | ||
20 | .globl _end | |
1e1f58c3 SL |
21 | .globl _main |
22 | .globl __rtt | |
7a87c7c5 | 23 | .globl _firstopen |
1e1f58c3 | 24 | .globl _start |
f0239511 MK |
25 | .globl _boothowto |
26 | .globl _bootdev | |
1e1f58c3 SL |
27 | |
28 | .set HIGH,31 # mask for total disable | |
29 | ||
947ad8db SL |
30 | #ifndef REL |
31 | .globl _device_space | |
32 | _device_space: # Tapemaster config block, etc. | |
33 | .space 0x1000-RELOC | |
34 | ||
8de65f23 MK |
35 | .globl _entry |
36 | _entry: | |
1e1f58c3 SL |
37 | .word 0x00 # 'call' by relsrt0. |
38 | #endif | |
39 | _start: | |
40 | mtpr $HIGH,$IPL # just in case | |
8de65f23 | 41 | #ifdef REL |
947ad8db | 42 | movl $BOOTRELOC,sp |
ae12cb14 | 43 | |
947ad8db SL |
44 | movl $RELOC,r0 /* source address to copy from */ |
45 | movl $BOOTRELOC,r1 /* destination address */ | |
600e8234 | 46 | movl tdlen,r2 /* length to copy */ |
ae12cb14 BJ |
47 | addl2 r2,r0 |
48 | addl2 r2,r1 | |
1e1f58c3 | 49 | mvloop: |
ae12cb14 BJ |
50 | decl r0 |
51 | decl r1 | |
1e1f58c3 | 52 | movb (r0),(r1) |
1e1f58c3 | 53 | decl r2 |
ae12cb14 BJ |
54 | bgeq mvloop |
55 | ||
8de65f23 MK |
56 | /* |
57 | * zero bss | |
58 | */ | |
600e8234 MK |
59 | movl aedata,r1 /* destination address */ |
60 | subl3 $_edata,$_end,r2 /* length to zero */ | |
8de65f23 MK |
61 | zloop: |
62 | movb $0,(r1) | |
63 | incl r1 | |
64 | decl r2 | |
65 | bgeq zloop | |
66 | ||
600e8234 MK |
67 | mtpr $1,$PACC |
68 | mtpr $1,$PADC | |
1e1f58c3 | 69 | jmp *abegin |
8de65f23 | 70 | #endif |
ae12cb14 | 71 | |
1e1f58c3 | 72 | begin: |
8de65f23 | 73 | movl fp,ofp |
f0239511 MK |
74 | movl r11,_boothowto |
75 | movl r10,_bootdev | |
7a87c7c5 | 76 | movl $1,_firstopen |
1e1f58c3 | 77 | callf $4,_main |
8de65f23 MK |
78 | #ifdef REL |
79 | halt | |
80 | #endif | |
81 | ret | |
1e1f58c3 SL |
82 | |
83 | __rtt: | |
84 | .word 0x0 | |
8de65f23 MK |
85 | #ifdef REL |
86 | halt | |
87 | #endif | |
88 | movl ofp,fp | |
89 | ret | |
1e1f58c3 SL |
90 | |
91 | .data | |
92 | abegin: .long begin | |
947ad8db | 93 | #ifdef REL |
600e8234 MK |
94 | aedata: .long _edata |
95 | tdlen: .long _edata-BOOTRELOC | |
947ad8db | 96 | #endif |
8de65f23 | 97 | ofp: .long 0 |
f0239511 MK |
98 | _boothowto: .long 0 |
99 | _bootdev: .long 0 |