2020-09-30 01:31:42 +03:00
|
|
|
#include <stivale.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <e9print.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
static uint8_t stack[4096] = {0};
|
|
|
|
void stivale_main(struct stivale_struct *info);
|
|
|
|
|
|
|
|
__attribute__((section(".stivalehdr"), used))
|
|
|
|
struct stivale_header header = {
|
|
|
|
.stack = (uint64_t)(uintptr_t)stack + sizeof(stack),
|
|
|
|
.framebuffer_bpp = 0,
|
|
|
|
.framebuffer_width = 0,
|
|
|
|
.framebuffer_height = 0,
|
2021-11-10 09:41:25 +03:00
|
|
|
.flags = (1 << 3) | (1 << 4),
|
2020-09-30 01:31:42 +03:00
|
|
|
.entry_point = (uint64_t)(uintptr_t)stivale_main
|
|
|
|
};
|
|
|
|
|
|
|
|
void stivale_main(struct stivale_struct *info) {
|
2021-05-04 16:17:36 +03:00
|
|
|
e9_printf("Stivale struct at %x", info);
|
|
|
|
|
2020-09-30 01:31:42 +03:00
|
|
|
e9_puts("Stivale information passed to the kernel:");
|
|
|
|
e9_printf("Cmdline: %s", (char*)info->cmdline);
|
|
|
|
e9_printf("Memory map at %x with contents:", info->memory_map_addr);
|
|
|
|
|
|
|
|
struct stivale_mmap_entry *memmap = ((struct stivale_mmap_entry *)(info->memory_map_addr));
|
|
|
|
for (size_t i = 0; i < info->memory_map_entries; i++) {
|
|
|
|
struct stivale_mmap_entry e = memmap[i];
|
|
|
|
e9_printf("\tEntry %d: [%x+%x] %x", i, e.base, e.length, e.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
e9_printf("Framebuffer at %x with specifics:", info->framebuffer_addr);
|
|
|
|
e9_printf("\tPitch: %d", info->framebuffer_pitch);
|
|
|
|
e9_printf("\tWidth: %d", info->framebuffer_width);
|
|
|
|
e9_printf("\tHeight: %d", info->framebuffer_height);
|
|
|
|
e9_printf("\tBPP: %d", info->framebuffer_bpp);
|
2020-12-05 04:10:02 +03:00
|
|
|
if (info->flags & (1 << 1)) {
|
2021-04-28 21:15:24 +03:00
|
|
|
e9_printf("\tExtended colour information provided:");
|
2020-12-05 04:10:02 +03:00
|
|
|
e9_printf("\t\tMemory model: %d", info->fb_memory_model);
|
|
|
|
e9_printf("\t\tRed mask size: %d", info->fb_red_mask_size);
|
|
|
|
e9_printf("\t\tRed mask shift: %d", info->fb_red_mask_shift);
|
|
|
|
e9_printf("\t\tGreen mask size: %d", info->fb_green_mask_size);
|
|
|
|
e9_printf("\t\tGreen mask shift: %d", info->fb_green_mask_shift);
|
|
|
|
e9_printf("\t\tBlue mask size: %d", info->fb_blue_mask_size);
|
|
|
|
e9_printf("\t\tBlue mask shift: %d", info->fb_blue_mask_shift);
|
|
|
|
}
|
2021-04-28 21:15:24 +03:00
|
|
|
if (info->flags & (1 << 2)) {
|
|
|
|
e9_printf("\tSMBIOS information provided:");
|
|
|
|
e9_printf("\t\t32-bit entry: %x", info->smbios_entry_32);
|
|
|
|
e9_printf("\t\t64-bit entry: %x", info->smbios_entry_64);
|
|
|
|
}
|
2020-12-05 04:10:02 +03:00
|
|
|
|
2020-09-30 01:31:42 +03:00
|
|
|
e9_printf("RSDP at %x", info->rsdp);
|
|
|
|
|
|
|
|
e9_printf("Module map at %x with modules:", info->modules);
|
|
|
|
struct stivale_module *modules = ((struct stivale_module *)(info->modules));
|
|
|
|
for (size_t i = 0; i < info->module_count; i++) {
|
|
|
|
struct stivale_module e = *modules;
|
2021-05-04 16:17:36 +03:00
|
|
|
e9_printf("\tModule %d: [%x->%x] %s", i, e.begin, e.end, e.string);
|
2020-09-30 01:31:42 +03:00
|
|
|
modules = (struct stivale_module *)e.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
e9_printf("Epoch is %x", info->epoch);
|
|
|
|
e9_printf("Flags are %x", info->flags);
|
|
|
|
|
|
|
|
// Guru meditation.
|
|
|
|
for (;;);
|
|
|
|
}
|