diff options
| author | Alejandro Sior <aho@sior.be> | 2022-05-20 10:33:27 +0200 |
|---|---|---|
| committer | Alejandro Sior <aho@sior.be> | 2022-05-20 10:33:27 +0200 |
| commit | 74d0e8c1f9527054a012aa9937c590537f9d3d5b (patch) | |
| tree | a83448feac9e803c3844ba8eb8137aef8c26239d /drive/drive.ha | |
| parent | 776a3710652f78b44718450406d0683974aef72a (diff) | |
bios.call: clean and avoid hardcoding the gdt and idt when returning to long mode
Do not make assumptions on the previous gdt and idt, as well as the state of the flags
when operating.
Diffstat (limited to 'drive/drive.ha')
| -rw-r--r-- | drive/drive.ha | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drive/drive.ha b/drive/drive.ha index 42cef43..259e7f5 100644 --- a/drive/drive.ha +++ b/drive/drive.ha @@ -2,19 +2,20 @@ use bios; use bios::drive; fn lba_to_chs(lba: u16) (u16, u16, u16) = { - let temp = lba / bios::drive::drive_spt; - let sector = (lba % bios::drive::drive_spt) + 1; - let head = temp % bios::drive::drive_heads; - let cylinder = temp / bios::drive::drive_heads; + //let temp = lba / bios::drive::drive_spt; + //let sector = (lba % bios::drive::drive_spt) + 1; + //let head = temp % bios::drive::drive_heads; + //let cylinder = temp / bios::drive::drive_heads; - return (cylinder, head, sector); + //return (cylinder, head, sector); + return (0, 0, 0); }; export fn read(sector: u16, dest: uintptr) void = { let chs = lba_to_chs(sector); - bios::regs.eax = 1 | 0x2 << 8; - bios::regs.ebx = ws; - bios::regs.ecx = chs.2 | chs.0 << 8; - bios::regs.edx = bios::drive::drive_no | chs.1 << 8; + //bios::regs.eax = 1 | 0x2 << 8; + //bios::regs.ebx = ws; + //bios::regs.ecx = chs.2 | chs.0 << 8; + //bios::regs.edx = bios::drive::drive_no | chs.1 << 8; }; |
