|
@@ -503,25 +503,26 @@ void unregister_int13_drive ( struct int13_drive *drive ) {
|
503
|
503
|
*/
|
504
|
504
|
int int13_boot ( unsigned int drive ) {
|
505
|
505
|
int status, signature;
|
506
|
|
- int d0, d1;
|
|
506
|
+ int discard_c, discard_d;
|
507
|
507
|
|
508
|
508
|
DBG ( "Booting from INT 13 drive %02x\n", drive );
|
509
|
509
|
|
510
|
510
|
/* Use INT 13 to read the boot sector */
|
511
|
|
- REAL_EXEC ( rm_int13_boot,
|
512
|
|
- "pushw $0\n\t"
|
513
|
|
- "popw %%es\n\t"
|
514
|
|
- "int $0x13\n\t"
|
515
|
|
- "jc 1f\n\t"
|
516
|
|
- "xorl %%eax, %%eax\n\t"
|
517
|
|
- "\n1:\n\t"
|
518
|
|
- "movzwl %%es:0x7dfe, %%ebx\n\t",
|
519
|
|
- 4,
|
520
|
|
- OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( signature ),
|
521
|
|
- "=c" ( d0 ), "=d" ( drive ) ),
|
522
|
|
- IN_CONSTRAINTS ( "0" ( 0x0201 ), "1" ( 0x7c00 ),
|
523
|
|
- "2" ( 0x0001 ), "3" ( drive ) ),
|
524
|
|
- CLOBBER ( "ebp" ) );
|
|
511
|
+ __asm__ __volatile__ ( REAL_CODE ( "pushw %%es\n\t"
|
|
512
|
+ "pushw $0\n\t"
|
|
513
|
+ "popw %%es\n\t"
|
|
514
|
+ "stc\n\t"
|
|
515
|
+ "int $0x13\n\t"
|
|
516
|
+ "sti\n\t" /* BIOS bugs */
|
|
517
|
+ "jc 1f\n\t"
|
|
518
|
+ "xorl %%eax, %%eax\n\t"
|
|
519
|
+ "\n1:\n\t"
|
|
520
|
+ "movzwl %%es:0x7dfe, %%ebx\n\t"
|
|
521
|
+ "popw %%es\n\t" )
|
|
522
|
+ : "=a" ( status ), "=b" ( signature ),
|
|
523
|
+ "=c" ( discard_c ), "=d" ( discard_d )
|
|
524
|
+ : "a" ( 0x0201 ), "b" ( 0x7c00 ),
|
|
525
|
+ "c" ( 1 ), "d" ( drive ) );
|
525
|
526
|
if ( status )
|
526
|
527
|
return -EIO;
|
527
|
528
|
|
|
@@ -539,22 +540,28 @@ int int13_boot ( unsigned int drive ) {
|
539
|
540
|
&int19_vector );
|
540
|
541
|
|
541
|
542
|
/* Boot the loaded sector */
|
542
|
|
- REAL_EXEC ( rm_int13_exec,
|
543
|
|
- "movw %%ss, %%ax\n\t" /* Preserve stack pointer */
|
544
|
|
- "movw %%ax, %%cs:int13_exec_saved_ss\n\t"
|
545
|
|
- "movw %%sp, %%cs:int13_exec_saved_sp\n\t"
|
546
|
|
- "ljmp $0, $0x7c00\n\t"
|
547
|
|
- "\nint13_exec_saved_ss: .word 0\n\t"
|
548
|
|
- "\nint13_exec_saved_sp: .word 0\n\t"
|
549
|
|
- "\nint13_exec_fail:\n\t"
|
550
|
|
- "movw %%cs:int13_exec_saved_ss, %%ax\n\t"
|
551
|
|
- "movw %%ax, %%ss\n\t"
|
552
|
|
- "movw %%cs:int13_exec_saved_sp, %%sp\n\t"
|
553
|
|
- "\n99:\n\t",
|
554
|
|
- 1,
|
555
|
|
- OUT_CONSTRAINTS ( "=d" ( d1 ) ),
|
556
|
|
- IN_CONSTRAINTS ( "0" ( drive ) ),
|
557
|
|
- CLOBBER ( "eax", "ebx", "ecx", "esi", "edi", "ebp" ) );
|
|
543
|
+ __asm__ __volatile__ ( REAL_CODE ( /* Save segment registers */
|
|
544
|
+ "pushw %%ds\n\t"
|
|
545
|
+ "pushw %%es\n\t"
|
|
546
|
+ "pushw %%fs\n\t"
|
|
547
|
+ "pushw %%gs\n\t"
|
|
548
|
+ /* Save stack pointer */
|
|
549
|
+ "movw %%ss, %%ax\n\t"
|
|
550
|
+ "movw %%ax, %%cs:int13_saved_ss\n\t"
|
|
551
|
+ "movw %%sp, %%cs:int13_saved_sp\n\t"
|
|
552
|
+ "ljmp $0, $0x7c00\n\t"
|
|
553
|
+ "\nint13_saved_ss: .word 0\n\t"
|
|
554
|
+ "\nint13_saved_sp: .word 0\n\t"
|
|
555
|
+ "\nint13_exec_fail:\n\t"
|
|
556
|
+ "movw %%cs:int13_saved_ss, %%ax\n\t"
|
|
557
|
+ "movw %%ax, %%ss\n\t"
|
|
558
|
+ "movw %%cs:int13_saved_sp, %%sp\n\t"
|
|
559
|
+ "popw %%gs\n\t"
|
|
560
|
+ "popw %%fs\n\t"
|
|
561
|
+ "popw %%es\n\t"
|
|
562
|
+ "popw %%ds\n\t" )
|
|
563
|
+ : "=d" ( discard_d ) : "d" ( drive )
|
|
564
|
+ : "eax", "ebx", "ecx", "esi", "edi", "ebp" );
|
558
|
565
|
|
559
|
566
|
DBG ( "Booted disk returned via INT 18 or 19\n" );
|
560
|
567
|
|