From: lace <> Date: Fri, 24 Feb 2006 20:49:31 +0000 (+0000) Subject: Keep swapped drivers persistent. X-Git-Url: http://git.jankratochvil.net/?p=biosautoraid.git;a=commitdiff_plain;h=5b61ab2e5a3b14f0993ccba6fe85e3416fae129c;ds=sidebyside Keep swapped drivers persistent. - Should boot in a reasonable time if '/dev/hda' is very very broken. --- diff --git a/biosautoraid.S b/biosautoraid.S index f7f0ff5..01f3caf 100644 --- a/biosautoraid.S +++ b/biosautoraid.S @@ -23,6 +23,10 @@ */ #define STRIP_BOOT_HEADER 1 +/* Reduce size by omitting INT 0x18 handler. + */ +#define STRIP_INT18 1 + /* Maintainers: Disable .org macroinstructions: ONLY FOR compilation tuning! * - image produced doen't have any functionality! #define DISABLE_ORG 1 @@ -129,7 +133,9 @@ InitRawStack: movw %ax,%ss movw $0x7C00,%sp sti +#if 0 outchar '1' +#endif ljmp $0x7C0/*segment*/ , $InitContinue7C0-START/*offset*/ InitContinue7C0: @@ -203,7 +209,9 @@ TrailNL_Msg: /***********************/ /* DS invalid, ES==CS */ InitContinueTop: +#if 0 outchar ':' +#endif pushw %cs cli @@ -235,12 +243,14 @@ InitContinueTop: pushw %cs popw %ax stosw +#ifndef STRIP_INT18 movw $0x18*4,%di /* ROM basic - failed boot */ movw $SniffFunction0x18-START,%ax stosw pushw %cs popw %ax stosw +#endif /* !STRIP_INT18 */ sti /* we WANT DS left with 0x0000 */ /* we WANT ES left with 0x0000 */ @@ -273,8 +283,10 @@ PassControl: cli /* IMPORTANT: Boot sectors must be run with CLI! */ lret /* lret to 0x0000:0x7C00 */ +#ifndef STRIP_INT18 SniffFunction0x18: movw $Interrupt0x18Msg-START,%si /* %ds gets fixed in PrintFatal */ +#endif /* !STRIP_INT18 */ /* fallthru */ PrintFatal: call PrintString @@ -344,6 +356,12 @@ wait1: loopw wait1 popw %cx #endif + pushw %bp + movw %sp,%bp + movb /*orig-%dl:*/ %ss:2/*%bp*/+PUSHALL_SIZE+2/*%ds*/+2/*trash*/+2/*orig-%ax*/(%bp),%dl + xorb %cs:DriveFlipFlag-START,%dl /* %ds not yet initialized by: PrintString */ + movb %dl,/*%dl:*/ %ss:2/*%bp*/+2/*%bp*/+2/*%di*/+2/*%si*/(%bp) + popw %bp call CallVector0x13 jnc SF13_selfcheck movw $SF13_02_Err_Msg-START,%si @@ -354,11 +372,7 @@ wait1: loopw wait1 jz SF13_leave /* just a floppy? */ test $0x7E,%dl jnz SF13_leave /* 0x82+ disk? It may be correct unsuccessful read. */ - pushw %bp - movw %sp,%bp - xorb $0x01,/*%dl:*/ %ss:2/*%bp*/+2/*%bp*/+2/*%di*/+2/*%si*/(%bp) -SF13_do02_retry_popw_bp: - popw %bp + xorb $0x01,%ds:DriveFlipFlag-START /* %ds already initialized by: PrintString */ jmp SF13_do02_retry /* Prevent: Error 17 @@ -374,12 +388,15 @@ SF13_selfcheck: cmpb $0x00,%dh /* Head 0 ? */ jne SF13_leave_zero movb $BACKUP_SECTOR/63,%dh - movw $1+(BACKUP_SECTOR%63),%cx + movb $1+(BACKUP_SECTOR%63),%cl SF13_self_retry: + pushw %dx + xorb %cs:DriveFlipFlag-START,%dl /* %ds not yet initialized by: PrintString */ movw $0x0201,%ax CallJumpVector0x13 + popw %dx jnc SF13_self_ok - xorb $0x01,%dl + xorb $0x01,%cs:DriveFlipFlag-START /* %ds not yet initialized by: PrintString */ jmp SF13_self_retry SF13_self_ok: @@ -460,6 +477,7 @@ HelloMsg: .ascii "BaR" #endif .byte 13,10 +DriveFlipFlag: .byte 0 BadSignatureMsg: #if 0 @@ -472,12 +490,14 @@ BadSignatureMsg: /* Interrupt sniffing messages */ /*******************************/ +#ifndef STRIP_INT18 Interrupt0x18Msg: #if 0 .asciz "Interrupt 0x18 - Failed boot!" #else .asciz "18" #endif +#endif /* !STRIP_INT18 */ /**************************************************************/