fix acpi on uefi, kprint fixes

This commit is contained in:
Freya Murphy 2024-02-03 22:06:39 -05:00
parent 22df3f473c
commit a717dbdd00
Signed by: freya
GPG key ID: 744AB800E383AE52
5 changed files with 14 additions and 11 deletions

View file

@ -38,12 +38,10 @@ struct xsdp {
char oemid[6]; char oemid[6];
uint8_t revision; uint8_t revision;
uint32_t rsdt_addr; uint32_t rsdt_addr;
struct { uint32_t length;
uint32_t length; uint64_t xsdt_addr;
uint64_t xsdt_addr; uint8_t extendeid_checksum;
uint8_t extendeid_checksum; uint8_t reserved[3];
uint8_t reserved[3];
} ext;
} __attribute__((packed)); } __attribute__((packed));
// root system descriptor table // root system descriptor table
@ -321,7 +319,7 @@ int acpi_init(void *rootsdp) {
state.version = 2; state.version = 2;
struct xsdp *xsdp = (struct xsdp *) rsdp; struct xsdp *xsdp = (struct xsdp *) rsdp;
kprintf("ACPI 2.0\n"); kprintf("ACPI 2.0\n");
acpi_load_table(xsdp->ext.xsdt_addr); acpi_load_table(xsdp->xsdt_addr);
} else { } else {
panic("invalid acpi rev: %d\n", rsdp->revision); panic("invalid acpi rev: %d\n", rsdp->revision);
} }

View file

@ -36,9 +36,9 @@ void log_backtrace(void) {
void log_backtrace_ex(void *ip, void *bp) { void log_backtrace_ex(void *ip, void *bp) {
struct stackframe *frame = bp; struct stackframe *frame = bp;
kputs("Stack trace:\n"); kputs("Stack trace:\n");
kprintf(" 0x%p\n", ip); kprintf(" %p\n", ip);
while (frame) { while (frame) {
kprintf(" 0x%p\n", frame->rip); kprintf(" %p\n", frame->rip);
frame = frame->rbp; frame = frame->rbp;
} }

View file

@ -184,7 +184,7 @@ static void read_memory_map(
type = segment_type[6]; type = segment_type[6];
else else
type = segment_type[seg->type]; type = segment_type[seg->type];
kprintf("ADDR: 0x%16p LEN: %4s TYPE: %s (%d)\n", kprintf("ADDR: %16p LEN: %4s TYPE: %s (%d)\n",
(void *)seg->addr, (void *)seg->addr,
btoa(seg->len, buf), btoa(seg->len, buf),
type, type,

View file

@ -13,7 +13,7 @@ void kmain(struct boot_info *info) {
screen_init(); screen_init();
acpi_init(info->acpi_table); acpi_init(info->acpi_table);
kprintf("enterd kmain\n"); kprintf("entered kmain\n");
//acpi_shutdown(); //acpi_shutdown();

View file

@ -709,6 +709,11 @@ void kvprintf(const char *format, va_list args) {
goto error; goto error;
} }
if (conversion == FMT_PTR) {
flags |= FLG_ALTERNATE;
flags |= FLG_ZERO;
}
print_unsigned_number(num, flags, width, precision, type, cc); print_unsigned_number(num, flags, width, precision, type, cc);
} else if (conversion == FMT_STR) { } else if (conversion == FMT_STR) {
char *str = va_arg(args, char *); char *str = va_arg(args, char *);