Add checks for get_part errors
This commit is contained in:
parent
62d78d1f90
commit
cffdc2f0cf
BIN
qloader2.bin
BIN
qloader2.bin
Binary file not shown.
@ -44,6 +44,7 @@ static int cache_block(int drive, uint64_t block) {
|
||||
if (r.eflags & EFLAGS_CF) {
|
||||
int ah = (r.eax >> 8) & 0xff;
|
||||
print("Disk error %x. Drive %x, LBA %x.\n", ah, drive, dap.lba);
|
||||
panic("");
|
||||
cached_block = CACHE_INVALID;
|
||||
return ah;
|
||||
}
|
||||
|
@ -40,7 +40,9 @@ int echfs_read(struct echfs_file_handle *file, void *buf, uint64_t loc, uint64_t
|
||||
|
||||
int echfs_check_signature(int disk, int partition) {
|
||||
struct part part;
|
||||
get_part(&part, disk, partition);
|
||||
if (get_part(&part, disk, partition)) {
|
||||
panic("Invalid partition");
|
||||
}
|
||||
|
||||
struct echfs_identity_table id_table;
|
||||
read_partition(disk, &part, &id_table, 0, sizeof(struct echfs_identity_table));
|
||||
@ -57,7 +59,9 @@ int echfs_open(struct echfs_file_handle *ret, int disk, int partition, const cha
|
||||
|
||||
ret->disk = disk;
|
||||
|
||||
get_part(&ret->part, disk, partition);
|
||||
if (get_part(&ret->part, disk, partition)) {
|
||||
panic("Invalid partition");
|
||||
}
|
||||
|
||||
struct echfs_identity_table id_table;
|
||||
read_partition(disk, &ret->part, &id_table, 0, sizeof(struct echfs_identity_table));
|
||||
|
@ -265,7 +265,9 @@ next:
|
||||
}
|
||||
|
||||
int ext2fs_open(struct ext2fs_file_handle *ret, int drive, int partition, const char *path) {
|
||||
get_part(&ret->part, drive, partition);
|
||||
if (get_part(&ret->part, drive, partition)) {
|
||||
panic("Invalid partition");
|
||||
}
|
||||
|
||||
ret->drive = drive;
|
||||
|
||||
@ -353,7 +355,9 @@ static int inode_read(void *buf, uint64_t loc, uint64_t count,
|
||||
// attempts to initialize the ext2 filesystem
|
||||
int ext2fs_check_signature(int drive, int partition) {
|
||||
struct part part;
|
||||
get_part(&part, drive, partition);
|
||||
if (get_part(&part, drive, partition)) {
|
||||
panic("Invalid partition");
|
||||
}
|
||||
|
||||
uint16_t magic = 0;
|
||||
|
||||
|
@ -67,7 +67,9 @@ struct fat32_lfn_entry {
|
||||
|
||||
static int fat32_init_context(struct fat32_context* context, int disk, int partition) {
|
||||
context->drive = disk;
|
||||
get_part(&context->part, disk, partition);
|
||||
if (get_part(&context->part, disk, partition)) {
|
||||
panic("Invalid partition");
|
||||
}
|
||||
|
||||
struct fat32_bpb bpb;
|
||||
read_partition(disk, &context->part, &bpb, 0, sizeof(struct fat32_bpb));
|
||||
|
Loading…
Reference in New Issue
Block a user