vbos/amd64/amd64_init.c
Michael Shaw c4ec0bdf21 tty: move tty/ from drivers/ to kernel/
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-07-12 11:05:30 -04:00

41 lines
732 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <drivers/acpi.h>
#include <kernel/tty.h>
#include <drivers/serial.h>
#include <lib/stdio.h>
#include "arch/reg.h"
#include "descriptor.h"
static struct tty tty_early = {0};
static struct tty_serial_ops tty_early_ops = {.serial_getchar = arch_serial_read, .serial_putchar = arch_serial_write};
void yield()
{
for (;;) {
asm("hlt");
}
}
void _panic()
{
yield();
}
void arch_early_init()
{
/* enable SSE: CR4.OSFXSR (bit 9) + CR4.OSXMMEXCPT (bit 10) */
u64 cr4 = cr4_read();
cr4 |= (1 << 9) | (1 << 10);
cr4_write(cr4);
tty_early.serial_ops = tty_early_ops;
tty_early.priv = (void *)COM1;
tty_printf = &tty_early;
}
void arch_init()
{
gdt_init();
idt_init();
}