mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 13:48:21 +00:00
kernel: update limine to 11 and use base revision 6
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <uacpi/kernel_api.h>
|
||||
|
||||
static volatile struct limine_rsdp_request rsdp_request = {
|
||||
.id = LIMINE_RSDP_REQUEST,
|
||||
.id = LIMINE_RSDP_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
|
||||
@@ -314,8 +314,8 @@ static mmuflags_t kernelflags[3] = {
|
||||
|
||||
extern volatile struct limine_memmap_request pmm_liminemap;
|
||||
|
||||
static volatile struct limine_kernel_address_request kaddrreq = {
|
||||
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
|
||||
static volatile struct limine_executable_address_request kaddrreq = {
|
||||
.id = LIMINE_EXECUTABLE_ADDRESS_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -389,11 +389,13 @@ void arch_mmu_init() {
|
||||
|
||||
for (size_t i = 0; i < pmm_liminemap.response->entry_count; ++i) {
|
||||
struct limine_memmap_entry *e = pmm_liminemap.response->entries[i];
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_KERNEL_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_EXECUTABLE_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
continue;
|
||||
|
||||
for (uint64_t i = 0; i < e->length; i += PAGE_SIZE) {
|
||||
uint64_t entry = ((e->base + i) & ADDRMASK) | ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_WRITE | ARCH_MMU_FLAGS_NOEXEC | ARCH_MMU_FLAGS_GLOBAL;
|
||||
if (e->type == LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
entry |= ARCH_MMU_FLAGS_WC;
|
||||
__assert(add_page(FROM_HHDM(template), MAKE_HHDM((void *)(e->base + i)), entry, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,22 +12,22 @@
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nosmp, bool);
|
||||
|
||||
static volatile struct limine_smp_request smprequest = {
|
||||
.id = LIMINE_SMP_REQUEST
|
||||
static volatile struct limine_mp_request smprequest = {
|
||||
.id = LIMINE_MP_REQUEST_ID
|
||||
};
|
||||
|
||||
// set to 1 because of the bsp
|
||||
size_t arch_smp_cpusawake = 1;
|
||||
|
||||
// for panic. if the nosmp argument is given to the kernel, this is what the APs will jump to
|
||||
static void cpuwakeuphalt(struct limine_smp_info *info) {
|
||||
static void cpuwakeuphalt(struct limine_mp_info *info) {
|
||||
asm("cli");
|
||||
for (;;) CPU_HALT();
|
||||
}
|
||||
|
||||
static long next_id = 1;
|
||||
|
||||
static void cpuwakeup(struct limine_smp_info *info) {
|
||||
static void cpuwakeup(struct limine_mp_info *info) {
|
||||
cpu_set((cpu_t *)info->extra_argument);
|
||||
|
||||
current_cpu()->internal_id = __atomic_fetch_add(&next_id, 1, __ATOMIC_SEQ_CST);
|
||||
@@ -69,7 +69,7 @@ size_t arch_smp_get_cpu_count(void) {
|
||||
if (GET_KERNEL_ARGUMENT(nosmp, bool))
|
||||
return 1;
|
||||
|
||||
struct limine_smp_response *response = smprequest.response;
|
||||
struct limine_mp_response *response = smprequest.response;
|
||||
if (response == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -84,7 +84,7 @@ cpu_t *arch_smp_get_cpu_by_internal_id(long id) {
|
||||
}
|
||||
|
||||
void arch_smp_wakeup(void) {
|
||||
struct limine_smp_response *response = smprequest.response;
|
||||
struct limine_mp_response *response = smprequest.response;
|
||||
if (response == NULL) {
|
||||
// TODO try to detect the other processors manually
|
||||
printf("smp: limine smp request response not present\n");
|
||||
@@ -103,7 +103,7 @@ void arch_smp_wakeup(void) {
|
||||
smp_cpus = alloc(response->cpu_count * sizeof(cpu_t *));
|
||||
__assert(smp_cpus);
|
||||
|
||||
void (*wakeupfn)(struct limine_smp_info *) = GET_KERNEL_ARGUMENT(nosmp, bool) ? cpuwakeuphalt : cpuwakeup;
|
||||
void (*wakeupfn)(struct limine_mp_info *) = GET_KERNEL_ARGUMENT(nosmp, bool) ? cpuwakeuphalt : cpuwakeup;
|
||||
|
||||
// make the other processors jump to cpuwakeup()
|
||||
for (int i = 0; i < response->cpu_count; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user