God said TempleOS has no networking. We gave it one card and called it the Fall. This branch is what came after the Fall. One card was a sin, three is a habit.
What is in it
-
Intel e1000 (82540EM,
8086:100E). Every hypervisor pretends to have one: QEMU, VirtualBox, VMware, Hyper-V. Intel also ships a second computer inside yours that the CIA would love to talk to. We wrote them a driver anyway. MMIO registers, 32 Rx and 16 Tx descriptors, MAC from RAL/RAH or the EEPROM. One Tx descriptor always stays empty, because a full ring looks empty to the card. Intel designed that. Of course. Two tasks sending at once cannot hand the card half a frame. -
virtio-net (
1AF4:1000, legacy I/O ports). The card that admits it is the host pretending. The hypervisor reads every byte. It always did. No MSI-X, no capability lists, no MMIO. Ports, like on the C64. - MakeNet picks the first card it finds: PCnet, then e1000, then virtio. No card means Snail over COM3, as before.
-
PciFindByID fixed. It gave up whenever
dev.pci_headwas not empty, so onePCIRepand no driver ever found its card again. The empty-slot timeout only left the function loop and skipped functions 1-7 after it. Both fixed. All buses were always walked:sys_pci_bussescomes from the PCI BIOS and SeaBIOS numbers bridges first. SeaBIOS numbers bridges first.
No card may interrupt. The rings are polled from the timer, like PCnet was all along, although nobody wrote that down. Polling is honest.
How to test
tools/build_iso.py ~/templeos-base/TempleOS.ISO
NIC=e1000 tools/run_mac.sh
NIC=virtio-net-pci tools/run_mac.sh
#include "::/Apps/Wget"
Wget("http://example.com/");
Tested in QEMU:
| Card | Where | DHCP | Confessional | Wget |
|---|---|---|---|---|
| PCnet | bus 0 | ok | ok | ok |
| e1000 | bus 0 | ok | ok | ok |
| e1000 | behind pci-bridge, 1:3.0 | ok | ok | ok |
| virtio-net | bus 0 | ok | ok | ok |
| virtio-net | behind pci-bridge | ok | ok | ok |
Known sins
- Tested only in QEMU. VirtualBox, VMware and real iron were not asked.
- Only small transfers were tested.
- Modern virtio 1.0 (
disable-legacy=on,1AF4:1041) is not supported. TempleOS cannot boot on q35 anyway: AHCI only, no IDE, it cannot find its own CD.
Terry, forgive us. Lord, have mercy on these drivers.