Commit Graph

7881 Commits

Author SHA1 Message Date
Kartik K. Agaram d8d9dfa855 some hacky checks for common errors
They're not really baked into the regular compilation process; I have to
remember to run them if I see strange behavior.
2021-03-31 23:16:01 -07:00
Kartik K. Agaram 971062583a . 2021-03-31 21:17:20 -07:00
Kartik Agaram 16f2bd1174 . 2021-03-29 18:47:52 -07:00
Kartik Agaram 386641c021 . 2021-03-29 15:00:52 -07:00
Kartik K. Agaram 18ef136b2c . 2021-03-28 08:36:03 -07:00
Kartik K. Agaram cfe4fea124 . 2021-03-28 08:32:48 -07:00
Kartik K. Agaram a3a7ffe4da . 2021-03-28 08:32:15 -07:00
Kartik K. Agaram dfda825e55 always acknowledge enabled interrupts
Now we can start enabling the timer interrupt. It doesn't do anything yet,
but keyboard continues to work.
2021-03-28 08:30:57 -07:00
Kartik K. Agaram ad53022489 . 2021-03-27 21:52:16 -07:00
Kartik K. Agaram b98832253f . 2021-03-27 21:48:44 -07:00
Kartik K. Agaram 763719c211 .
Clean up some debug prints.
2021-03-27 17:53:15 -07:00
Kartik K. Agaram 7bf8adb893 explicitly pass data disk to main 2021-03-27 17:50:44 -07:00
Kartik K. Agaram 9818f1de98 .
https://wiki.osdev.org/ATA_PIO_Mode#IDENTIFY_command recommends the straight-and-narrow
way, but the LBA bit shouldn't matter in drive-select during IDENTIFY command,
according to the ATA 3 spec. And it works in Qemu and bochs. It'll slightly
simplify drive parameter management.
2021-03-27 08:38:01 -07:00
Kartik K. Agaram 83c25a03c9 fix stale examples 2021-03-26 23:07:35 -07:00
Kartik K. Agaram 1a43d12b15 explicitly pass screen and keyboard to main 2021-03-26 23:07:35 -07:00
Kartik K. Agaram 9f71d7248c . 2021-03-26 22:32:22 -07:00
Kartik K. Agaram 4d0df592ac . 2021-03-26 22:22:54 -07:00
Kartik Agaram 681c0156a9 . 2021-03-25 14:33:04 -07:00
Kartik Agaram c2aeba0a11 . 2021-03-24 09:12:32 -07:00
Kartik Agaram 754d813bc5 . 2021-03-23 23:02:41 -07:00
Kartik Agaram 3120f938c6 . 2021-03-23 22:27:59 -07:00
Kartik K. Agaram b663b5797a . 2021-03-23 22:12:07 -07:00
Kartik K. Agaram 443bb67383 example demonstrating disk access 2021-03-23 22:10:29 -07:00
Kartik K. Agaram 21263b2edd bochs support for disk drives 2021-03-23 21:53:41 -07:00
Kartik K. Agaram 55adbda2d9 . 2021-03-23 21:41:40 -07:00
Kartik K. Agaram 7b89f8e67e reorg boot.subx 2021-03-23 21:27:06 -07:00
Kartik K. Agaram 49a9938333 mouse support that requires polling 2021-03-23 21:14:49 -07:00
Kartik K. Agaram e0f6dd5240 get rid of unnecessary padding
Now we only specify addresses where it matters.
2021-03-23 20:00:15 -07:00
Kartik K. Agaram 49464e5866 . 2021-03-23 19:37:07 -07:00
Kartik Agaram 895093b3cf . 2021-03-23 17:41:31 -07:00
Kartik Agaram c4199646d7 . 2021-03-23 17:34:07 -07:00
Kartik Agaram 3350c34a74 . 2021-03-23 17:31:08 -07:00
Kartik K. Agaram 62a2442110 writes to disk now working
Tested by inserting a call into the shell, but we can't leave it in because
every test ends up clobbering the disk. So it's now time to think about
a testable interface for the disk.
2021-03-23 00:32:49 -07:00
Kartik K. Agaram bc79a190ec transfer only 16 bits at a time 2021-03-22 23:55:28 -07:00
Kartik K. Agaram e1843988a4 . 2021-03-22 23:39:26 -07:00
Kartik K. Agaram 3749f99d24 . 2021-03-22 23:29:42 -07:00
Kartik K. Agaram c0607ecca8 . 2021-03-22 22:56:33 -07:00
Kartik K. Agaram 480daf408c . 2021-03-22 22:30:41 -07:00
Kartik K. Agaram 8abc3639e0 . 2021-03-22 22:30:39 -07:00
Kartik K. Agaram b2e9887b83 . 2021-03-22 22:28:35 -07:00
Kartik K. Agaram 02b0317c3b shell: gracefully handle missing data disk 2021-03-22 22:21:51 -07:00
Kartik K. Agaram e6b42204ef shell: read initial expression from secondary disk
See shell/README.md for (extremely klunky) instructions.
2021-03-21 23:10:55 -07:00
Kartik K. Agaram 2718cb453c . 2021-03-21 22:33:33 -07:00
Kartik K. Agaram 0c3f126377 snapshot: reading secondary drive also works
dd if=/dev/zero of=data.img count=20160
  echo '(+ 1 1)' |dd of=data.img conv=notrunc
  ./translate ex2.mu  &&  qemu-system-i386 -hda disk.img -hdb data.img

Compare output with `xxd data.img |head`.

This works because primary and secondary drives on the primary bus share
the same ports. All we have to do is select the right drive by flipping
a bit.
2021-03-21 22:30:44 -07:00
Kartik K. Agaram fba2146593 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.
2021-03-21 22:29:24 -07:00
Kartik K. Agaram 89db4ec100 . 2021-03-21 21:57:20 -07:00
Kartik K. Agaram 36dd179f49 . 2021-03-21 21:53:51 -07:00
Kartik K. Agaram 13d24889e0 typo; thanks waterhouse
https://news.ycombinator.com/item?id=26525349#26529192
2021-03-21 07:45:04 -07:00
Kartik K. Agaram 31e1c46803 . 2021-03-18 22:49:20 -07:00
Kartik Agaram e4a224d3a9 . 2021-03-17 10:23:57 -07:00