|
@@ -140,9 +140,12 @@ make clean
|
|
|
enables A20, reads the `NBROOT1` rootfs header at the boot sector's
|
|
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`
|
|
`pack_lba` field and copies the gzip pack directly to `PACK_HIGH_ADDR`
|
|
|
(`0x900000`, above the 8 MB VGA-shadow reserve) in 16 KB chunks through
|
|
(`0x900000`, above the 8 MB VGA-shadow reserve) in 16 KB chunks through
|
|
|
- the `0x3000` staging buffer with INT 15h AH=87h. The BIOS block move uses
|
|
|
|
|
- 24-bit descriptor bases; `paging_prepare_cpu()` clears the CR4/EFER state
|
|
|
|
|
- the X201's BIOS leaves behind. The stage then picks the best VBE mode
|
|
|
|
|
|
|
+ the `0x3000` staging buffer with a temporary flat protected-mode
|
|
|
|
|
+ `rep movsb` (`pm_copy`). The X201 BIOS's INT 15h AH=87h block move
|
|
|
|
|
+ silently copies zeros to this range, which left the kernel with an empty
|
|
|
|
|
+ pack; the CPU copy is used instead. `paging_prepare_cpu()` still clears
|
|
|
|
|
+ the CR4/EFER state a BIOS protected-mode call can leave behind. The
|
|
|
|
|
+ stage then picks the best VBE mode
|
|
|
(≥16 bpp, LFB, fits VRAM, ≤1280px), writes mode info to `0x600` and the
|
|
(≥16 bpp, LFB, fits VRAM, ≤1280px), writes mode info to `0x600` and the
|
|
|
12-dword `struct boot_info` (magic/checksum/rsdp/flags/pack range) to
|
|
12-dword `struct boot_info` (magic/checksum/rsdp/flags/pack range) to
|
|
|
`0x500`, enters protected mode and jumps to `kernel_entry` (`entry.S`,
|
|
`0x500`, enters protected mode and jumps to `kernel_entry` (`entry.S`,
|
|
@@ -290,8 +293,8 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
LFB (uncacheable) and enables CR0.PG/WP. Before the switch it clears stale
|
|
LFB (uncacheable) and enables CR0.PG/WP. Before the switch it clears stale
|
|
|
translation controls a BIOS protected-mode call can leave behind
|
|
translation controls a BIOS protected-mode call can leave behind
|
|
|
(`CR4.PAE/PGE/LA57/PCIDE/SMEP/SMAP` and `EFER.LME`); the X201's legacy
|
|
(`CR4.PAE/PGE/LA57/PCIDE/SMEP/SMAP` and `EFER.LME`); the X201's legacy
|
|
|
- stage used to return from `INT 15h AH=87h` with `CR4` set, and the first
|
|
|
|
|
- `CR0.PG` write then triple-faulted. The LFB PDE range is computed from
|
|
|
|
|
|
|
+ stage historically returned from `INT 15h AH=87h` with `CR4` set, and the
|
|
|
|
|
+ first `CR0.PG` write then triple-faulted. The LFB PDE range is computed from
|
|
|
the page index (a base above `0xFF000000` used to wrap `base + 16 MB` and
|
|
the page index (a base above `0xFF000000` used to wrap `base + 16 MB` and
|
|
|
map nothing), and `mm_init` reserves a low LFB range so the boot console
|
|
map nothing), and `mm_init` reserves a low LFB range so the boot console
|
|
|
cannot overwrite the page directory. Each process gets a page directory
|
|
cannot overwrite the page directory. Each process gets a page directory
|
|
@@ -912,8 +915,9 @@ it to `0x7E00`. The kernel region itself only has one wall (`_end` below
|
|
|
`USER_BASE` (`0x40000000`), packed by `mkpack` into `cmds.pack` (as
|
|
`USER_BASE` (`0x40000000`), packed by `mkpack` into `cmds.pack` (as
|
|
|
`bin/<name>`), gzipped to `cmds_pack_gz.bin` and wrapped by `mkrootfs`
|
|
`bin/<name>`), gzipped to `cmds_pack_gz.bin` and wrapped by `mkrootfs`
|
|
|
with a `NBROOT1` header. The pack is the system rootfs: the boot path
|
|
with a `NBROOT1` header. The pack is the system rootfs: the boot path
|
|
|
- loads it into RAM (legacy high-memory AH=87h copy / UEFI / kexec staging)
|
|
|
|
|
- and `ramfs_init` takes a private page-allocated copy, mounted read-only at
|
|
|
|
|
|
|
+ loads it into RAM (legacy high-memory protected-mode copy / UEFI / kexec
|
|
|
|
|
+ staging) and `ramfs_init` takes a private page-allocated copy, mounted
|
|
|
|
|
+ read-only at
|
|
|
`/ramfs`. The
|
|
`/ramfs`. The
|
|
|
shell finds them through PATH (`/ramfs/bin` by default), loads the whole
|
|
shell finds them through PATH (`/ramfs/bin` by default), loads the whole
|
|
|
ELF through the VFS and spawns it as a ring-3 process; `hello` is just
|
|
ELF through the VFS and spawns it as a ring-3 process; `hello` is just
|
|
@@ -1319,8 +1323,9 @@ gzip flag). The build rejects a pack above the `PACK_MAX` cap (2 MB,
|
|
|
`CMDS_GZ_MAX` in the Makefile, `PACK_MAX` in `vesa_stage.S`);
|
|
`CMDS_GZ_MAX` in the Makefile, `PACK_MAX` in `vesa_stage.S`);
|
|
|
`libdeflate` buys several KB over `gzip -9` and is still preferred. The boot
|
|
`libdeflate` buys several KB over `gzip -9` and is still preferred. The boot
|
|
|
path loads the gz pack into RAM — the legacy stage copies it directly to
|
|
path loads the gz pack into RAM — the legacy stage copies it directly to
|
|
|
-`0x900000` with INT 15h AH=87h, the UEFI loader into a loader-data buffer
|
|
|
|
|
-below 512 MB, kexec via its staging buffer — and `ramfs_init()`
|
|
|
|
|
|
|
+`0x900000` with its protected-mode `rep movsb`, the UEFI loader into a
|
|
|
|
|
+loader-data buffer below 512 MB, kexec via its staging buffer — and
|
|
|
|
|
+`ramfs_init()`
|
|
|
inflates it into page-allocated memory and mounts it read-only at `/ramfs`.
|
|
inflates it into page-allocated memory and mounts it read-only at `/ramfs`.
|
|
|
The kernel image no longer contains it, so the pack no longer moves `_end`;
|
|
The kernel image no longer contains it, so the pack no longer moves `_end`;
|
|
|
the high-memory legacy path supports up to 2 MB (known issue 8). The UI
|
|
the high-memory legacy path supports up to 2 MB (known issue 8). The UI
|
|
@@ -1746,9 +1751,10 @@ and the WM falls back to polling (`io_keyboard_irq_masked()`).
|
|
|
8. The rootfs pack is inflated into one contiguous page-allocated run at
|
|
8. The rootfs pack is inflated into one contiguous page-allocated run at
|
|
|
boot, capped by `RAMFS_MAX_DECOMPRESSED` (8 MB); a larger pack fails to
|
|
boot, capped by `RAMFS_MAX_DECOMPRESSED` (8 MB); a larger pack fails to
|
|
|
load (the USB rootfs partition is 8 MB, so this only bites if the cap is
|
|
load (the USB rootfs partition is 8 MB, so this only bites if the cap is
|
|
|
- raised without a bigger partition). The legacy stage now copies the
|
|
|
|
|
- compressed pack directly to `0x900000` with INT 15h AH=87h, so the cap is
|
|
|
|
|
- `PACK_MAX` 2 MB (raised from 1 MB for the WiFi firmware). The browser and
|
|
|
|
|
|
|
+ raised without a bigger partition). The legacy stage copies the
|
|
|
|
|
+ compressed pack directly to `0x900000` with a protected-mode
|
|
|
|
|
+ `rep movsb`, so the cap is `PACK_MAX` 2 MB (raised from 1 MB for the WiFi
|
|
|
|
|
+ firmware). The browser and
|
|
|
its ring-3 dependencies are compiled with function sections and linked
|
|
its ring-3 dependencies are compiled with function sections and linked
|
|
|
with `--gc-sections`; the current full pack with the UI fonts, the
|
|
with `--gc-sections`; the current full pack with the UI fonts, the
|
|
|
1,036,312-byte WiFi firmware and `install/kernel.bin` is ~1.26 MiB gzip
|
|
1,036,312-byte WiFi firmware and `install/kernel.bin` is ~1.26 MiB gzip
|