limine: Add kernel address request

This commit is contained in:
mintsuki 2022-03-20 19:01:24 +01:00
parent f487061f40
commit 2d048ecfde
3 changed files with 49 additions and 0 deletions

View File

@ -269,4 +269,21 @@ struct limine_boot_time_request {
LIMINE_PTR(struct limine_boot_time_response *) response;
};
// Kernel address
#define LIMINE_KERNEL_ADDRESS_REQUEST { LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 }
struct limine_kernel_address_response {
uint64_t revision;
uint64_t physical_base;
uint64_t virtual_base;
};
struct limine_kernel_address_request {
uint64_t id[4];
uint64_t revision;
LIMINE_PTR(struct limine_kernel_address_response *) response;
};
#endif

View File

@ -246,6 +246,22 @@ FEAT_START
bootloader_info_request->response = reported_addr(bootloader_info_response);
FEAT_END
// Kernel address feature
FEAT_START
struct limine_kernel_address_request *kernel_address_request = get_request(LIMINE_KERNEL_ADDRESS_REQUEST);
if (kernel_address_request == NULL) {
break; // next feature
}
struct limine_kernel_address_response *kernel_address_response =
ext_mem_alloc(sizeof(struct limine_kernel_address_response));
kernel_address_response->physical_base = physical_base;
kernel_address_response->virtual_base = virtual_base;
kernel_address_request->response = reported_addr(kernel_address_response);
FEAT_END
// HHDM feature
FEAT_START
struct limine_hhdm_request *hhdm_request = get_request(LIMINE_HHDM_REQUEST);

View File

@ -57,6 +57,11 @@ struct limine_boot_time_request boot_time_request = {
.revision = 0, .response = NULL
};
struct limine_kernel_address_request kernel_address_request = {
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
.revision = 0, .response = NULL
};
struct limine_smp_request _smp_request = {
.id = LIMINE_SMP_REQUEST,
.revision = 0, .response = NULL
@ -123,6 +128,17 @@ static void limine_main(void) {
e9_printf("Kernel slide: %x", kernel_slide);
FEAT_START
e9_printf("");
if (kernel_address_request.response == NULL) {
e9_printf("Kernel address not passed");
break;
}
struct limine_kernel_address_response *ka_response = kernel_address_request.response;
e9_printf("Physical base: %x", ka_response->physical_base);
e9_printf("Virtual base: %x", ka_response->virtual_base);
FEAT_END
FEAT_START
e9_printf("");
if (bootloader_info_request.response == NULL) {