diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-08-28 08:39:35 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-08-28 08:39:35 +0000 |
| commit | a30e1135b4d12c5f0787aa62e1e0720874e6705a (patch) | |
| tree | eced3c0d6735d2d06bad2eca8d7a5a3d0df93842 | |
| parent | 57888b4c835d7757fea78a832df630807155e144 (diff) | |
Notes
| -rw-r--r-- | sys/boot/i386/mbr/Makefile | 4 | ||||
| -rw-r--r-- | sys/boot/i386/mbr/mbr.s | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/sys/boot/i386/mbr/Makefile b/sys/boot/i386/mbr/Makefile index 2eb349c4da4e..e36257fa4583 100644 --- a/sys/boot/i386/mbr/Makefile +++ b/sys/boot/i386/mbr/Makefile @@ -6,8 +6,12 @@ BINMODE=${NOBINMODE} NOMAN= SRCS= ${PROG}.s +# MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) +BOOT_MBR_FLAGS?= 0x80 + ORG= 0x600 +AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary .include <bsd.prog.mk> diff --git a/sys/boot/i386/mbr/mbr.s b/sys/boot/i386/mbr/mbr.s index 9cd39d295ddf..3cfc20dd58e1 100644 --- a/sys/boot/i386/mbr/mbr.s +++ b/sys/boot/i386/mbr/mbr.s @@ -21,6 +21,7 @@ .set EXEC,0x600 # Execution address .set PT_OFF,0x1be # Partition table .set MAGIC,0xaa55 # Magic: bootable + .set FL_PACKET,0x80 # Flag: try EDD .set NHRDRV,0x475 # Number of hard drives @@ -88,10 +89,8 @@ main.5: movw %sp,%di # Save stack pointer movb 0x1(%si),%dh # Load head movw 0x2(%si),%cx # Load cylinder:sector movw $LOAD,%bx # Transfer buffer - cmpb $0xff,%dh # Might we need to use LBA? - jnz main.7 # No. - cmpw $0xffff,%cx # Do we need to use LBA? - jnz main.7 # No. + testb $FL_PACKET,flags # Try EDD? + jz main.7 # No. pushw %cx # Save %cx pushw %bx # Save %bx movw $0x55aa,%bx # Magic @@ -151,7 +150,8 @@ msg_pt: .asciz "Invalid partition table" msg_rd: .asciz "Error loading operating system" msg_os: .asciz "Missing operating system" - .org PT_OFF + .org PT_OFF-1,0x90 +flags: .byte FLAGS # Flags partbl: .fill 0x10,0x4,0x0 # Partition table .word MAGIC # Magic number |
