2009-06-11 Vladimir Serbinenko <phcoder@gmail.com>
Drivemap fixes * commands/i386/pc/drivemap.c (grub_get_root_biosnumber_drivemap): new function (grub_get_root_biosnumber_saved): new variable (GRUB_MOD_INIT): register grub_get_root_biosnumber_drivemap (GRUB_MOD_FINI): unregister grub_get_root_biosnumber_drivemap * commands/i386/pc/drivemap_int13h.S (grub_drivemap_handler): restore %dx after the call if necessary * conf/common.rmk (pkglib_MODULES): remove boot.mod (boot_mod_SOURCES): remove (boot_mod_CFLAGS): remove (boot_mod_LDFLAGS): remove * conf/i386-coreboot.rmk (pkglib_MODULES): add boot.mod (boot_mod_SOURCES): new variable (boot_mod_CFLAGS): likewise (boot_mod_LDFLAGS): likewise * conf/i386-efi.rmk: likewise * conf/i386-ieee1275.rmk: likewise * conf/i386-pc.rmk: likewise * conf/powerpc-ieee1275.rmk: likewise * conf/sparc64-ieee1275.rmk: likewise * conf/x86_64-efi.rmk: likewise * include/grub/i386/pc/biosnum.h: new file * lib/i386/pc/biosnum.c: likewise * loader/i386/bsd.c (grub_bsd_get_device): use grub_get_root_biosnumber * loader/i386/multiboot.c (grub_multiboot_get_bootdev): likewise * loader/i386/pc/chainloader.c (grub_chainloader_cmd): likewise
This commit is contained in:
parent
5ac35b35b0
commit
63963d17d0
16 changed files with 269 additions and 67 deletions
|
@ -27,6 +27,11 @@
|
|||
|
||||
/* The replacement int13 handler. Preserve all registers. */
|
||||
FUNCTION(grub_drivemap_handler)
|
||||
/* Save %dx for future restore. */
|
||||
push %dx
|
||||
/* Push flags. Used to simulate interrupt with original flags. */
|
||||
pushf
|
||||
|
||||
/* Map the drive number (always in DL). */
|
||||
push %ax
|
||||
push %bx
|
||||
|
@ -51,11 +56,48 @@ not_found:
|
|||
pop %bx
|
||||
pop %ax
|
||||
|
||||
/* Upon arrival to this point the stack must be exactly like at entry.
|
||||
This long jump will transfer the caller's stack to the old INT13
|
||||
handler, thus making it return directly to the original caller. */
|
||||
.byte 0xea
|
||||
cmpb $0x8, %ah
|
||||
jz norestore
|
||||
cmpb $0x15, %ah
|
||||
jz norestore
|
||||
|
||||
/* Restore flags. */
|
||||
popf
|
||||
pushf
|
||||
|
||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
||||
|
||||
push %bp
|
||||
mov %sp, %bp
|
||||
|
||||
tail:
|
||||
|
||||
pushf
|
||||
pop %dx
|
||||
mov %dx, 8(%bp)
|
||||
|
||||
pop %bp
|
||||
|
||||
/* Restore %dx. */
|
||||
pop %dx
|
||||
iret
|
||||
|
||||
norestore:
|
||||
|
||||
/* Restore flags. */
|
||||
popf
|
||||
pushf
|
||||
|
||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
||||
|
||||
push %bp
|
||||
mov %sp, %bp
|
||||
|
||||
/* Save %dx. */
|
||||
mov %dx, 2(%bp)
|
||||
|
||||
jmp tail
|
||||
|
||||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
||||
IVT entries (thus PI:SC in mem). */
|
||||
VARIABLE(grub_drivemap_oldhandler)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue