Annotation of sys/arch/landisk/stand/xxboot/xxboot.S, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: xxboot.S,v 1.1 2006/11/08 17:46:56 deraadt Exp $ */
! 2: /* $NetBSD: xxboot.S,v 1.1 2006/09/01 21:26:19 uwe Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 2005 NONAKA Kimihiro
! 6: * All rights reserved.
! 7: *
! 8: * Redistribution and use in source and binary forms, with or without
! 9: * modification, are permitted provided that the following conditions
! 10: * are met:
! 11: * 1. Redistributions of source code must retain the above copyright
! 12: * notice, this list of conditions and the following disclaimer.
! 13: * 2. Redistributions in binary form must reproduce the above copyright
! 14: * notice, this list of conditions and the following disclaimer in the
! 15: * documentation and/or other materials provided with the distribution.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: */
! 29:
! 30: #include <machine/asm.h>
! 31:
! 32: ENTRY(xxboot_start)
! 33: bra xxboot_start1
! 34: nop
! 35: .balign 4
! 36: ENTRY(xxboot_magic)
! 37: .long 0x20031125
! 38: boot_params:
! 39: .long 1f - boot_params
! 40:
! 41: . = xxboot_start + 0x80
! 42: xxboot_start1:
! 43: mov.l .L._end, r0 /* zero bss */
! 44: mov.l .L.__bss_start, r1
! 45: sub r1, r0
! 46: shlr2 r0 /* _end and __bss_start are aligned */
! 47: mov #0, r2
! 48: 1: mov.l r2, @r1
! 49: dt r0
! 50: bf/s 1b
! 51: add #4, r1
! 52:
! 53: mov.l .L.2nd_loadaddr, r15 /* new stack pointer */
! 54: mov.l r4, @-r15
! 55: mov.l .L.boot1, r0
! 56: jsr @r0
! 57: mov r15, r4
! 58:
! 59: tst r0, r0
! 60: bf/s boot_fail
! 61: mov.l @r15+, r5 /* pass boot sector to boot */
! 62:
! 63: /* flush cache */
! 64: mov #0, r4
! 65: mov #6, r0
! 66: trapa #0x3f
! 67:
! 68: mov.l .L.2nd_loadaddr, r0
! 69: mov.l .L.boot_params, r4
! 70: jmp @r0
! 71: nop
! 72:
! 73: boot_fail:
! 74: mov r0, r1
! 75: mova .L.errtxt, r0
! 76: mov r0, r4
! 77: mov #32, r0
! 78: trapa #0x3f
! 79: mov r1, r4
! 80: mov #32, r0
! 81: trapa #0x3f
! 82: mova .L.crlf, r0
! 83: mov r0, r4
! 84: mov #32, r0
! 85: trapa #0x3f
! 86: 99: bra 99b
! 87: nop
! 88:
! 89:
! 90: .align 2
! 91: .L._end:
! 92: .long _end
! 93: .L.__bss_start:
! 94: .long __bss_start
! 95: .L.boot1:
! 96: .long _C_LABEL(boot1)
! 97: .L.2nd_loadaddr:
! 98: .long LOADADDRESS
! 99: .L.boot_params:
! 100: .long boot_params
! 101:
! 102: .align 2
! 103: .L.errtxt: .asciz "Error: "
! 104: .align 2
! 105: .L.crlf: .asciz "\r\n"
! 106:
! 107:
! 108: /*
! 109: * int readsects(int dev, uint32_t lba, void *buf, size_t size);
! 110: */
! 111: ENTRY(readsects)
! 112: mov #2, r0
! 113: trapa #0x3f
! 114: rts
! 115: nop
! 116: argerror:
! 117: rts
! 118: mov #-1, r0
! 119:
! 120: /*
! 121: * void putstr(const char *str);
! 122: */
! 123: ENTRY(putstr)
! 124: mov #32, r0
! 125: trapa #0x3f
! 126: rts
! 127: nop
! 128:
! 129: /*
! 130: * void putchar(int c);
! 131: */
! 132: ENTRY(putchar)
! 133: mov #31, r0
! 134: trapa #0x3f
! 135: rts
! 136: nop
! 137:
CVSweb