summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/pc98/boot/biosboot/bios.S128
-rw-r--r--sys/pc98/boot/biosboot/boot.h8
-rw-r--r--sys/pc98/boot/biosboot/io.c33
3 files changed, 163 insertions, 6 deletions
diff --git a/sys/pc98/boot/biosboot/bios.S b/sys/pc98/boot/biosboot/bios.S
index 8aec61c..d3c444f 100644
--- a/sys/pc98/boot/biosboot/bios.S
+++ b/sys/pc98/boot/biosboot/bios.S
@@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:34:26 rpd
- * $Id: bios.S,v 1.6 1997/02/22 09:43:05 peter Exp $
+ * $Id: bios.S,v 1.7 1997/05/18 12:28:38 kato Exp $
*/
/*
@@ -53,11 +53,46 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Ported to PC-9801 by Yoshio Kimura
*/
+/*
+ * Extensions for El Torito CD-ROM booting:
+ *
+ * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO
+ * Copyright © 1997 interface business GmbH, Dresden.
+ * All rights reserved.
+ *
+ * This code has been written by Jörg Wunsch, Dresden.
+ * Direct comments to <joerg_wunsch@interface-business.de>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
.file "bios.s"
#include "asm.h"
.text
+#ifndef CDBOOT
+
/*
* biosread(dev, cyl, head, sec, nsec, offset)
* Read "nsec" sectors from disk to offset "offset" in boot segment
@@ -135,6 +170,97 @@ ENTRY(biosread)
ret
+#else /* CDBOOT */
+
+
+/*
+ * int
+ * getbootspec(struct specpacket *offset)
+ *
+ * Read CD-ROM boot specification packet to "offset".
+ */
+ENTRY(getbootspec)
+ push %ebp
+ mov %esp, %ebp
+
+ push %esi
+ push %ebx
+
+ movw 0x8(%ebp), %si
+ mov $0x7f, %edx
+
+ /* prot_to_real will set %es to BOOTSEG */
+ call EXT(prot_to_real) /* enter real mode */
+ movw $0x4b01, %ax /* (do not) terminate disk emulation */
+ movb $0x7f, %dl /* any drive */
+
+ sti
+ int $0x13
+ cli
+
+ /* save return value (actually movw %ax, %bx) */
+ mov %eax, %ebx
+
+ data32
+ call EXT(real_to_prot) /* back to protected mode */
+
+ xor %eax, %eax
+ movb %bh, %al /* return value in %ax */
+
+ pop %ebx
+ pop %esi
+ pop %ebp
+
+ ret
+
+
+/*
+ * int
+ * biosreadlba(struct daddrpacket *daddr)
+ * Read sectors using the BIOS "read extended" function
+ * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory
+ * Call with %ah = 0x42
+ * %dl = drive (0x0 for floppy disk, or emulated CD)
+ * %ds:%si = ptr to disk address packet
+ * Return:
+ * %ah = 0x0 on success; err code on failure
+ */
+
+ENTRY(biosreadlba)
+ push %ebp
+ mov %esp, %ebp
+
+ push %ebx
+ push %esi
+
+ movw 8(%ebp), %si
+ movl $0, %edx /* emulated CD is always drive 0 */
+
+ /* prot_to_real will set %es to BOOTSEG */
+ call EXT(prot_to_real) /* enter real mode */
+ movw $0x4200, %ax /* subfunction */
+ movb $0, %dl
+
+ sti
+ int $0x13
+ cli
+
+ /* save return value (actually movw %ax, %bx) */
+ mov %eax, %ebx
+
+ data32
+ call EXT(real_to_prot) /* back to protected mode */
+
+ xor %eax, %eax
+ movb %bh, %al /* return value in %ax */
+
+ pop %esi
+ pop %ebx
+ pop %ebp
+
+ ret
+
+#endif /* !CDBOOT */
/*
* getc()
diff --git a/sys/pc98/boot/biosboot/boot.h b/sys/pc98/boot/biosboot/boot.h
index 8761760..d084861 100644
--- a/sys/pc98/boot/biosboot/boot.h
+++ b/sys/pc98/boot/biosboot/boot.h
@@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
- * $Id: boot.h,v 1.9 1997/05/28 09:22:59 kato Exp $
+ * $Id: boot.h,v 1.10 1997/06/09 13:44:04 kato Exp $
*/
#include <sys/param.h>
@@ -81,8 +81,12 @@ void printf(const char *format, ...);
void putchar(int c);
void delay1ms(void);
int gets(char *buf);
+#ifndef CDBOOT
int strcmp(const char *s1, const char *s2);
-void bcopy(const char *from, char *to, int len);
+#else /* CDBOOT */
+int strncasecmp(const char *s1, const char *s2, size_t s);
+#endif /* !CDBOOT */
+void bcopy(const void *from, void *to, size_t len);
void twiddle(void);
#ifdef PC98
void machine_check(void);
diff --git a/sys/pc98/boot/biosboot/io.c b/sys/pc98/boot/biosboot/io.c
index 85af081..a4bc0cc 100644
--- a/sys/pc98/boot/biosboot/io.c
+++ b/sys/pc98/boot/biosboot/io.c
@@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
- * $Id: io.c,v 1.10 1997/05/28 09:22:59 kato Exp $
+ * $Id: io.c,v 1.11 1997/06/09 13:44:04 kato Exp $
*/
#include "boot.h"
@@ -257,6 +257,8 @@ gets(char *buf)
return 0;
}
+#ifndef CDBOOT
+
int
strcmp(const char *s1, const char *s2)
{
@@ -268,11 +270,36 @@ strcmp(const char *s1, const char *s2)
return 1;
}
+#else /* CDBOOT */
+
+int
+strncasecmp(const char *s1, const char *s2, size_t s)
+{
+ /*
+ * We only consider ASCII chars and don't anticipate
+ * control characters (they are invalid in filenames
+ * anyway).
+ */
+ while (s > 0 && (*s1 & 0x5f) == (*s2 & 0x5f)) {
+ if (!*s1++)
+ return 0;
+ s2++;
+ }
+ if (s == 0)
+ return 0;
+ return 1;
+}
+
+#endif /* !CDBOOT */
+
void
-bcopy(const char *from, char *to, int len)
+bcopy(const void *from, void *to, size_t len)
{
+ char *fp = (char *)from;
+ char *tp = (char *)to;
+
while (len-- > 0)
- *to++ = *from++;
+ *tp++ = *fp++;
}
/* To quote Ken: "You are not expected to understand this." :) */
OpenPOWER on IntegriCloud