46 lines
1.0 KiB
C
46 lines
1.0 KiB
C
#include "uacpi/uacpi.h"
|
|
#include "dlmalloc/malloc.h"
|
|
#include "bootinfo/bootinfo.h"
|
|
#include "hal/x86_64/io.h"
|
|
#include "kprintf.h"
|
|
#include "compiler/builtins.h"
|
|
|
|
void *uacpi_kernel_alloc(uacpi_size size) {
|
|
return dlmalloc(size);
|
|
}
|
|
|
|
void uacpi_kernel_free(void *ptr) {
|
|
return dlfree(ptr);
|
|
}
|
|
|
|
void uacpi_kernel_log(uacpi_log_level lvl, const uacpi_char *s) {
|
|
char *t;
|
|
switch (lvl) {
|
|
case UACPI_LOG_DEBUG: t = "Debug"; break;
|
|
case UACPI_LOG_TRACE: t = "Trace"; break;
|
|
case UACPI_LOG_INFO: t = "Info"; break;
|
|
case UACPI_LOG_WARN: t = "Warn"; break;
|
|
case UACPI_LOG_ERROR: t = "Error"; break;
|
|
default:
|
|
unreachable();
|
|
break;
|
|
}
|
|
LOG("uACPI", "[%s] %s", t, s);
|
|
}
|
|
|
|
void *uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len) {
|
|
(void)len;
|
|
return (void *)(BOOT_INFO.hhdm_off + addr);
|
|
}
|
|
|
|
void uacpi_kernel_unmap(void *addr, uacpi_size len) {
|
|
(void)addr;
|
|
(void)len;
|
|
}
|
|
|
|
uacpi_status uacpi_kernel_get_rsdp(uacpi_phys_addr *out) {
|
|
*out = BOOT_INFO.rsdp;
|
|
return UACPI_STATUS_OK;
|
|
}
|
|
|