limine: Add boot time request

This commit is contained in:
mintsuki 2022-03-20 08:19:32 +01:00
parent 38233a2405
commit f487061f40
3 changed files with 46 additions and 0 deletions

View File

@ -253,4 +253,20 @@ struct limine_efi_system_table_request {
LIMINE_PTR(struct limine_efi_system_table_response *) response;
};
// Boot time
#define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
struct limine_boot_time_response {
uint64_t revision;
int64_t boot_time;
};
struct limine_boot_time_request {
uint64_t id[4];
uint64_t revision;
LIMINE_PTR(struct limine_boot_time_response *) response;
};
#endif

View File

@ -477,6 +477,21 @@ FEAT_START
framebuffer_request->response = reported_addr(framebuffer_response);
FEAT_END
// Boot time feature
FEAT_START
struct limine_boot_time_request *boot_time_request = get_request(LIMINE_BOOT_TIME_REQUEST);
if (boot_time_request == NULL) {
break; // next feature
}
struct limine_boot_time_response *boot_time_response =
ext_mem_alloc(sizeof(struct limine_boot_time_response));
boot_time_response->boot_time = time();
boot_time_request->response = reported_addr(boot_time_response);
FEAT_END
// Wrap-up stuff before memmap close
struct gdtr *local_gdt = ext_mem_alloc(sizeof(struct gdtr));
local_gdt->limit = gdt.limit;

View File

@ -52,6 +52,11 @@ struct limine_efi_system_table_request est_request = {
.revision = 0, .response = NULL
};
struct limine_boot_time_request boot_time_request = {
.id = LIMINE_BOOT_TIME_REQUEST,
.revision = 0, .response = NULL
};
struct limine_smp_request _smp_request = {
.id = LIMINE_SMP_REQUEST,
.revision = 0, .response = NULL
@ -229,6 +234,16 @@ FEAT_START
e9_printf("EFI system table at: %x", est_response->address);
FEAT_END
FEAT_START
e9_printf("");
if (boot_time_request.response == NULL) {
e9_printf("Boot time not passed");
break;
}
struct limine_boot_time_response *boot_time_response = boot_time_request.response;
e9_printf("Kernel boot time: %d", boot_time_response->boot_time);
FEAT_END
FEAT_START
e9_printf("");
if (_smp_request.response == NULL) {