From: Michael Brown Date: Wed, 24 May 2006 13:48:16 +0000 (+0000) Subject: Updated to REAL_CODE(). X-Git-Tag: fredrik-command-line-merge-1~111 X-Git-Url: http://git.etherboot.org/people/xl0/gpxe.git/commitdiff_plain/595f161b51f3f157c27566bd0669e0734b9ddfc8 Updated to REAL_CODE(). int13_boot() now does its own segment register save and restore, ready for the removal of segment register restoration from the libkir generic code. --- diff --git a/src/arch/i386/interface/pcbios/int13.c b/src/arch/i386/interface/pcbios/int13.c index 8df4c797..2683a718 100644 --- a/src/arch/i386/interface/pcbios/int13.c +++ b/src/arch/i386/interface/pcbios/int13.c @@ -503,25 +503,26 @@ void unregister_int13_drive ( struct int13_drive *drive ) { */ int int13_boot ( unsigned int drive ) { int status, signature; - int d0, d1; + int discard_c, discard_d; DBG ( "Booting from INT 13 drive %02x\n", drive ); /* Use INT 13 to read the boot sector */ - REAL_EXEC ( rm_int13_boot, - "pushw $0\n\t" - "popw %%es\n\t" - "int $0x13\n\t" - "jc 1f\n\t" - "xorl %%eax, %%eax\n\t" - "\n1:\n\t" - "movzwl %%es:0x7dfe, %%ebx\n\t", - 4, - OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( signature ), - "=c" ( d0 ), "=d" ( drive ) ), - IN_CONSTRAINTS ( "0" ( 0x0201 ), "1" ( 0x7c00 ), - "2" ( 0x0001 ), "3" ( drive ) ), - CLOBBER ( "ebp" ) ); + __asm__ __volatile__ ( REAL_CODE ( "pushw %%es\n\t" + "pushw $0\n\t" + "popw %%es\n\t" + "stc\n\t" + "int $0x13\n\t" + "sti\n\t" /* BIOS bugs */ + "jc 1f\n\t" + "xorl %%eax, %%eax\n\t" + "\n1:\n\t" + "movzwl %%es:0x7dfe, %%ebx\n\t" + "popw %%es\n\t" ) + : "=a" ( status ), "=b" ( signature ), + "=c" ( discard_c ), "=d" ( discard_d ) + : "a" ( 0x0201 ), "b" ( 0x7c00 ), + "c" ( 1 ), "d" ( drive ) ); if ( status ) return -EIO; @@ -539,22 +540,28 @@ int int13_boot ( unsigned int drive ) { &int19_vector ); /* Boot the loaded sector */ - REAL_EXEC ( rm_int13_exec, - "movw %%ss, %%ax\n\t" /* Preserve stack pointer */ - "movw %%ax, %%cs:int13_exec_saved_ss\n\t" - "movw %%sp, %%cs:int13_exec_saved_sp\n\t" - "ljmp $0, $0x7c00\n\t" - "\nint13_exec_saved_ss: .word 0\n\t" - "\nint13_exec_saved_sp: .word 0\n\t" - "\nint13_exec_fail:\n\t" - "movw %%cs:int13_exec_saved_ss, %%ax\n\t" - "movw %%ax, %%ss\n\t" - "movw %%cs:int13_exec_saved_sp, %%sp\n\t" - "\n99:\n\t", - 1, - OUT_CONSTRAINTS ( "=d" ( d1 ) ), - IN_CONSTRAINTS ( "0" ( drive ) ), - CLOBBER ( "eax", "ebx", "ecx", "esi", "edi", "ebp" ) ); + __asm__ __volatile__ ( REAL_CODE ( /* Save segment registers */ + "pushw %%ds\n\t" + "pushw %%es\n\t" + "pushw %%fs\n\t" + "pushw %%gs\n\t" + /* Save stack pointer */ + "movw %%ss, %%ax\n\t" + "movw %%ax, %%cs:int13_saved_ss\n\t" + "movw %%sp, %%cs:int13_saved_sp\n\t" + "ljmp $0, $0x7c00\n\t" + "\nint13_saved_ss: .word 0\n\t" + "\nint13_saved_sp: .word 0\n\t" + "\nint13_exec_fail:\n\t" + "movw %%cs:int13_saved_ss, %%ax\n\t" + "movw %%ax, %%ss\n\t" + "movw %%cs:int13_saved_sp, %%sp\n\t" + "popw %%gs\n\t" + "popw %%fs\n\t" + "popw %%es\n\t" + "popw %%ds\n\t" ) + : "=d" ( discard_d ) : "d" ( drive ) + : "eax", "ebx", "ecx", "esi", "edi", "ebp" ); DBG ( "Booted disk returned via INT 18 or 19\n" );