1 /* $NetBSD: xxboot.ahdi.S,v 1.1.4.3 2004/09/21 13:14:19 skrll Exp $ */
4 * Copyright (c) 1995 Waldi Ravens.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Waldi Ravens.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .globl _start, main, fill
42 .globl start, main, fill
49 * Fake gemdos-fs bootsector, to keep TOS away.
66 * AHDI rootsector code passes:
67 * d3: SCSI/IDE <-> ACSI flag d4: SCSI/IDE target (or -1)
68 * d5: boot preference d6: offset of boot block
69 * d7: ACSI target a3: pointer to readsector()
70 * a4: pointer to `start' a5: pointer to back-to-ROM
72 main: movml %d3-%d7/%a3-%a5,%sp@-
81 movl %d0,%a5 | autoboot flag
87 bhis exit | membot > MAXBOT
92 blts exit | memtop < MINTOP
97 movl %a0,%sp | set new stack
99 * Load secondary boot loader and disklabel.
102 movq #NSEC,%d3 | # of sectors
103 addql #1,%d6 | first sector
109 * int bootxx(readsector, disklabel, autoboot)
112 pea %a4@(LBLST-MAXBOT) | disklabel
113 pea %pc@(rds2) | readsector
114 jsr %a4@(BXXST-MAXBOT)
115 lea %pc@(m_sbl),%a6 | NetBSD not booted
118 0: movl %sp@,%sp | restore BIOS stack
121 movml %sp@+,%d3-%d7/%a3-%a5
122 movl %d0,%d5 | new boot preference
125 exit: bsrs puts | display error
127 bsrs puts | wait for key
128 movml %sp@+,%d3-%d7/%a3-%a5
134 0: cmpw #35,%d0 | '#'
138 1: cmpw #64,%d0 | '@'
173 * int readsec (void *buffer, u_int offset, u_int count);
175 rds2: movml %d2-%d7/%a2-%a6,%sp@-
176 movl %pc@(regsav),%a0
177 movml %a0@,%d3-%d7/%a3-%a5
178 movl %sp@(48),%a4 | buffer
179 movl %sp@(52),%d6 | offset
180 movl %sp@(56),%d3 | count
182 movml %sp@+,%d2-%d7/%a2-%a6
198 m_bot: .asciz "xxboot: membot == 0x#\r\n"
199 m_top: .asciz "xxboot: memtop == 0x#\r\n"
200 m_sbl: .asciz "xxboot: bootxx => 0x#\r\n"
201 m_rds: .asciz "xxboot: Floprd => 0x#\r\n"
202 m_key: .asciz "\007\r\npress any key... @\r\n"
206 fill: .space 54 | 510-(fill-start)