Cheaper cursor, a fortify panic that names its function; Finch's gap

The cursor now costs nothing for a byte inside an escape sequence and
one cell fewer for a plain glyph: the grid is the truth, so the old
cursor cell is repainted after the byte, and not at all when a glyph
has just been drawn over it.

__fortify_panic says "r8169: rtl_open.cold+0x..." through ldlsd's module
list, so a photograph of the screen is enough, and exits instead of
spinning on a core and holding /dev/netdev.

docs/plan/finch.md: only integrating Finch is later; finishing it is
not. The self-hosting gap measured against Finch's own bootstrap test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015f73FesGZGYPkmDvUcj6QX
This commit is contained in:
Nexoniarz 2026-10-25 18:31:40 +01:00
commit 9c729edac1
5 changed files with 101 additions and 15 deletions

View file

@ -152,6 +152,9 @@ unsigned long kpi_jiffies_now(void);
// Output. The KPI is inside a process with no libc, and every implementation
// wants to be able to say what it did.
void kpi_log(const char *s);
// Says "module+0xoffset" for an address in a loaded module; set by the host.
extern void (*kpi_where)(unsigned long addr);
void kpi_lognum(long long v);
void kpi_loghex(unsigned long long v, int digits);

View file

@ -14,6 +14,7 @@
// have been easier to find.
#include "core/types.h"
#include "uapi/user.h"
#include "kpi.h"
void *
@ -135,6 +136,8 @@ kpi_memcpy_toio(void *dst, const void *s, unsigned long n)
// __fortify_panic is what a driver's bounds-checked string helpers call when
// they detect an overflow. Reaching it means the driver found a bug in itself,
// and the honest thing is to say so rather than return.
void (*kpi_where)(unsigned long addr);
void
kpi_fortify_panic(unsigned int reason, unsigned long avail, unsigned long size)
{
@ -147,8 +150,17 @@ kpi_fortify_panic(unsigned int reason, unsigned long avail, unsigned long size)
kpi_log(" reason "); kpi_lognum(reason);
kpi_log(", available "); kpi_lognum((long long)avail);
kpi_log(", wanted "); kpi_lognum((long long)size);
kpi_log(", from 0x"); kpi_loghex((unsigned long)__builtin_return_address(0), 16);
kpi_log(", from ");
if (kpi_where)
kpi_where((unsigned long)__builtin_return_address(0));
else {
kpi_log("0x"); kpi_loghex((unsigned long)__builtin_return_address(0), 16);
}
kpi_log("\n");
// Not spin: a driver that has found a bug in itself holds /dev/netdev and
// one core at 100% until reboot. The job is KeepAlive = no, so leaving is
// free, and the kernel takes the interface back.
exit_group(1);
for (;;)
;
}