X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=mbr%2Fmbr.S;h=b71cfb7c4d8ee54ba8fdf6eae2b934d70c6447be;hb=61f106ba8a5b2a7c2d9855291fd9e7f4a4d3143d;hp=2a318be3896e7ebac6bfa0405fd2b9f549ed1be0;hpb=b19e0b33ad57d71635c55d9724cdff45daa24d73;p=profile%2Fivi%2Fsyslinux.git diff --git a/mbr/mbr.S b/mbr/mbr.S index 2a318be..b71cfb7 100644 --- a/mbr/mbr.S +++ b/mbr/mbr.S @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- * - * Copyright 2007 H. Peter Anvin - All Rights Reserved + * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved + * Copyright 2009 Intel Corporation; author: H. Peter Anvin * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -25,6 +26,8 @@ * * ----------------------------------------------------------------------- */ +#include "adjust.h" + .code16 .text @@ -34,7 +37,8 @@ driveno = (stack-6) sectors = (stack-8) secpercyl = (stack-12) -BIOS_page = 0x462 +BIOS_kbdflags = 0x417 +BIOS_page = 0x462 /* gas/ld has issues with doing this as absolute addresses... */ .section ".bootsec", "a", @nobits @@ -45,15 +49,14 @@ bootsec: .text .globl _start _start: + .byte 0x33, 0xc0 /* xorw %ax, %ax */ cli - xorw %ax, %ax movw %ax, %ds movw %ax, %ss movw $stack, %sp movw %sp, %si pushw %es /* es:di -> $PnP header */ pushw %di - pushw %dx /* dl -> drive number */ movw %ax, %es sti cld @@ -64,11 +67,14 @@ _start: rep; movsw ljmpw $0, $next - next: + + ADJUST_DRIVE + pushw %dx /* dl -> drive number */ + /* Check to see if we have EBIOS */ pushw %dx /* drive number */ - movw $0x4100, %ax + movb $0x41, %ah /* %al == 0 already */ movw $0x55aa, %bx xorw %cx, %cx xorb %dh, %dh @@ -109,7 +115,6 @@ next: missing_os: call error .ascii "Missing operating system.\r\n" - .byte 0 /* * read_sector: read a single sector pointed to by %eax to 0x7c00. @@ -145,7 +150,7 @@ read_sector_cbios: read_common: movb (driveno), %dl int $0x13 - addw $16, %sp /* Drop DAPA */ + leaw 16(%si), %sp /* Drop DAPA */ popal ret @@ -207,8 +212,8 @@ scan_partition_table: jns too_many_active /* No active partitions found, look for extended partitions */ - popw %bx /* %bx <- ptab */ popw %cx /* %cx <- 4 */ + popw %bx /* %bx <- ptab */ 7: movb 4(%bx), %al cmpb $0x0f, %al /* 0x0f = Win9x extended */ @@ -249,7 +254,6 @@ scan_partition_table: too_many_active: call error .ascii "Multiple active partitions.\r\n" - .byte 0 /* * boot: invoke the actual bootstrap. (%si) points to the partition @@ -273,7 +277,6 @@ boot: disk_error: call error .ascii "Operating system load error.\r\n" - .byte 0 /* * Print error messages. This is invoked with "call", with the @@ -283,14 +286,13 @@ error: popw %si 2: lodsb - andb %al, %al - jz 3f movb $0x0e, %ah movb (BIOS_page), %bh movb $0x07, %bl - int $0x10 - jmp 2b -3: + int $0x10 /* May destroy %bp */ + cmpb $10, %al /* Newline? */ + jne 2b + int $0x18 /* Boot failure */ die: hlt