about summary refs log tree commit diff stats
path: root/bochsrc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-21 22:10:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-21 22:29:24 -0700
commitfba2146593b077829845efcfe4b343ce809f5d88 (patch)
tree5cda18c98876967530105ab95757fede599685f9 /bochsrc
parent89db4ec10001f08742be78596ef41f07ed5b124c (diff)
downloadmu-fba2146593b077829845efcfe4b343ce809f5d88.tar.gz
snapshot: reading from disk without BIOS!!
Both LBA and CHS coordinates are now working for the primary disk on the
primary bus.

Failure modes I ran into:
  - ATA ports are 16-bit values. Using instructions with 8-bit immediates
    will yield strange results. (I had to debug this twice because I missed
    poll-ata-primary-bus-primary-drive-regular-status-word the first time
    around.)

    Mu's toolchain has been found out here. bootstrap has good
    errors but doesn't support the instructions I need in boot.subx. The
    self-hosted phases support the instructions but provide no error-checking.
    Might be worth starting to add error-checking as I encounter the need.
    In this case, a vote for validating metadata sizes even if we don't
    validate that instructions pass in the right metadata sizes.

  - Can't poll readiness first thing. Maybe we need to always select the
    drive first.

  - Reading 8-bit values from a 16-bit port (data port 0x1f0) returns garbage.
    Reading 32-bit values however works totally fine; go figure. (Maybe
    it won't work on real hardware?)

    https://forum.osdev.org/viewtopic.php?t=36415

  - Passing in a 0 segment will never return data.
Diffstat (limited to 'bochsrc')
-rw-r--r--bochsrc1
1 files changed, 1 insertions, 0 deletions
diff --git a/bochsrc b/bochsrc
index a1c8a4bc..f70d7906 100644
--- a/bochsrc
+++ b/bochsrc
@@ -9,6 +9,7 @@
 
 display_library: sdl2
 
+#ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
 ata0-master: type=disk, path="disk.img", mode=flat, cylinders=20, heads=16, spt=63  # 10MB, 512 bytes per sector
 boot: disk
 # PS/2 mouse requires black magic that I don't know how to explain.