Repository navigation
Releases
UEFI-DOS 1.12.0
CPU temperature, an emulated clock knob, and a Windows twin for AUTOBANCH.
INT E0h grew a CPU group (AX=FD00h now reports CX=0x000F, DX=0x0108)
| call | out |
|---|---|
AL=21h |
AX = package temperature in 0.1 °C, DX = TjMax, BX = 1 package / 2 core DTS; CF + AX=0xFFFF when no sensor |
AL=22h |
set emulated CPU clock, CX = percent, DX = 1 when clamped |
AL=23h |
get emulated CPU clock percentage |
AL=24h |
AX=family BX=model CX=stepping DX=base MHz SI=current MHz |
Temperature is real: CPUID leaf 6 bit 0 (digital thermal sensor) is checked first, then IA32_TEMPERATURE_TARGET (0x1A2) and IA32_PACKAGE_THERM_STATUS (0x1B1, else IA32_THERM_STATUS 0x19C) are read, giving TjMax - DTS. The CPUID guard is required — an unsupported RDMSR raises #GP and resets the machine instead of returning an error.
The clock knob is honest about its ceiling: the emulated 8086 cannot exceed the host interpreter, so >100 clamps; below 100 the run loop measures its free-running step rate and sleeps off the excess.
AUTOBANCH 2.1
New CPU section (identity, clock, temperature before and after the suite so thermal throttling shows as a delta).
WINBENCH.EXE — the same tests on native Windows
tools/winbench.c runs the same fourteen tests, same 1.000 s window (QueryPerformanceCounter), same table layout, and appends to the same B<yymmdd>.TXT that AUTOBANCH writes, so the two reports sit side by side. Temperature via WMI in a hidden PowerShell child with a 5 s cap.
Verified: host + EFI builds 0 warnings, --itest 96 passed / 0 failed, USB stick rewritten (319 files, verify 0 problems).
UEFI-DOS 1.11.7
Windows 2.03: the loader's free hole is 27 paragraphs.
- The module loader
0E68:86E7got AX=0 from the allocator, somov es,axleft ES=0 and a 64-byte copy of the NE header landed on the interrupt vector table. - Allocator
50CBwalks the hole chain9FA1+6 -> 0E1A -> 0E1C -> 9FBE -> FFFFwith count 1; the only real hole is0x001B= 27 paragraphs while the loader asks for0x3F= 63, socmp si,es:[di+3] / jbefails and it exits with AX=0. - Forcing that hole size (
UEFIDOS_FORCE=E1C3:5A46) for one run makes8730returnAX=0E1D, the header lands at0E1D:0instead of0000:0, the segment trapFF01:28C3disappears and 2.03 runs tens of millions of steps inside freshly loaded segment5D22. The IVT wipe was a symptom, not a DOS bug. - Fixed:
UEFIDOS_WATCH_WRITEwas hooked intoemu_wbonly, so the 32-bit store pathemu_wb32was invisible and earlier "nothing writes this cell" conclusions were wrong. Both paths now callwwatch(); watching9FA10:48shows exactly one writer,0E68:983F, 64 zero-writes (Windows' own BSS clear).
Verified: host + EFI builds 0 warnings, --itest 96 passed / 0 failed, USB stick rewritten (318 files, verify 0 problems).
UEFI-DOS 1.11.6
1.11.6
ARENA.COM、MCB 程序名字段,以及一个重新能解析的 build.ps1
Windows 2.03:结论钉死
- 之前所有对 2.03 的静态阅读都用错了模块基址:
cs:0x5CAF实际在文件偏移0x638F,偏差 0x6E0。按正确基址,活内存与WIN200.BIN只有 133 / 224288 字节不同 —— 模块完好装载,模拟器没有弄坏它(此前“模块会搬动 0x6D 字节块所以静态阅读不可靠”的结论只是错误基址造成的错觉)。 - 崩溃点完全解释:装载器向
5CAF要目标段,例程走“还没有模块”分支读cs:[0x20](文件里本来就是 0)返回 0,于是mov es,ax后把 64 字节 NE 头rep movsb到 0000 段,中断向量表变成4E 45 05 01。 - MCB 内存链无辜:那一刻转储是
0CFF: M owner=0D00 size=0109+0E09: Z owner=0000 size=91B5(583 KB 空闲),AH=48h failed只是BX=FFFF的探测。疑点收窄到 Windows 自己的堆登记表(50CB走[di+0x06]链表、[di+0x22]计数、call 4B48)。
新增 ARENA.COM(tools/arena.asm,1408 字节)
用 INT 21h AH=52h 自己走 MCB 链,打印 tag / owner / 段数 / 大小 / 程序名,并给出三种判定:链断了、只有一块归自己(程序刚启动的正常状态)、多块但无一空闲(内存管理器看不到内存)。
它立刻暴露两个真实缺口,均已修:
- MCB 的程序名字段我们从没填过 → 所有工具打印
name='........';arena_setup()现在写入 8.3 名字。 - 释放块不清名字 →
arena_free()现在一并清+8..15。
修掉纯构建腐坏
build.ps1 根本无法解析(XMSTEST 块后面多了一个引号,字符串未终止,解析器报 6 个级联错误)—— 按 README 构建的人拿到的是解析错误而不是构建。已修,并把 ARENA.COM 接进 build.ps1 / make_release.ps1 / tools/stage_usb.ps1。
验证
--itest 96 passed / 0 failed;Windows 1.01 仍到桌面且指针可用;2.03 停在与之前完全相同的指令(本轮没有改动那条路径,只是把它解释清楚了)。
U 盘(D:,FAT32,14xx)已重写:318 文件 / 6.55 MB,verify 0 problem(s),包含 TOOLS\ARENA.COM。
UEFI-DOS 1.11.5
Two host-side diagnostics knobs, and the deepest map of Windows 2.03's bootstrap so far.
Knobs (host harness only, no guest-visible change)
UEFIDOS_WATCH_WRITE=<hex linear>[:len]-- every write into a window of guest
memory, with the instruction that made it.UEFIDOS_FORCE=<hex linear>:<hex word>-- keep forcing one word to a value, so
"would this cell change the outcome?" is answered in one run.
What they found (docs/windows1x.md, Round 55)
- The loader at
0E68:86E7has exactly one near caller:0E68:810D, inside the
routine at80F7, and a memory snapshot taken at that instruction confirms the
frame (8110on top of the stack). - It is an NE module loader: it reads a complete NE header (
4E 45 05 01= "NE",
version 5.1) out of a0x88-byte stack descriptor, derives a header size of
0x3D3from the entry-table offset/length, the segment count and the movable
entry count, asks0E68:5CAFfor a destination segment, and then rebuilds the
whole segment table there (flags masked with0x11F9, ORed with0xC000,
table offsets stored atES:0x22andES:0x24). - The descriptor itself is sound: three snapshots show only bytes
3E/3F
changing, and they are written by the caller. 5CAF's sixteen other call sites all pass a third word (0002,0022,
3002,3040,8042,A040); the loader is the only caller that passes0,
and the only one ever reached before the crash. Its inner routine0x4B9E
does not allocate anything (4ba4: or ax,ax / ret), so the zero simply passes
through.- Forcing
cs:[0x14](zero) to the value it is compared against,3FCD,
changes nothing: same trap, samess:sp. WIN200.BINhascrlc = 0-- no MZ relocation entries at all -- and is not an
NE file (file offset0x200starts0E 1F=push cs/pop ds), so neither
a relocator nor a mangled header can be responsible.
Windows 2.03 still stops at the first use of its own segment request routine,
before opening a single file. Verified: instruction suite 96/96, host and
firmware builds warning-free, release image boots, USB stick rewritten
(317 files, verify: 0 problem(s)).
UEFI-DOS 1.11.4
Round 54 of the Windows-1.x/2.x work line, plus one real defect fixed in the
Windows 2.03 install tree.
A one-byte MS-DOS Executive. The flattened dump of the 2.03 media carries
placeholder stubs named WINDOWS_<NAME>, and WINDOWS_MSDOS.EXE is one byte.
The install script stripped the prefix and copied files in directory order, so
that stub could land on top of the real 46224-byte Executive while SYSTEM.INI
says shell=msdos.exe. Real names now win, a WINDOWS_ file only fills a gap,
and anything still under 200 bytes is printed. The tree and the test image were
rebuilt with the real file; the stick carries it too.
UEFIDOS_WATCH_WRITE=<hex linear>[:len] (host harness) prints every write
into a small window of memory together with the instruction that made it. Aimed
at the module state 2.03's loader reads (cs:[0x0020] / cs:[0x0022]) it shows
that nobody ever writes those words -- so "somebody forgot to initialise
them" is the wrong model, and the search continues one level up.
Three hypotheses closed.
- Load address is irrelevant:
UEFIDOS_PSP_SEGat1000h,2000h,3000h,
4000hmoves the fault by exactly that much and changes nothing. - An
UEFIDOS_GUARD_IVTexperiment kept the vectors intact but also ate our own
INT 21h AH=25hinstalls, so it answered nothing; it was removed instead of
shipped half-working. - It is deterministic: five runs, with and without a fixed tick period, all stop
at[halt] segment trap at FF01:28C3 ss:sp=0E68:6574 ax=0C00 exit=00FE. The
earlier "different step counts" readings came from runs that hit the
instruction limit while still inside the splash-logo loop at0E07:003E.
2.03 still does not reach its desktop: its real-mode kernel walks its own module
tables, asks a helper for a segment, is handed zero, and copies 64 bytes of its
NE header onto the interrupt vector table. The open question is which table entry
that helper was supposed to read.
Verified: instruction suite 96/96, host and firmware builds warning-free, release
image boots to C:\>, USB stick rewritten (317 files, verify: 0 problem(s)).
Windows 1.01 and 1.04 are unchanged and still reach their desktops with the
pointer working.
UEFI-DOS 1.11.3
UEFI-DOS 1.11.3 — the DOS data area moves into low memory, and Windows 2.03 stops saying "Incorrect DOS version".
What 2.03's scan really does
Round 51 described it as "find the device chain". With the disassembly alignment fixed it is something else entirely — 0E68:A3A1:
a3a5: call a428 ; find "CON " in this window
a3bd: mov bx,ax ; and bx,0x0F ; offset within segment
a3c2: shr ax,1 x4 ; add ax,es ; segment
a3d5: call a428 ; find the NEXT "CON "
a3e2: mov dx,ax ; sub dx,bx ; gap 1
a3f0: call a428 ; find a THIRD "CON "
a3fd: mov cx,ax ; sub cx,dx ; gap 2
a401: sub bx,cx ; je success ; gap1 == gap2 -> the spacing IS the stride
a411: mov dx,cx ; close 5 handles ; ret (AX = the stride)
It looks for three equally spaced occurrences of CON and returns the spacing — which is the SFT entry length. DOS puts the device name in each open handle's SFT entry, so with CON opened several times the names sit one stride apart; Windows 2.x derives the entry size from them and then reads the table directly instead of calling DOS.
The two things missing here
- The DOS data area was above the 512 KB ceiling. List of lists, DPB chain, SFT and the swappable data area all lived at
F000:C000..— linear 960 KB. They now live atDOSDATA_SEG = 0100h(linear1000h) in a compact block (src/emu/int21.c): list of lists0000h, DPB chain0040h, SFT0200h, SDA0800h. TheF000service window keeps only what belongs there (trampolines, BIOS stubs, the INT 20h stub). - The SFT entries had no device names. The 8.3 name field was zeroed for console handles. Real DOS writes the device name space padded, and handles 0-4 are its own (
CON CON CON AUX PRN), so the name now comes from the handle number.int21_sft_init()also builds the table at start-up: 2.03 scans memory without ever callingAH=52h.
Result
Incorrect DOS version is gone. 2.03 sets a graphics mode, installs interrupt vectors (AH=25h twice), gets and sets file attributes, opens and closes files, and runs for thousands of steps.
It now stops on the next blocker, which is a new one with a name:
[halt] segment trap at FF01:28C3 ss:sp=0E68:6574 ax=0C00 exit=00FE
[lowmem-hit] IVT[0]=4E450501 after step 3058 at 0E68:873E
The interrupt vector table is overwritten by a 64-byte copy of the NE header at step 3058 (sub di,[bp-2] / mov es,ax / mov cx,0x40 / rep movsb). AX comes from the helper at 0E68:5CAE, which reads a far pointer to the module's NE header from a table entry (ES = arg1-1; mov es,es:[di+1]; cmpw $0x454e = "NE") — here 0x3D2h:0x3D4h = linear 0x40F4h — and that entry is zero in our memory, so the helper returns 0 and the copy lands on the IVT. Who is supposed to fill that entry is the next question, and the same UEFIDOS_TRACE_WINDOW / UEFIDOS_DUMP_AT pair will answer it.
Verified
--itest: 96 passed, 0 failed.- Windows 1.01: desktop + pointer + Control Panel (unaffected by the move).
- Windows 1.04: desktop + Calendar launch (unaffected).
- Release image boots
UEFI-DOS Version 1.11.3; USB stick rewritten: 317 files, verify 0 problems,BOOTX64.EFI= 1.11.3.
Docs: docs/windows1x.md Round 52 (full disassembly of the scan and of the loader helper), both READMEs.
UEFI-DOS 1.11.2
UEFI-DOS 1.11.2 — the DOS device driver chain lands in low memory, and Windows 2.03's failure stops being a black box.
2.03 still does not reach its desktop. This release closes one real emulation gap, produces the tooling that found the failure, and writes down exactly what 2.03 is asking for.
The gap
UEFI-DOS intercepts devices (CON/AUX/PRN/NUL/CLOCK$) inside the kernel, so guest memory held no DOS device driver chain at all. Real DOS keeps one in low memory, and programs locate DOS's internal structures through it. src/emu/emu.c now builds five authentic headers at 0050h (1.25 KB — just above the BIOS data area, comfortably below the 2000h where program images start):
CON AUX PRN CLOCK$ NUL,- the real 0x12-byte header layout —
next(offset:segment), attributes (0x8000= character device), strategy entry, interrupt entry, 8-byte space-padded name, nextlinks chained and terminated withFFFF:FFFF,- strategy and interrupt both point at a lone
RETFatF000:FFD0, so a program that walks the chain sees the right shape and one that calls an entry gets an empty completion instead of a crash.
What 2.03 actually does
Found with instruction-level tracing (UEFIDOS_TRACE_WINDOW) plus a memory snapshot taken at an exact checkpoint (UEFIDOS_DUMP_AT):
- it opens
CONfive times and stores the handles atcs:0xA37A, - it scans conventional memory below 512 KB for the string
"CON "— the name field of a device header — walkingES += 0x0FFDper window, giving up when the segment passes0x8000, - it converts the hit to
segment:offset, scans on fromfound+3, and requires the two hits to be within0x100bytes, - it closes the five handles again and returns.
Step 4 is the key: because it closes the handles it opened, that routine is the error/cleanup path, not the init probe. The failure it reports is upstream of it, so making the scan succeed cannot by itself make 2.03 boot — verified: after the fix the scan really does find "CON " at 0050:000A (previously it matched nothing), and 2.03 prints the same message and exits with code 1.
Also identified: the binary garbage after Incorrect DOS version: is the program name 2.03 prints from a PSP field our kernel does not fill in, so the string runs straight into executable code.
What it needs next
- DOS's internal data structures in low memory (SFT, CDS, the DPB chain) — 2.03 reads them directly instead of through INT 21h,
- the PSP program-name field (the garbage in its error message),
- XMS, now that the 1.11.0 driver exists.
That is a project of its own, of the same size as the Windows 1.x work was, and docs/windows1x.md Round 51 records every measurement so the next round can start from it.
New debugging tools (host only)
| knob | what it does |
|---|---|
UEFIDOS_TRACE_WINDOW=CS:LO-HI |
trace every instruction executed in a range, all registers |
UEFIDOS_DUMP_AT=CS:IP |
snapshot all 640 KB of low memory the first time execution reaches that address |
UEFIDOS_DUMP_MEM=SEG:OFF:LEN |
dump a slice of emulated RAM at the end of the run |
Two traps recorded: the window knob wants CS:LO-HI (not CS:LO-CS:HI, which silently matches nothing), and an end-of-run dump can capture memory the program has already exited out of — which is why UEFIDOS_DUMP_AT exists.
Verified
--itest: 96 passed, 0 failed.- Windows 1.01: desktop with a working pointer (the device chain is invisible to it).
- Windows 2.03: same message, same exit code — the gap closed, the failure unchanged, documented.
- Release image boots
UEFI-DOS Version 1.11.2; USB stick rewritten: 317 files, verify 0 problems,BOOTX64.EFI= 1.11.2.
UEFI-DOS 1.11.1
UEFI-DOS 1.11.1 — the BIOS tick counter belongs to the guest, and the Windows Clock applet runs again.
The bug
The report: opening the Clock applet in Windows 1.01 shows the hands moving for a moment, then everything stops. The harness reproduced it, which is the useful part: over a whole run the picture did not change at all (every dumped frame byte-identical), and the CPU sat in the Windows idle loop with no pending message. The guest was not hung — it was waiting for a timer message that never came.
0040:006C is the BIOS tick counter, and it had three owners:
- our
INT 8stub increments it on every tick, chainsINT 1Chand EOIs — exactly like a real BIOS, - Windows 1.x keeps its own time base in the same dword — a new probe counted 12,882 guest writes to
0040:006C..006Fin one run, the last ones from1B05:1EBA(the Windows kernel), - the emulator also rewrote the whole dword from
e->bios_ticksevery 4096 steps.
Ours was by far the most frequent. Windows set its base, read it back a few thousand instructions later, found a smaller number, took it for time running backwards and restarted its one-second window. SetTimer never became due, no WM_TIMER was ever posted, and the Clock — which repaints only when its timer fires — kept the hands it had drawn at start-up. On a real machine that is exactly "the hands move for a moment and then it freezes".
The fix
src/emu/emu.c: the periodicemu_wd(0x40, 0x6C, e->bios_ticks)is gone; the(steps & 0xFFF) == 0block now only resets the interrupt guard.src/emu/int21.c:INT 1Ah AH=00reads0040:006Cinstead of writing its own value into it — what a real BIOS does.e->bios_ticksstays as the emulator's internal tick count, which is what the delivery logic uses.
Harness evidence, Clock open over 600M steps: the clock face now changes 13 times where the picture used to be byte-identical for the entire run, and the face is clean — one second hand instead of the five or six overlapping ghosts the old fight left behind (the app gets its repaints and erases the previous hand properly). AUTOBANC still measures BIOS ticks 18 /s, so the stub really is advancing the counter.
New diagnostics (host only)
UEFIDOS_TRACE_TICKW=1— every guest write to0040:006C..006Fwith the writer'sCS:IP. This is how the fight was found.UEFIDOS_HALT_BYTES=n— on the step-limit halt, dumpnbytes aroundCS:IPtobuild/halt_bytes.bin(file offset 64 =CS:IP). A guest that spins forever leaves nothing else behind.
Also recorded
Scripted double-clicks now need a 60 ms gap, not 200 ms: guest time runs slower than the wall clock, so 200 ms of host time can exceed DoubleClickSpeed=500 of guest time and the two clicks arrive as two separate selections.
Verified
--itest: 96 passed, 0 failed.AUTOBANC:BIOS ticks 18 /s, ALU 4.6M/s, x87 chain 40.5k/s, sieve 65/s (host harness).- Windows 1.01: desktop with pointer; Clock applet opens, redraws, face clean.
- Windows 1.04: Calendar launches (double-click at (60,55) with a 60 ms gap).
- Release image boots:
UEFI-DOS Version 1.11.1. USB stick rewritten: 317 files, verify 0 problems,BOOTX64.EFI= 1.11.1.
Docs: docs/windows1x.md Round 50, both READMEs.
UEFI-DOS 1.11.0
UEFI-DOS 1.11.0 — 8 GB extended memory, one guest clock, the screen comes back at the right size.
Extended memory: 8 GB a 16-bit machine can actually reach
A 16-bit PC cannot address 8 GB and never will (real mode stops at 1 MB + 64 KB of HMA, a 286 at 16 MB). What it can do is reach 8 GB through a window and block moves — which is what XMS is for, and what this release provides.
- Sparse pool: 8 GB of address space (
UEFIDOS_XMS_MB = 8192) committed in 64 KB pages the first time a program writes to them. An untouched 8 GB pool costs one 1 MB pointer table; a program that touches 40 MB pays for 40 MB. Offsets are 64-bit (8 GB is 33 bits). - XMS driver:
INT 2Fh AX=4300h(installed) /AX=4310h(entry point), version 3.00 — query free, allocate, free, move (32-bit offsets, EMB structure), lock/unlock, handle info, HMA request/release, A20 control, plus the 32-bit 88h/89h forms. Errors inBL(A0/A1/A2/A3/A4/A5/A6/A7/8B). - Window API:
INT E0h AH=FDh AL=10h..14h(open / map / copy / close / stats) mapping any 64 KB of the pool at a guest segment, on the same 40-byte request block as the 64-bit file API from 1.7.0. - Real high memory area:
FFFF:0010..10FFEFis readable and writable once XMS hands out the HMA and A20 is open. Before this release every real-mode address at or above100000hreadFFh. MEM8 [MB]in the shell writes, reads back and compares a pattern across the pool and also verifies the last 64 KB — past 4 GB.TOOLS\XMSTEST.COM(tools/xmstest.asm) does the same from inside DOS through the standard ABI: version, free block, allocate 1 MB, move 4 KB in, move it back, compare all 4096 bytes, use a 32-bit offset inside the block, free.
Measured in the host harness: 8 GB claimed, 64 MB written and verified in 47 ms (1361 MB/s for the write+verify pair), 64 MB committed.
One clock for the guest
A guest could read two clocks — the BIOS tick at 0040:006C and INT 1Ah AH=00 — computed from two different sources. On real hardware they drifted apart by a factor of hundreds (the benchmark's own diagnostic said units=2 maxgap=4773 el=7159: no wraparound, the PIT simply had not moved). Every guest-visible clock now derives from e->bios_ticks. The platform clock also no longer pins itself to the firmware RTC fallback (whole seconds) when it was asked for the time before the boot services existed, and it is clamped monotonic. New shell command CLOCK measures that platform clock against the firmware's own Stall().
AUTOBANCH's watchdog went from 200 to 1200 ticks: a once-per-second clock needs about 88 steps to fill a one-second window, so the old watchdog declared such a clock dead before the window could fill.
After Windows exits, the screen comes back big
plat_video_text() cleared the framebuffer but never restored a text mode, so after Windows 1.x exited, 80x25 text was painted into the 4x-upscaled GOP mode (2560x1440 on a laptop panel) — tiny text in a black field. It now restores the boot 80x25 console mode first, and gop_refresh_info() re-reads the mode information after every mode change.
Windows 2.03
Gets further: with SETVER, the installer tree loads WIN200.BIN, sets a graphics mode and creates its \xchg.$$$ exchange file, then takes its own fatal path. Round 49 in docs/windows1x.md has the details (and why that Incorrect DOS version message is not a version check at all).
Verified
--itest: 96 passed, 0 failed (8086 + 186/286 + 8087).XMSTEST.COM: all eight XMS steps pass inside the emulated CPU.MEM8: 8192 MB claimed, 64 MB verified, the last 64 KB past 4 GB verified, two 4 GB-64 KB blocks.- Windows 1.01 reaches its desktop with a working pointer (Control Panel opened by a scripted double-click, time advancing); the release image boots to
UEFI-DOS Version 1.11.0. - USB stick: 317 files, verify 0 problems,
BOOTX64.EFI= 1.11.0.
Docs: docs/hugemem.md (new), docs/windows1x.md Round 49, READMEs.
UEFI-DOS 1.10.4 -- first real-hardware benchmark, and a timeout that explains itself
1.10.4 -- the first real benchmark, and four lines that said "no clock"
First figures from real hardware (ASUS TUF Gaming F16, i9-14900HX, 16 GB DDR5)
16-bit real mode, one-second windows:
ALU chain (8 ops) ... 17664000 /s MUL r/m16 x2 ........ 6869120 /s
DIV r/m16 ........... 3435648 /s REP MOVSW copy KB ... 126292 /s
REP STOSW fill KB ... 228184 /s REP LODSW read KB ... 352204 /s
INT 21h call ........ 2637912 /s Disk read KB ........ 14720 /s
640x200 frame ....... 728 /s Insertion sort 256 .. 162 /s
CRC16 over 1 KB ..... 540 /s 8x8 matmul .......... 2115 /s
Native 64-bit (BENCH64.EXE, TSC-timed): TSC 2409328576 Hz, ALU 6704232448 /s, MUL 2518245888, DIV 849068800, copy 84687744 KB/s, fill 74592896 KB/s, FPU double chain 874349568, DSQRT (Newton) 11534720, sieve to 65536 21648, insertion sort 1024 16277, CRC32 154272 KB/s, matmul 32x32 5648711680 MACs/s.
Two conclusions: the freestanding EFI build interprets the guest 2.6x faster than the host harness does on the same laptop (17.6M vs 6.7M ALU ops/s) because the harness carries host plumbing per step; and disk is the opposite story (14.7 MB/s off the stick versus 144.5 MB/s through the harness) because the real machine reads through EFI_BLOCK_IO 512 bytes at a time.
The bug this exposed
Four lines (x87 chain, FSQRT, CGA text fill, sieve) came back as <no usable PIT clock> while the same binary reports all sixteen in the harness, and they are not a contiguous block (9, 10, 12, 13 failed; 11 and 14-16 passed). The timeout branch is only reachable from BENCHDONE, i.e. after the inner loop ran, so those tests are not hung -- the elapsed-count accumulator never reached 1193182 counts inside the 200-tick (11 s) watchdog.
Two mechanisms can do that, and they need different fixes:
- Polls too far apart.
el_pollreads a 16-bit down-counter and adds(prev - now) mod 65536; a unit that takes longer than 54925 counts (54.9 ms) loses whole wraps and the accumulator runs slow for ever. - Watchdog fires early. It counts BIOS ticks (
0040:006C), regenerated from the wall clock and re-learned every 125 ms; a burst of ticks during a particular instruction mix can reach 200 long before 1.25 s of real time.
The timeout line now carries the evidence for both:
<no PIT clock> units=<outer iterations> maxgap=<largest single poll delta> el=<accumulated counts>
units small means the watchdog fired early; units large with maxgap near 65536 means the delta wrapped; units large with maxgap small and el growing means something reset the accumulator. Cost when a test passes: nothing. The harness run of the same binary still reports all sixteen figures, mode-13h test included.
Stick rewritten with 1.10.4 loaders and the diagnostic AUTOBANC.COM (316 files, verify 0 problems).