Improved disk error reporting

svn path=/trunk/; revision=2544
This commit is contained in:
Brian Palmer 2002-01-22 23:56:08 +00:00
parent 4694f10044
commit fd75e7d985
3 changed files with 24 additions and 3 deletions

View file

@ -394,6 +394,8 @@ _biosdisk_retval:
.long 0 .long 0
_biosdisk_retrycount: _biosdisk_retrycount:
.byte 0 .byte 0
_biosdisk_error_code:
.byte 0
EXTERN(_BiosInt13Read) EXTERN(_BiosInt13Read)
.code32 .code32
@ -459,6 +461,8 @@ _biosdisk_read:
_biosdisk_error: _biosdisk_error:
movb %ah,_biosdisk_error_code// Save the error code
cmpb $0x11,%ah // Check and see if it was a corrected ECC error cmpb $0x11,%ah // Check and see if it was a corrected ECC error
je _biosdisk_done // If so then the data is still good, if not fail je _biosdisk_done // If so then the data is still good, if not fail
@ -570,6 +574,8 @@ _int13_extended_read:
_int13_extended_error: _int13_extended_error:
movb %ah,_biosdisk_error_code // Save the error code
cmpb $0x11,%ah // Check and see if it was a corrected ECC error cmpb $0x11,%ah // Check and see if it was a corrected ECC error
je _int13_extended_done // If so then the data is still good, if not fail je _int13_extended_done // If so then the data is still good, if not fail
@ -666,6 +672,16 @@ _int13_extension_check_done:
pop %ebp pop %ebp
ret ret
/*
* ULONG BiosInt13GetLastErrorCode(VOID);
*/
EXTERN(_BiosInt13GetLastErrorCode)
.code32
movzbl _biosdisk_error_code,%eax // Get return value
ret
/* /*
* int getyear(void); * int getyear(void);
*/ */

View file

@ -40,6 +40,7 @@ int biosdisk(int cmd, int drive, int head, int track, int sector, int nsects, v
BOOL BiosInt13Read(ULONG Drive, ULONG Head, ULONG Track, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S BOOL BiosInt13Read(ULONG Drive, ULONG Head, ULONG Track, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ReadExtended(ULONG Drive, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S BOOL BiosInt13ReadExtended(ULONG Drive, ULONG Sector, ULONG SectorCount, PVOID Buffer); // Implemented in asmcode.S
BOOL BiosInt13ExtensionsSupported(ULONG Drive); BOOL BiosInt13ExtensionsSupported(ULONG Drive);
ULONG BiosInt13GetLastErrorCode(VOID);
void stop_floppy(void); // Implemented in asmcode.S void stop_floppy(void); // Implemented in asmcode.S
int get_heads(int drive); // Implemented in asmcode.S int get_heads(int drive); // Implemented in asmcode.S

View file

@ -32,15 +32,19 @@
VOID DiskError(PUCHAR ErrorString) VOID DiskError(PUCHAR ErrorString)
{ {
DbgPrint((DPRINT_DISK, "%s\n", ErrorString)); UCHAR ErrorCodeString[80];
sprintf(ErrorCodeString, "%s\nError Code: 0x%x", ErrorString, BiosInt13GetLastErrorCode());
DbgPrint((DPRINT_DISK, "%s\n", ErrorCodeString));
if (UserInterfaceUp) if (UserInterfaceUp)
{ {
MessageBox(ErrorString); MessageBox(ErrorCodeString);
} }
else else
{ {
printf("%s", ErrorString); printf("%s", ErrorCodeString);
printf("\nPress any key\n"); printf("\nPress any key\n");
getch(); getch();
} }