Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fdisk/mbr Sanity check the drive number in %dl and use ...
details: https://anonhg.NetBSD.org/src/rev/89afa0cebbb2
branches: trunk
changeset: 472561:89afa0cebbb2
user: fvdl <fvdl%NetBSD.org@localhost>
date: Sun May 02 13:48:30 1999 +0000
description:
Sanity check the drive number in %dl and use it instead of blindly
assuming disk 0.
diffstat:
sbin/fdisk/mbr/mbr.S | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diffs (81 lines):
diff -r 65552b1a0165 -r 89afa0cebbb2 sbin/fdisk/mbr/mbr.S
--- a/sbin/fdisk/mbr/mbr.S Sun May 02 13:07:15 1999 +0000
+++ b/sbin/fdisk/mbr/mbr.S Sun May 02 13:48:30 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbr.S,v 1.5 1999/04/30 15:29:44 christos Exp $ */
+/* $NetBSD: mbr.S,v 1.6 1999/05/02 13:48:30 fvdl Exp $ */
/*
* Copyright (C) 1998 Wolfgang Solfrank.
@@ -75,6 +75,14 @@
#define movb_ireg0_reg(ireg,reg) .byte 0x8a ; .byte (reg << 3) | ireg
+#define movb_reg_mem(reg,mem) \
+ .byte 0x88 ; .byte 0x6 | (reg << 3) ; .word mem
+#define movb_mem_reg(mem,reg) \
+ .byte 0x8a ; .byte 0x6 | (reg << 3) ; .word mem
+
+#define MINDRV 0x80
+#define MAXDRV 0x87
+
.text
/*
* Move ourselves out of the way first
@@ -101,6 +109,14 @@
.word 0
#endif
1:
+ cmpb $MINDRV,%dl
+ jl 2f
+ cmpb $MAXDRV,%dl
+ jle 3f
+2:
+ movb $0x80,%dl
+3:
+ movb_reg_mem(DL,drvno)
/*
* Now look for the active partition
*/
@@ -144,7 +160,7 @@
* try to avoid them unless really necessary.
*/
boot:
- movb_ireg0_reg(SI_INDEX,DL)
+ movb_mem_reg(drvno, DL);
data32
xorl %ecx,%ecx
data32
@@ -169,12 +185,14 @@
data32
mull %ecx /* %eax = c * h * s */
- movb_ireg0_reg(SI_INDEX,DL)
+ movb_mem_reg(drvno, DL)
+
data32
addr32
movl 8(%esi), %ebx
data32
cmpl %eax, %ebx
+ data32
jl noext /* total # chs sectors > part. start */
tryext:
@@ -276,6 +294,7 @@
movl $0xaa55, %ebx
cmpl %eax, %ebx
jnz out
+ movb_mem_reg(drvno, DL)
#ifdef ASSEMBLE_16BIT
jmp 0:BOOTADDR
#else
@@ -284,6 +303,8 @@
.word 0
#endif
+drvno:
+ .byte 0x80
msinvp:
.asciz "Invalid partition table"
noos:
Home |
Main Index |
Thread Index |
Old Index