|
|
@@ -142,9 +142,13 @@ make clean
|
|
|
## Boot chain
|
|
|
|
|
|
1. `boot.S` — 512-byte boot sector (FAT16 BPB). Loads contiguous kernel sectors
|
|
|
- to `0x7E00` (CHS for floppy, one sector per call; INT 13h AH=42h LBA for
|
|
|
- hard disk, up to 64 sectors per call into `ES:0` with `ES` advanced, so the
|
|
|
- offset never wraps), jumps there with the boot drive still in DL.
|
|
|
+ to `0x7E00`, one INT 13h per run of sectors into `ES:0` with `ES`
|
|
|
+ advanced (the offset never wraps): EDD LBA for hard disks, up to 64
|
|
|
+ sectors; CHS for floppies, up to the end of the track and never across a
|
|
|
+ 64 KB physical ISA DMA boundary. Errors get three tries per run, then one
|
|
|
+ sector per call (the old behaviour), three tries, then `Disk read error`.
|
|
|
+ Jumps to the stage with the boot drive still in DL (do not clobber DX).
|
|
|
+ The 512-byte sector has only a few bytes left before the partition table.
|
|
|
2. `vesa_stage.S` — real-mode VESA stage. Probes INT 15h E820 into `0x1000`,
|
|
|
enables A20, reads the `NBROOT1` rootfs header at the boot sector's
|
|
|
`pack_lba` field and copies the gzip pack directly to `PACK_HIGH_ADDR`
|
|
|
@@ -170,14 +174,20 @@ make clean
|
|
|
used); fixed disks use EDD LBA.
|
|
|
3. `kernel.c` — `kernel_main` zeroes BSS then inits serial → memory/paging →
|
|
|
ACPI/MADT → I/O → power → idle → processes → timer (PIT; 1 kHz busy,
|
|
|
- 100 Hz idle + IDT) → SMP AP bring-up → mouse/USB → VGA shadow buffer →
|
|
|
- ramfs inflate → WM → NIC probe → kworker → the `bootscan` kernel thread
|
|
|
- (storage scan + FAT mounts, then the `/data` WiFi autoconnect once the
|
|
|
- boot DHCP finished) → `wm_server_boot_ready()` immediately, so the first
|
|
|
- terminal starts while the disks are still probed → DHCP. COM1 prints
|
|
|
- `wm: first window frame (term) at N ms` (uptime) when the first app
|
|
|
- window presents: the end point of a boot-time measurement (~0.65 s after
|
|
|
- the kernel starts on QEMU's USB image).
|
|
|
+ 100 Hz idle + IDT) → SMP AP bring-up → PS/2 mouse (the I2C touchpad
|
|
|
+ probe only on Airmont) → VGA shadow buffer → ramfs inflate → WM →
|
|
|
+ publish `vfs_scan_busy` → `wm_server_boot_ready()` → wait (idle `hlt`,
|
|
|
+ 1 s cap) until the first terminal has presented → USB bring-up and scan
|
|
|
+ (non-preemptible, as before the WM existed: reset/SOF timing) → NIC probe
|
|
|
+ → kworker → the `bootscan` kernel thread (storage scan + FAT mounts, then
|
|
|
+ the `/data` WiFi autoconnect once the boot DHCP finished) → DHCP. So
|
|
|
+ the terminal is on screen before USB, NIC and disks are probed; USB
|
|
|
+ input, USB NICs and USB disks attach right after. The WM's
|
|
|
+ `SYS_NET_INFO` does not trigger the NIC probe (it reports "no NIC" until
|
|
|
+ `kernel_main` probed), so the first frame never waits for a PHY reset.
|
|
|
+ COM1 prints `wm: first window frame (term) at N ms` (uptime) when the
|
|
|
+ first app window presents: the end point of a boot-time measurement
|
|
|
+ (~0.35-0.4 s after the kernel starts on QEMU's USB image).
|
|
|
4. `mbr.S` — MBR (USB/HDD boot); loads the active partition's boot sector
|
|
|
(partition 1 at LBA 63).
|
|
|
5. **UEFI (`efi/`)** — an x86-64 PE32+ `BOOTX64.EFI` loads from the ESP. It
|
|
|
@@ -854,7 +864,10 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
for the Braswell LPSS blocks (fast mode, component-type probe, explicit
|
|
|
LPSS reset-release so the FIFO drains); `touchpad.c/h` — Elan
|
|
|
HID-over-I2C touchpad on LPSS I2C6 at `0xD1327000`, slave `0x15`.
|
|
|
- `touchpad_init()` runs from `mouse_init()` at boot (it maps the I2C
|
|
|
+ `touchpad_init()` runs from `mouse_init()` at boot, only when
|
|
|
+ `cpu_family_model()` is Airmont `0x64C` (elsewhere the fixed-address LPSS
|
|
|
+ scan would reset-cycle 32 MMIO windows that belong to nobody, ~64 ms, or
|
|
|
+ to another device); it maps the I2C
|
|
|
window before processes clone the page directory), resets the device,
|
|
|
consumes the 2-byte acknowledgement, reads the HID descriptor, selects
|
|
|
absolute mode (`0x0300 = 1`), wakes it (`0x0800`) and then queries the
|