From bdd2d007cd470bdf35f8860fb74bf7c07868f2a5 Mon Sep 17 00:00:00 2001 From: tkchia Date: Fri, 7 Oct 2022 22:26:22 +0000 Subject: [PATCH] [metal] Push forward timing of VGA TTY initialization - arrange to initialize the default VGA TTY data structure, at about the same time as the console stdin, stdout, & stderr descriptors are set up, rather than much later --- libc/vga/{rlinit-vga.S => rlinit-init-vga.S} | 7 +++++++ libc/vga/vga-init.greg.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) rename libc/vga/{rlinit-vga.S => rlinit-init-vga.S} (97%) diff --git a/libc/vga/rlinit-vga.S b/libc/vga/rlinit-init-vga.S similarity index 97% rename from libc/vga/rlinit-vga.S rename to libc/vga/rlinit-init-vga.S index 6d4962bec..dd5802996 100644 --- a/libc/vga/rlinit-vga.S +++ b/libc/vga/rlinit-init-vga.S @@ -91,5 +91,12 @@ vga_console: .endobj vga_console,globl,hidden .previous + .init.start 305,_init_vga + push %rdi + push %rsi + call _vga_init + pop %rsi + pop %rdi + .init.end 305,_init_vga .yoink sys_writev_vga .yoink sys_readv_vga diff --git a/libc/vga/vga-init.greg.c b/libc/vga/vga-init.greg.c index 42c0491b2..c542cfd59 100644 --- a/libc/vga/vga-init.greg.c +++ b/libc/vga/vga-init.greg.c @@ -60,7 +60,7 @@ void _vga_reinit(struct Tty *tty, unsigned short starty, unsigned short startx, chr_ht, chr_wid, vid_buf, init_flags); } -__attribute__((__constructor__)) static textstartup void _vga_init(void) { +textstartup void _vga_init(void) { if (IsMetal()) { struct mman *mm = (struct mman *)(BANE + 0x0500); unsigned short starty = mm->pc_video_curs_info.y,