2022-03-12 21:40:49 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limine.h>
|
|
|
|
#include <e9print.h>
|
2023-08-04 15:56:07 +03:00
|
|
|
#include <flanterm/flanterm.h>
|
|
|
|
#include <flanterm/backends/fb.h>
|
2022-03-12 21:40:49 +03:00
|
|
|
|
2022-03-13 07:35:29 +03:00
|
|
|
static void limine_main(void);
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_entry_point_request entry_point_request = {
|
2022-03-13 07:35:29 +03:00
|
|
|
.id = LIMINE_ENTRY_POINT_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL,
|
2022-03-13 07:35:29 +03:00
|
|
|
|
|
|
|
.entry = limine_main
|
2022-03-12 21:40:49 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *entry_point_req = &entry_point_request;
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_framebuffer_request framebuffer_request = {
|
|
|
|
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-18 00:47:58 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *framebuffer_req = &framebuffer_request;
|
|
|
|
|
2022-03-18 05:08:47 +03:00
|
|
|
struct limine_bootloader_info_request bootloader_info_request = {
|
|
|
|
.id = LIMINE_BOOTLOADER_INFO_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-18 05:08:47 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *bootloader_info_req = &bootloader_info_request;
|
|
|
|
|
2022-03-18 05:08:47 +03:00
|
|
|
struct limine_hhdm_request hhdm_request = {
|
|
|
|
.id = LIMINE_HHDM_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-13 07:35:29 +03:00
|
|
|
};
|
2022-03-12 21:40:49 +03:00
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *hhdm_req = &hhdm_request;
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_memmap_request memmap_request = {
|
2022-03-13 07:35:29 +03:00
|
|
|
.id = LIMINE_MEMMAP_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-12 21:40:49 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *memmap_req = &memmap_request;
|
|
|
|
|
2022-03-26 11:27:09 +03:00
|
|
|
struct limine_kernel_file_request kf_request = {
|
|
|
|
.id = LIMINE_KERNEL_FILE_REQUEST,
|
|
|
|
.revision = 0, .response = NULL
|
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *kf_req = &kf_request;
|
|
|
|
|
2023-03-24 03:02:31 +03:00
|
|
|
struct limine_internal_module internal_module1 = {
|
2023-03-24 12:18:18 +03:00
|
|
|
.path = "/boot/test.elf",
|
2023-03-24 03:02:31 +03:00
|
|
|
.cmdline = "First internal module"
|
|
|
|
};
|
|
|
|
|
2023-03-24 12:18:18 +03:00
|
|
|
struct limine_internal_module internal_module2 = {
|
|
|
|
.path = "test.elf",
|
|
|
|
.cmdline = "Second internal module"
|
|
|
|
};
|
|
|
|
|
2023-03-30 03:43:52 +03:00
|
|
|
struct limine_internal_module internal_module3 = {
|
|
|
|
.path = "./limine.cfg",
|
2023-06-03 02:51:17 +03:00
|
|
|
.cmdline = "Third internal module"
|
2023-03-30 03:43:52 +03:00
|
|
|
};
|
|
|
|
|
2023-03-24 03:02:31 +03:00
|
|
|
struct limine_internal_module *internal_modules[] = {
|
2023-03-24 12:18:18 +03:00
|
|
|
&internal_module1,
|
2023-03-30 03:43:52 +03:00
|
|
|
&internal_module2,
|
|
|
|
&internal_module3
|
2023-03-24 03:02:31 +03:00
|
|
|
};
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_module_request module_request = {
|
2022-03-16 08:49:41 +03:00
|
|
|
.id = LIMINE_MODULE_REQUEST,
|
2023-03-24 03:02:31 +03:00
|
|
|
.revision = 1, .response = NULL,
|
|
|
|
|
2023-03-30 03:43:52 +03:00
|
|
|
.internal_module_count = 3,
|
2023-03-24 03:02:31 +03:00
|
|
|
.internal_modules = internal_modules
|
2022-03-16 08:49:41 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *module_req = &module_request;
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_rsdp_request rsdp_request = {
|
2022-03-17 21:21:35 +03:00
|
|
|
.id = LIMINE_RSDP_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-17 21:21:35 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *rsdp_req = &rsdp_request;
|
|
|
|
|
2022-03-18 00:47:58 +03:00
|
|
|
struct limine_smbios_request smbios_request = {
|
2022-03-17 21:59:03 +03:00
|
|
|
.id = LIMINE_SMBIOS_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-17 21:59:03 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *smbios_req = &smbios_request;
|
|
|
|
|
2022-03-20 10:05:12 +03:00
|
|
|
struct limine_efi_system_table_request est_request = {
|
|
|
|
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
|
|
|
|
.revision = 0, .response = NULL
|
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *est_req = &est_request;
|
|
|
|
|
2022-03-20 10:19:32 +03:00
|
|
|
struct limine_boot_time_request boot_time_request = {
|
|
|
|
.id = LIMINE_BOOT_TIME_REQUEST,
|
|
|
|
.revision = 0, .response = NULL
|
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *boot_time_req = &boot_time_request;
|
|
|
|
|
2022-03-20 21:01:24 +03:00
|
|
|
struct limine_kernel_address_request kernel_address_request = {
|
|
|
|
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
|
|
|
|
.revision = 0, .response = NULL
|
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *kernel_address_req = &kernel_address_request;
|
|
|
|
|
2022-03-18 03:17:56 +03:00
|
|
|
struct limine_smp_request _smp_request = {
|
|
|
|
.id = LIMINE_SMP_REQUEST,
|
2022-03-20 02:57:10 +03:00
|
|
|
.revision = 0, .response = NULL
|
2022-03-18 03:17:56 +03:00
|
|
|
};
|
|
|
|
|
2022-04-14 21:34:59 +03:00
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *smp_req = &_smp_request;
|
|
|
|
|
2022-08-18 18:32:54 +03:00
|
|
|
struct limine_dtb_request _dtb_request = {
|
|
|
|
.id = LIMINE_DTB_REQUEST,
|
|
|
|
.revision = 0, .response = NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *dtb_req = &_dtb_request;
|
|
|
|
|
2023-06-04 02:36:06 +03:00
|
|
|
struct limine_paging_mode_request _pm_request = {
|
|
|
|
.id = LIMINE_PAGING_MODE_REQUEST,
|
|
|
|
.revision = 0, .response = NULL,
|
|
|
|
.mode = LIMINE_PAGING_MODE_DEFAULT,
|
|
|
|
.flags = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
__attribute__((section(".limine_reqs")))
|
|
|
|
void *pm_req = &_pm_request;
|
|
|
|
|
2022-03-12 23:41:36 +03:00
|
|
|
static char *get_memmap_type(uint64_t type) {
|
|
|
|
switch (type) {
|
|
|
|
case LIMINE_MEMMAP_USABLE:
|
|
|
|
return "Usable";
|
|
|
|
case LIMINE_MEMMAP_RESERVED:
|
|
|
|
return "Reserved";
|
|
|
|
case LIMINE_MEMMAP_ACPI_RECLAIMABLE:
|
|
|
|
return "ACPI reclaimable";
|
|
|
|
case LIMINE_MEMMAP_ACPI_NVS:
|
|
|
|
return "ACPI NVS";
|
|
|
|
case LIMINE_MEMMAP_BAD_MEMORY:
|
|
|
|
return "Bad memory";
|
|
|
|
case LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE:
|
|
|
|
return "Bootloader reclaimable";
|
|
|
|
case LIMINE_MEMMAP_KERNEL_AND_MODULES:
|
|
|
|
return "Kernel and modules";
|
|
|
|
case LIMINE_MEMMAP_FRAMEBUFFER:
|
|
|
|
return "Framebuffer";
|
|
|
|
default:
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-26 11:27:09 +03:00
|
|
|
static void print_file(struct limine_file *file) {
|
|
|
|
e9_printf("File->Revision: %d", file->revision);
|
2022-03-31 10:03:06 +03:00
|
|
|
e9_printf("File->Address: %x", file->address);
|
|
|
|
e9_printf("File->Size: %x", file->size);
|
2022-03-26 11:27:09 +03:00
|
|
|
e9_printf("File->Path: %s", file->path);
|
|
|
|
e9_printf("File->CmdLine: %s", file->cmdline);
|
2022-04-02 11:28:07 +03:00
|
|
|
e9_printf("File->MediaType: %d", file->media_type);
|
2022-03-26 11:27:09 +03:00
|
|
|
e9_printf("File->PartIndex: %d", file->partition_index);
|
|
|
|
e9_printf("File->TFTPIP: %d.%d.%d.%d",
|
|
|
|
(file->tftp_ip & (0xff << 0)) >> 0,
|
|
|
|
(file->tftp_ip & (0xff << 8)) >> 8,
|
|
|
|
(file->tftp_ip & (0xff << 16)) >> 16,
|
|
|
|
(file->tftp_ip & (0xff << 24)) >> 24);
|
|
|
|
e9_printf("File->TFTPPort: %d", file->tftp_port);
|
|
|
|
e9_printf("File->MBRDiskId: %x", file->mbr_disk_id);
|
|
|
|
e9_printf("File->GPTDiskUUID: %x-%x-%x-%x",
|
|
|
|
file->gpt_disk_uuid.a,
|
|
|
|
file->gpt_disk_uuid.b,
|
|
|
|
file->gpt_disk_uuid.c,
|
|
|
|
*(uint64_t *)file->gpt_disk_uuid.d);
|
|
|
|
e9_printf("File->GPTPartUUID: %x-%x-%x-%x",
|
|
|
|
file->gpt_part_uuid.a,
|
|
|
|
file->gpt_part_uuid.b,
|
|
|
|
file->gpt_part_uuid.c,
|
|
|
|
*(uint64_t *)file->gpt_part_uuid.d);
|
|
|
|
e9_printf("File->PartUUID: %x-%x-%x-%x",
|
|
|
|
file->part_uuid.a,
|
|
|
|
file->part_uuid.b,
|
|
|
|
file->part_uuid.c,
|
|
|
|
*(uint64_t *)file->part_uuid.d);
|
2022-03-16 08:49:41 +03:00
|
|
|
}
|
|
|
|
|
2022-08-18 18:32:54 +03:00
|
|
|
uint32_t ctr = 0;
|
|
|
|
|
|
|
|
void ap_entry(struct limine_smp_info *info) {
|
|
|
|
e9_printf("Hello from AP!");
|
|
|
|
|
|
|
|
#if defined (__x86_64__)
|
|
|
|
e9_printf("My LAPIC ID: %x", info->lapic_id);
|
|
|
|
#elif defined (__aarch64__)
|
|
|
|
e9_printf("My GIC CPU Interface no.: %x", info->gic_iface_no);
|
|
|
|
e9_printf("My MPIDR: %x", info->mpidr);
|
2023-06-04 02:36:06 +03:00
|
|
|
#elif defined (__riscv)
|
|
|
|
e9_printf("My Hart ID: %x", info->hartid);
|
2022-08-18 18:32:54 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
__atomic_fetch_add(&ctr, 1, __ATOMIC_SEQ_CST);
|
|
|
|
|
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
|
2022-03-12 21:40:49 +03:00
|
|
|
#define FEAT_START do {
|
|
|
|
#define FEAT_END } while (0);
|
|
|
|
|
2022-03-18 01:46:48 +03:00
|
|
|
extern char kernel_start[];
|
|
|
|
|
2023-08-04 15:56:07 +03:00
|
|
|
struct flanterm_context *ft_ctx = NULL;
|
|
|
|
|
2023-08-04 17:54:24 +03:00
|
|
|
static void limine_main(void) {
|
2022-03-18 01:46:48 +03:00
|
|
|
e9_printf("\nWe're alive");
|
|
|
|
|
2023-08-04 15:56:07 +03:00
|
|
|
struct limine_framebuffer *fb = framebuffer_request.response->framebuffers[0];
|
|
|
|
|
|
|
|
ft_ctx = flanterm_fb_simple_init(
|
|
|
|
fb->address,
|
|
|
|
fb->width,
|
|
|
|
fb->height,
|
2023-10-24 06:29:45 +03:00
|
|
|
fb->pitch,
|
|
|
|
fb->red_mask_size,
|
|
|
|
fb->red_mask_shift,
|
|
|
|
fb->green_mask_size,
|
|
|
|
fb->green_mask_shift,
|
|
|
|
fb->blue_mask_size,
|
|
|
|
fb->blue_mask_shift
|
2023-08-04 15:56:07 +03:00
|
|
|
);
|
|
|
|
|
2022-03-18 01:46:48 +03:00
|
|
|
uint64_t kernel_slide = (uint64_t)kernel_start - 0xffffffff80000000;
|
|
|
|
|
|
|
|
e9_printf("Kernel slide: %x", kernel_slide);
|
2022-03-12 21:40:49 +03:00
|
|
|
|
2022-03-20 21:01:24 +03:00
|
|
|
FEAT_START
|
|
|
|
e9_printf("");
|
2022-03-20 23:23:47 +03:00
|
|
|
if (bootloader_info_request.response == NULL) {
|
|
|
|
e9_printf("Bootloader info not passed");
|
2022-03-20 21:01:24 +03:00
|
|
|
break;
|
|
|
|
}
|
2022-03-20 23:23:47 +03:00
|
|
|
struct limine_bootloader_info_response *bootloader_info_response = bootloader_info_request.response;
|
|
|
|
e9_printf("Bootloader info feature, revision %d", bootloader_info_response->revision);
|
|
|
|
e9_printf("Bootloader name: %s", bootloader_info_response->name);
|
|
|
|
e9_printf("Bootloader version: %s", bootloader_info_response->version);
|
2022-03-20 21:01:24 +03:00
|
|
|
FEAT_END
|
|
|
|
|
2022-03-12 21:40:49 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-20 23:23:47 +03:00
|
|
|
if (kernel_address_request.response == NULL) {
|
|
|
|
e9_printf("Kernel address not passed");
|
2022-03-12 21:40:49 +03:00
|
|
|
break;
|
|
|
|
}
|
2022-03-20 23:23:47 +03:00
|
|
|
struct limine_kernel_address_response *ka_response = kernel_address_request.response;
|
|
|
|
e9_printf("Kernel address feature, revision %d", ka_response->revision);
|
|
|
|
e9_printf("Physical base: %x", ka_response->physical_base);
|
|
|
|
e9_printf("Virtual base: %x", ka_response->virtual_base);
|
2022-03-18 05:08:47 +03:00
|
|
|
FEAT_END
|
|
|
|
|
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-18 05:08:47 +03:00
|
|
|
if (hhdm_request.response == NULL) {
|
|
|
|
e9_printf("HHDM not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_hhdm_response *hhdm_response = hhdm_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("HHDM feature, revision %d", hhdm_response->revision);
|
2022-03-24 04:18:33 +03:00
|
|
|
e9_printf("Higher half direct map at: %x", hhdm_response->offset);
|
2022-03-12 23:41:36 +03:00
|
|
|
FEAT_END
|
2022-03-12 21:40:49 +03:00
|
|
|
|
2022-03-12 23:41:36 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-13 07:35:29 +03:00
|
|
|
if (memmap_request.response == NULL) {
|
2022-03-12 23:41:36 +03:00
|
|
|
e9_printf("Memory map not passed");
|
|
|
|
break;
|
|
|
|
}
|
2022-03-13 07:35:29 +03:00
|
|
|
struct limine_memmap_response *memmap_response = memmap_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("Memory map feature, revision %d", memmap_response->revision);
|
|
|
|
e9_printf("%d memory map entries", memmap_response->entry_count);
|
|
|
|
for (size_t i = 0; i < memmap_response->entry_count; i++) {
|
2022-03-20 22:28:44 +03:00
|
|
|
struct limine_memmap_entry *e = memmap_response->entries[i];
|
2022-03-20 21:13:18 +03:00
|
|
|
e9_printf("%x->%x %s", e->base, e->base + e->length, get_memmap_type(e->type));
|
2022-03-12 23:41:36 +03:00
|
|
|
}
|
2022-03-12 21:40:49 +03:00
|
|
|
FEAT_END
|
|
|
|
|
2022-03-14 14:05:59 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-14 14:05:59 +03:00
|
|
|
if (framebuffer_request.response == NULL) {
|
|
|
|
e9_printf("Framebuffer not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_framebuffer_response *fb_response = framebuffer_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("Framebuffers feature, revision %d", fb_response->revision);
|
|
|
|
e9_printf("%d framebuffer(s)", fb_response->framebuffer_count);
|
|
|
|
for (size_t i = 0; i < fb_response->framebuffer_count; i++) {
|
|
|
|
struct limine_framebuffer *fb = fb_response->framebuffers[i];
|
2022-03-20 21:11:22 +03:00
|
|
|
e9_printf("Address: %x", fb->address);
|
|
|
|
e9_printf("Width: %d", fb->width);
|
|
|
|
e9_printf("Height: %d", fb->height);
|
|
|
|
e9_printf("Pitch: %d", fb->pitch);
|
|
|
|
e9_printf("BPP: %d", fb->bpp);
|
|
|
|
e9_printf("Memory model: %d", fb->memory_model);
|
|
|
|
e9_printf("Red mask size: %d", fb->red_mask_size);
|
|
|
|
e9_printf("Red mask shift: %d", fb->red_mask_shift);
|
|
|
|
e9_printf("Green mask size: %d", fb->green_mask_size);
|
|
|
|
e9_printf("Green mask shift: %d", fb->green_mask_shift);
|
|
|
|
e9_printf("Blue mask size: %d", fb->blue_mask_size);
|
|
|
|
e9_printf("Blue mask shift: %d", fb->blue_mask_shift);
|
|
|
|
e9_printf("EDID size: %d", fb->edid_size);
|
|
|
|
e9_printf("EDID at: %x", fb->edid);
|
2022-10-14 06:17:24 +03:00
|
|
|
e9_printf("Video modes:");
|
|
|
|
for (size_t j = 0; j < fb->mode_count; j++) {
|
|
|
|
e9_printf(" %dx%dx%d", fb->modes[j]->width, fb->modes[j]->height, fb->modes[j]->bpp);
|
|
|
|
}
|
2022-03-14 14:05:59 +03:00
|
|
|
}
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-26 11:27:09 +03:00
|
|
|
FEAT_START
|
|
|
|
e9_printf("");
|
|
|
|
if (kf_request.response == NULL) {
|
|
|
|
e9_printf("Kernel file not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_kernel_file_response *kf_response = kf_request.response;
|
|
|
|
e9_printf("Kernel file feature, revision %d", kf_response->revision);
|
|
|
|
print_file(kf_response->kernel_file);
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-16 08:49:41 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-16 08:49:41 +03:00
|
|
|
if (module_request.response == NULL) {
|
|
|
|
e9_printf("Modules not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_module_response *module_response = module_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("Modules feature, revision %d", module_response->revision);
|
|
|
|
e9_printf("%d module(s)", module_response->module_count);
|
|
|
|
for (size_t i = 0; i < module_response->module_count; i++) {
|
2022-03-26 11:27:09 +03:00
|
|
|
struct limine_file *f = module_response->modules[i];
|
|
|
|
e9_printf("---");
|
|
|
|
print_file(f);
|
2022-03-16 08:49:41 +03:00
|
|
|
}
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-17 21:21:35 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-17 21:21:35 +03:00
|
|
|
if (rsdp_request.response == NULL) {
|
|
|
|
e9_printf("RSDP not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_rsdp_response *rsdp_response = rsdp_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("RSDP feature, revision %d", rsdp_response->revision);
|
2022-03-17 21:21:35 +03:00
|
|
|
e9_printf("RSDP at: %x", rsdp_response->address);
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-17 21:59:03 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
2022-03-17 21:59:03 +03:00
|
|
|
if (smbios_request.response == NULL) {
|
|
|
|
e9_printf("SMBIOS not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_smbios_response *smbios_response = smbios_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("SMBIOS feature, revision %d", smbios_response->revision);
|
2022-03-17 21:59:03 +03:00
|
|
|
e9_printf("SMBIOS 32-bit entry at: %x", smbios_response->entry_32);
|
|
|
|
e9_printf("SMBIOS 64-bit entry at: %x", smbios_response->entry_64);
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-18 03:17:56 +03:00
|
|
|
FEAT_START
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("");
|
|
|
|
if (est_request.response == NULL) {
|
|
|
|
e9_printf("EFI system table not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_efi_system_table_response *est_response = est_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("EFI system table feature, revision %d", est_response->revision);
|
2022-03-20 10:05:12 +03:00
|
|
|
e9_printf("EFI system table at: %x", est_response->address);
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-20 10:19:32 +03:00
|
|
|
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;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("Boot time feature, revision %d", boot_time_response->revision);
|
|
|
|
e9_printf("Boot time: %d", boot_time_response->boot_time);
|
2022-03-20 10:19:32 +03:00
|
|
|
FEAT_END
|
|
|
|
|
2022-03-20 10:05:12 +03:00
|
|
|
FEAT_START
|
|
|
|
e9_printf("");
|
2022-03-18 03:17:56 +03:00
|
|
|
if (_smp_request.response == NULL) {
|
|
|
|
e9_printf("SMP info not passed");
|
|
|
|
break;
|
|
|
|
}
|
2022-03-18 05:08:47 +03:00
|
|
|
struct limine_smp_response *smp_response = _smp_request.response;
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("SMP feature, revision %d", smp_response->revision);
|
2022-03-18 03:17:56 +03:00
|
|
|
e9_printf("Flags: %x", smp_response->flags);
|
2022-08-18 18:32:54 +03:00
|
|
|
#if defined (__x86_64__)
|
2022-03-18 03:17:56 +03:00
|
|
|
e9_printf("BSP LAPIC ID: %x", smp_response->bsp_lapic_id);
|
2022-08-18 18:32:54 +03:00
|
|
|
#elif defined (__aarch64__)
|
|
|
|
e9_printf("BSP MPIDR: %x", smp_response->bsp_mpidr);
|
2023-06-04 02:36:06 +03:00
|
|
|
#elif defined (__riscv)
|
|
|
|
e9_printf("BSP Hart ID: %x", smp_response->bsp_hartid);
|
2022-08-18 18:32:54 +03:00
|
|
|
#endif
|
2022-03-20 23:23:47 +03:00
|
|
|
e9_printf("CPU count: %d", smp_response->cpu_count);
|
|
|
|
for (size_t i = 0; i < smp_response->cpu_count; i++) {
|
2022-03-20 22:28:44 +03:00
|
|
|
struct limine_smp_info *cpu = smp_response->cpus[i];
|
2022-03-20 21:12:55 +03:00
|
|
|
e9_printf("Processor ID: %x", cpu->processor_id);
|
2022-08-18 18:32:54 +03:00
|
|
|
#if defined (__x86_64__)
|
2022-03-20 21:12:55 +03:00
|
|
|
e9_printf("LAPIC ID: %x", cpu->lapic_id);
|
2022-08-18 18:32:54 +03:00
|
|
|
#elif defined (__aarch64__)
|
|
|
|
e9_printf("GIC CPU Interface no.: %x", cpu->gic_iface_no);
|
|
|
|
e9_printf("MPIDR: %x", cpu->mpidr);
|
2023-06-04 02:36:06 +03:00
|
|
|
#elif defined (__riscv)
|
|
|
|
e9_printf("Hart ID: %x", cpu->hartid);
|
2022-08-18 18:32:54 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (__x86_64__)
|
|
|
|
if (cpu->lapic_id != smp_response->bsp_lapic_id) {
|
|
|
|
#elif defined (__aarch64__)
|
|
|
|
if (cpu->mpidr != smp_response->bsp_mpidr) {
|
2023-06-04 02:36:06 +03:00
|
|
|
#elif defined (__riscv)
|
|
|
|
if (cpu->hartid != smp_response->bsp_hartid) {
|
2022-08-18 18:32:54 +03:00
|
|
|
#endif
|
|
|
|
uint32_t old_ctr = __atomic_load_n(&ctr, __ATOMIC_SEQ_CST);
|
|
|
|
|
|
|
|
__atomic_store_n(&cpu->goto_address, ap_entry, __ATOMIC_SEQ_CST);
|
|
|
|
|
|
|
|
while (__atomic_load_n(&ctr, __ATOMIC_SEQ_CST) == old_ctr)
|
|
|
|
;
|
|
|
|
}
|
2022-03-18 03:17:56 +03:00
|
|
|
}
|
|
|
|
FEAT_END
|
|
|
|
|
2022-08-18 18:32:54 +03:00
|
|
|
FEAT_START
|
|
|
|
e9_printf("");
|
|
|
|
if (_dtb_request.response == NULL) {
|
|
|
|
e9_printf("Device tree blob not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_dtb_response *dtb_response = _dtb_request.response;
|
|
|
|
e9_printf("Device tree blob feature, revision %d", dtb_response->revision);
|
|
|
|
e9_printf("Device tree blob pointer: %x", dtb_response->dtb_ptr);
|
|
|
|
FEAT_END
|
|
|
|
|
2023-06-04 02:36:06 +03:00
|
|
|
FEAT_START
|
|
|
|
e9_printf("");
|
|
|
|
if (_pm_request.response == NULL) {
|
|
|
|
e9_printf("Paging mode not passed");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
struct limine_paging_mode_response *pm_response = _pm_request.response;
|
|
|
|
e9_printf("Paging mode feature, revision %d", pm_response->revision);
|
|
|
|
e9_printf(" mode: %d", pm_response->mode);
|
|
|
|
e9_printf(" flags: %x", pm_response->flags);
|
|
|
|
FEAT_END
|
|
|
|
|
2022-03-12 21:40:49 +03:00
|
|
|
for (;;);
|
|
|
|
}
|