diff --git a/amd64/amd64_init.c b/amd64/amd64_init.c index 61b226a..14d9363 100644 --- a/amd64/amd64_init.c +++ b/amd64/amd64_init.c @@ -38,17 +38,20 @@ void arch_early_init() tty_early.priv = (void *)COM1; tty_printf = &tty_early; + + tty_clear_screen(tty_printf); + tty_set_cursor_pos(tty_printf, 0, 0); } void arch_init() { - void _syscall_enter(); + void _syscall_enter(); gdt_init(); idt_init(); wrmsr(IA32_STAR, ((u64)GDT_SEGMENT_CODE_RING0 << 48) | ((u64)GDT_SEGMENT_CODE_RING3 << 32)); - wrmsr(IA32_LSTAR, (u64)_syscall_enter); - wrmsr(IA32_FMASK, RFLAGS_IF); + wrmsr(IA32_LSTAR, (u64)_syscall_enter); + wrmsr(IA32_FMASK, RFLAGS_IF); } void arch_ap_startup() diff --git a/drivers/term/fbcon.c b/drivers/term/fbcon.c index cd98d05..257b777 100644 --- a/drivers/term/fbcon.c +++ b/drivers/term/fbcon.c @@ -33,6 +33,16 @@ static struct tty_serial_ops fbcon_serial_ops = { struct tty *fbcon_init(void) { + static u32 ansi_colors[] = {0x000000, 0x0000AA, 0x00AA00, 0x00AAAA, 0xAA0000, 0xAA00AA, 0xAAAA00, 0xAAAAAA}; + + static u32 ansi_bright_colors[] = {0x000000, 0x0000DD, 0x00DD00, 0x00DDDD, 0xDD0000, 0xDD00DD, 0xDDDD00, 0xDDDDDD}; + + static u32 default_fg = 0xDDDDDDDD; + static u32 default_bg = 0x00000000; + + static u32 default_fg_bright = 0xFFFFFFFF; + static u32 default_bg_bright = 0x00000000; + if (!fb_res || !fb_res->framebuffer_count) return NULL; @@ -44,9 +54,21 @@ struct tty *fbcon_init(void) return NULL; ft_ctx = flanterm_fb_init( - NULL, NULL, fb_virt, fb->width, fb->height, fb->pitch, fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size, - fb->green_mask_shift, fb->blue_mask_size, fb->blue_mask_shift, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, - 0, 0, 0, 0, FLANTERM_FB_ROTATE_0); + NULL, NULL, /* malloc/free override */ + fb_virt, /* framebuffer virt pointer */ + fb->width, fb->height, fb->pitch, /* screen geometry */ + fb->red_mask_size, fb->red_mask_shift, /* red */ + fb->green_mask_size, fb->green_mask_shift, /* green */ + fb->blue_mask_size, fb->blue_mask_shift, /* blue */ + NULL, /* canvas */ + ansi_colors, ansi_bright_colors, /* colors */ + &default_bg, &default_fg, /* bg colors */ + &default_bg_bright, &default_fg_bright, /* bright bg colors */ + NULL, 0, 0, 0, /* font ptr, width, height, spacing */ + 0, 0, /* font scale x, y */ + 0, /* margin */ + FLANTERM_FB_ROTATE_0 /* rotation */ + ); if (!ft_ctx) return NULL; @@ -57,5 +79,5 @@ struct tty *fbcon_init(void) kinfo("fbcon: framebuffer console initialized (%lux%lu)\n", fb->width, fb->height); - return fbtty; + return fbtty; } diff --git a/init/main.c b/init/main.c index 4119256..bc00770 100644 --- a/init/main.c +++ b/init/main.c @@ -84,7 +84,6 @@ static void kmain() struct tty *tee = tty_tee_create("broadcast"); tty_tee_add(tee, serial_tty); tty_tee_add(tee, visual_tty); - tty_printf = tee; do_initcalls();