:: commit 3768a8cf2e4f26ba323465aa69582866af6bd9a3

mintsuki <mintsuki@protonmail.com> — 2019-06-01 21:56

parents: bbfc5d36af

Other small changes to disk driver

diff --git a/drivers/disk.c b/drivers/disk.c
index 9c8d403e..98c91a71 100644
--- a/drivers/disk.c
+++ b/drivers/disk.c
@@ -17,16 +17,7 @@ static struct {
     uint64_t lba;
 } dap = { 16, 1, 0, 0, 0 };
 
-static int check_results(struct rm_regs *out) {
-    int ah = (out->eax >> 8) & 0xFF;
-
-    if (ah)
-        print("Disk error %x\n", ah);
-
-    return ah;
-}
-
-int read_sector(int drive, int lba, int count, uint8_t *buffer) {
+int read_sector(int drive, int lba, int count, void *buffer) {
     dap.offset = (uint16_t)(size_t)sector_buf;
 
     while (count--) {
@@ -36,8 +27,12 @@ int read_sector(int drive, int lba, int count, uint8_t *buffer) {
         r.edx = drive;
         r.esi = (unsigned int)&dap;
         rm_int(0x13, &r, &r);
-        if (check_results(&r))
-            return (r.eax >> 8) & 0xFF;
+
+        int ah = (r.eax >> 8) & 0xFF;
+        if (ah) {
+            print("Disk error %x\n", ah);
+            return ah;
+        }
 
         memcpy(buffer, sector_buf, SECTOR_SIZE);
 
diff --git a/drivers/disk.h b/drivers/disk.h
index 90ac6799..eaf4017e 100644
--- a/drivers/disk.h
+++ b/drivers/disk.h
@@ -1,8 +1,6 @@
 #ifndef __DISK_H__
 #define __DISK_H__
 
-#include <stdint.h>
-
-int read_sector(int, int, int, uint8_t *);
+int read_sector(int, int, int, void *);
 
 #endif
tab: 248 wrap: offon