added no planned fat32 error codes and added mbr/vbr reading error codes

This commit is contained in:
2025-09-17 17:02:08 -04:00
parent 8d3788a76e
commit 8d2cde0a31
3 changed files with 24 additions and 20 deletions

View File

@@ -94,7 +94,7 @@ read_disk_raw:
%elifdef __STEVIA_VBR
ERROR VBR_ERROR_DISK_READ_ERR
%else
ERROR STAGE2_MBR_DISK_READ_ERROR
ERROR STAGE2_INT13_DISK_READ_ERR
%endif
.endf:
__CDECL16_PROC_EXIT

View File

@@ -51,16 +51,16 @@
%define STAGE2_MM_E820_MISC_ERR 'D'
%define STAGE2_MM_E820_NONSTANDARD 'E'
%define STAGE2_MM_E820_NO_SMAP 'F'
%define STAGE2_MBR_DISK_READ_ERROR 'G'
%define STAGE2_FAT32_INIT_ERROR 'H'
%define STAGE2_FAT32_NO_FILE 'I'
%define STAGE2_FAT32_END_OF_CHAIN 'J'
%define STAGE2_FAT32_NCLUS_CFDIVZ 'K'
%define STAGE2_FAT32_CLS2LBA_CF 'L'
%define STAGE2_FAT32_INIT_CF 'M'
%define STAGE2_ERROR_INFOPRINTER 'N'
%define STAGE2_ERROR_RESERVED_O 'O'
%define STAGE2_ERROR_RESERVED_P 'P'
%define STAGE2_INT13_DISK_READ_ERR 'G'
%define STAGE2_FAT32_E_FMT 'H'
%define STAGE2_FAT32_E_RANGE 'I'
%define STAGE2_FAT32_E_NOSUCH 'J'
%define STAGE2_FAT32_E_ISDIR 'K'
%define STAGE2_FAT32_E_TOOLONG 'L'
%define STAGE2_FAT32_E_UNSUPPORTED 'M'
%define STAGE2_FAT32_E_UNIMPLEMENTED 'N'
%define STAGE2_ERROR_BAD_MBR 'O'
%define STAGE2_ERROR_BAD_VBR 'P'
%define STAGE2_ERROR_RESERVED_Q 'Q'
%define STAGE2_ERROR_RESERVED_R 'R'
%define STAGE2_ERROR_RESERVED_S 'S'

View File

@@ -213,13 +213,13 @@ ReadMbrData:
.check_sig:
mov bx, [bp + 6]
cmp word [bx + 0x1FE], 0xAA55 ; check for bytes at end
jne ReadMbrData.error
; TODO: this needs error checking, zero checking, check the sig a bunch of stuff...
jne ReadMbrData.error_nosign
; TODO: this needs more error checking, zero checking, check the sig a bunch of stuff...
.endp:
__CDECL16_PROC_EXIT
ret
.error:
ERROR STEVIA_DEBUG_ERR
.error_nosign:
ERROR STAGE2_ERROR_BAD_MBR
; int read_vbr(int boot_drive, void* buf)
; read vbr on boot partition to memory (for fat bpb/ebpb)
@@ -239,7 +239,7 @@ ReadVbrData:
je ReadVbrData.active_found
add bx, PartEntry_t_size ; next part entry's attributes
loop ReadVbrData.find_active_L0
jmp ReadVbrData.error
jmp ReadVbrData.error_noactive
.active_found:
movzx ax, byte [bp + 4]
push ax ; drive_num (2)
@@ -256,15 +256,19 @@ ReadVbrData:
.check_sig:
mov bx, [bp + 6]
cmp word [bx + 0x1FE], 0xAA55 ; check for bytes at end
jne ReadVbrData.error
jne ReadVbrData.error_nosign
.check_FAT_size:
test word [bx + FAT32_bpb_t.unused2_ZERO_word], 0 ; TotSectors16 will not be set if FAT32
jnz ReadVbrData.error
jnz ReadVbrData.error_badfatfs
.endp:
__CDECL16_PROC_EXIT
ret
.error:
ERROR STEVIA_DEBUG_ERR
.error_noactive:
ERROR STAGE2_ERROR_BAD_VBR
.error_nosign:
ERROR STAGE2_ERROR_BAD_VBR
.error_badfatfs:
ERROR STAGE2_ERROR_BAD_VBR
; set ds and es segments back to the base of the loader
%ifnmacro __TINY_DS_ES