| 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 | */ |
| 12 | |
| 13 | #include "../include/mtpr.h" |
| 14 | #define LOCORE |
| 15 | |
| 16 | /* |
| 17 | * Startup code for standalone system |
| 18 | */ |
| 19 | |
| 20 | .globl _end |
| 21 | .globl _main |
| 22 | .globl __rtt |
| 23 | .globl _firstopen |
| 24 | .globl _start |
| 25 | .globl _boothowto |
| 26 | .globl _bootdev |
| 27 | |
| 28 | .set HIGH,31 # mask for total disable |
| 29 | |
| 30 | #ifndef REL |
| 31 | .globl _device_space |
| 32 | _device_space: # Tapemaster config block, etc. |
| 33 | .space 0x1000-RELOC |
| 34 | |
| 35 | .globl _entry |
| 36 | _entry: |
| 37 | .word 0x00 # 'call' by relsrt0. |
| 38 | #endif |
| 39 | _start: |
| 40 | mtpr $HIGH,$IPL # just in case |
| 41 | #ifdef REL |
| 42 | movl $BOOTRELOC,sp |
| 43 | |
| 44 | movl $RELOC,r0 /* source address to copy from */ |
| 45 | movl $BOOTRELOC,r1 /* destination address */ |
| 46 | movl tdlen,r2 /* length to copy */ |
| 47 | addl2 r2,r0 |
| 48 | addl2 r2,r1 |
| 49 | mvloop: |
| 50 | decl r0 |
| 51 | decl r1 |
| 52 | movb (r0),(r1) |
| 53 | decl r2 |
| 54 | bgeq mvloop |
| 55 | |
| 56 | /* |
| 57 | * zero bss |
| 58 | */ |
| 59 | movl aedata,r1 /* destination address */ |
| 60 | subl3 $_edata,$_end,r2 /* length to zero */ |
| 61 | zloop: |
| 62 | movb $0,(r1) |
| 63 | incl r1 |
| 64 | decl r2 |
| 65 | bgeq zloop |
| 66 | |
| 67 | mtpr $1,$PACC |
| 68 | mtpr $1,$PADC |
| 69 | jmp *abegin |
| 70 | #endif |
| 71 | |
| 72 | begin: |
| 73 | movl fp,ofp |
| 74 | movl r11,_boothowto |
| 75 | movl r10,_bootdev |
| 76 | movl $1,_firstopen |
| 77 | callf $4,_main |
| 78 | #ifdef REL |
| 79 | halt |
| 80 | #endif |
| 81 | ret |
| 82 | |
| 83 | __rtt: |
| 84 | .word 0x0 |
| 85 | #ifdef REL |
| 86 | halt |
| 87 | #endif |
| 88 | movl ofp,fp |
| 89 | ret |
| 90 | |
| 91 | .data |
| 92 | abegin: .long begin |
| 93 | #ifdef REL |
| 94 | aedata: .long _edata |
| 95 | tdlen: .long _edata-BOOTRELOC |
| 96 | #endif |
| 97 | ofp: .long 0 |
| 98 | _boothowto: .long 0 |
| 99 | _bootdev: .long 0 |