From e8ef939274865f6c14220519b76c53d68c095a76 Mon Sep 17 00:00:00 2001 From: tkchia Date: Thu, 6 Oct 2022 05:04:44 +0000 Subject: [PATCH] [metal] Reduce size of "screen of death" code --- libc/vga/tty-graph.c | 1 + libc/vga/tty-graph.inc | 5 +++-- libc/vga/tty-klog.greg.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libc/vga/tty-graph.c b/libc/vga/tty-graph.c index 77cbc8a93..7a6f3429b 100644 --- a/libc/vga/tty-graph.c +++ b/libc/vga/tty-graph.c @@ -37,6 +37,7 @@ */ #undef KLOGTTY +#define MAYUNROLLLOOPS unrollloops #define COLOR TtyCanvasColor #define BPP 32 diff --git a/libc/vga/tty-graph.inc b/libc/vga/tty-graph.inc index 4387f36cd..722e4dc58 100644 --- a/libc/vga/tty-graph.inc +++ b/libc/vga/tty-graph.inc @@ -258,8 +258,9 @@ static void DRAWBITMAP(struct Tty *tty, size_t gy, size_t gx, DIRTY(tty, gy, gx, gy + bm_ht, gx + bm_wid); } -static unrollloops void FILLRECT(struct Tty *tty, size_t gy, size_t gx, - size_t fill_ht, size_t fill_wid, COLOR bg) { +static MAYUNROLLLOOPS void FILLRECT(struct Tty *tty, size_t gy, size_t gx, + size_t fill_ht, size_t fill_wid, + COLOR bg) { size_t xs = tty->xs; char *cplotter = tty->canvas + gy * xs + gx * sizeof(COLOR); size_t yleft = fill_ht, xleft; diff --git a/libc/vga/tty-klog.greg.c b/libc/vga/tty-klog.greg.c index 8e9897ea9..3b957d858 100644 --- a/libc/vga/tty-klog.greg.c +++ b/libc/vga/tty-klog.greg.c @@ -37,7 +37,10 @@ * @see libc/vga/tty-graph.inc */ +#pragma GCC optimize("s") + #define KLOGTTY +#define MAYUNROLLLOOPS /* do not unroll loops; keep the code small! */ /* Instantiate output routines for 16-bit pixel formats. */ #define COLOR uint16_t