:: commit 3702060f695a248b29d807fe1ac69d99af0ab26e

mintsuki <mintsuki@protonmail.com> — 2021-04-24 20:59

parents: fb7e9fdb3c

disk: Limit the range of hard drives and optical drives scanned in BIOS

diff --git a/stage23/drivers/disk.s2.c b/stage23/drivers/disk.s2.c
index a5ca3d7f..c20ec9b8 100644
--- a/stage23/drivers/disk.s2.c
+++ b/stage23/drivers/disk.s2.c
@@ -78,7 +78,12 @@ bool disk_read_sectors(struct volume *volume, void *buf, uint64_t block, size_t
 void disk_create_index(void) {
     size_t volume_count = 0;
 
-    for (uint8_t drive = 0x80; drive; drive++) {
+    for (uint8_t drive = 0x80; ; drive++) {
+        if (drive == 0x90)
+            drive = 0xe0;
+        else if (drive == 0xf0)
+            break;
+
         struct rm_regs r = {0};
         struct bios_drive_params drive_params;
 
@@ -132,7 +137,12 @@ void disk_create_index(void) {
 
     volume_index = ext_mem_alloc(sizeof(struct volume) * volume_count);
 
-    for (uint8_t drive = 0x80; drive; drive++) {
+    for (uint8_t drive = 0x80; ; drive++) {
+        if (drive == 0x90)
+            drive = 0xe0;
+        else if (drive == 0xf0)
+            break;
+
         struct rm_regs r = {0};
         struct bios_drive_params drive_params;
 
tab: 248 wrap: offon