fbcon: add palette

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-17 03:35:47 -04:00
commit 45c88c16e4
3 changed files with 32 additions and 8 deletions

View file

@ -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()

View file

@ -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;
}

View file

@ -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();