SchOS/cmd
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 42f98130c4 ldls: a Linux driver, driving real hardware
docs/plan/ldls.md milestone L3c. ldls/kpi/ implements 41 of 8139too's 94
symbols rather than logging them: register access to a mapped BAR, the PCI
calls to /dev/pci, allocation to mmap and PCIIOC_DMA, register_netdev to
/dev/netdev.

    # ldlsd /lib/modules/8139too.ko /lib/modules/btf
      found   10ec:8139 at 00:05.0
      bar 1    0x0000000081060000  256 mem
      calling probe, with 41 of 94 symbols implemented
      kpi: mapped BAR 1 -- phys 0x0000000081060000, 256 bytes
      kpi: the driver read a MAC off the hardware: 52:54:00🆎cd:ef
      netuser: ldls0 is a process now, 52:54:0🆎cd:ef
      probe returned 0 after 0 stub call(s)

52:54:00🆎cd:ef is what the machine was configured with. Nothing invented
it: the driver bit-banged the card's EEPROM, serially, through a BAR mapped by
/dev/pci, and handed back what it found. That it matches means the loader, the
relocations, the BTF offsets, the BAR mapping and the register accessors are
all correct at once, which is why it was the thing to aim at. Zero stub calls:
every symbol probe reaches is implemented.

Two bugs, one of them the kernel's.

Mine first: pci_iomap checked a failed mmap for -1 only, while SchOS returns
-errno. It returned -13 as a pointer, the driver took that as its register
base, and the first write landed at 0x4e -- thirteen below where it meant to
be.

Underneath it, the real one. sys_mmap rounds a length up to a page, the only
granularity an MMU has, and pciuser_mmio_ok() compared that against the BAR's
own size. rtl8139's registers are 256 bytes, the request became 4096, and the
answer was -EACCES for a device the process legitimately held. A BAR smaller
than a page could never be mapped at all, and nothing had noticed because the
only consumer until now was virtio-gpu, whose BARs are large. The check is now
against the pages the BAR lies in, and the widening is named where it happens:
a sub-page BAR hands over the whole page, forced by the hardware rather than
chosen.

That is exactly what hybrid.md said a foreign driver would be good for --
"what it asks for is what a foreign driver would ask for too" -- arriving as a
concrete bug rather than a prediction.

kpi_io_ok() now bounds every ioread/iowrite against the mapping pci_iomap
returned. A stray access would otherwise be a page fault with no context, and
with no IOMMU a hosted driver's wild writes have to be caught early or not at
all. It is also what turned the fault above into two lines naming the offsets.

Not done, and said so in the output rather than only in the doc: no frame has
moved. ndo_open is never called and there is no transmit or receive path, so
ldlsd releases the interface instead of leaving it up -- a link that reports
itself up with nothing draining its queue is a black hole, and the stack would
send DHCP into it for ever. Down is the true answer until packets move. That
is L3d, now listed separately.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
2026-09-14 09:59:14 +02:00
..
chvt tty: AltGr+F1..F6 by default, and AltGr+-/+ to step 2026-09-13 13:22:01 +02:00
fbinfo hybrid: /dev/pci -- a driver can live outside the kernel now 2026-09-13 15:34:28 +02:00
inputtest Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
ldlsd ldls: a Linux driver, driving real hardware 2026-09-14 09:59:14 +02:00
netecho ldls: a network, in a process 2026-09-14 08:31:06 +02:00
nettest net: recvfrom says who sent it, and a datagram is delivered whole 2026-08-15 16:23:06 +02:00
pcitest hybrid: the driver is killed, and the driver comes back 2026-09-14 00:05:43 +02:00
ping net: the socket layer stops saying yes to things it did not do, and ping works 2026-09-12 17:14:35 +02:00
reflink schfs: the commit barrier, reflink, and attributes with an index over them 2026-08-15 16:02:02 +02:00
schattr schfs: the commit barrier, reflink, and attributes with an index over them 2026-08-15 16:02:02 +02:00
schdbg debugger: the kernel can be asked a question 2026-09-14 00:58:45 +02:00
schinit docs: the tree moved and the documentation did not 2026-09-13 20:05:06 +02:00
schinitd hybrid: the driver is killed, and the driver comes back 2026-09-14 00:05:43 +02:00
schmode hybrid: a modeset, from a process 2026-09-14 01:36:05 +02:00
shmtest Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
socktest sockets: a descriptor can cross between processes 2026-09-13 19:49:37 +02:00
vgpud hybrid: a modeset, from a process 2026-09-14 01:36:05 +02:00