3#define pr_fmt(fmt) "limine: " fmt
16#define limine_request __section(".limine.requests") __used static volatile
63static void ap_entry(
struct limine_smp_info *info)
65 u64 processor_id = info->processor_id;
66 pr_dinfo(limine,
"AP started: #%llu", processor_id);
72 typedef void (*init_function_t)(
void);
73 extern const init_function_t __init_array_start[], __init_array_end;
75 for (
const init_function_t *func = __init_array_start; func != &__init_array_end; func++)
84 const auto hhdm_response = hhdm.
response;
85 if (hhdm_response && hhdm_response->offset)
91#if MOS_DEBUG_FEATURE(limine)
92 pr_cont(
"bootloader: %s, version %s", bootloader_info.response ? bootloader_info.response->name :
"unknown",
93 bootloader_info.response ? bootloader_info.response->version :
"unknown");
98 mos_panic(
"Unsupported Limine base revision");
103 const auto paging_mode_response = paging_mode.
response;
104 if (paging_mode_response->mode != LIMINE_PAGING_MODE_DEFAULT)
105 mos_panic(
"non-default paging mode not supported");
110 const auto smp_response = smp.
response;
111 for (
size_t i = 0; i < smp_response->cpu_count; i++)
113 struct limine_smp_info *info = smp_response->cpus[i];
114 if (info->processor_id == 0)
117 __atomic_store_n(&info->goto_address, &
ap_entry, __ATOMIC_SEQ_CST);
120 const auto kernel_file_response = kernel_file.
response;
121 if (kernel_file_response ==
NULL)
127 if (hhdm_response ==
NULL)
136 pfn_t last_end_pfn = 0;
138 const auto memmap_response = memmap.
response;
139 for (
size_t i = 0; i < memmap_response->entry_count; i++)
148 if (last_end_pfn != start_pfn)
150 last_end_pfn = start_pfn + npages;
152 const char *typestr =
NULL;
168 const auto module_response =
module.response;
169 if (module_response ==
NULL)
172 if (module_response->module_count != 1)
173 mos_panic(
"Expected exactly one module, got %zu", module_response->module_count);
175 const auto module = module_response->modules[0];
181 const auto kernel_address_response = kernel_address.
response;
186 platform_info->k_basevaddr = kernel_address_response->virtual_base;
196 pr_dinfo2(limine,
"No RSDP found from limine");
201#if MOS_PLATFORM_HAS_FDT
208 pr_dinfo2(limine,
"No DTB found from limine");
void platform_ap_entry(u64 arg)
void console_register(Console *con)
MOSAPI void(1, 2) fatal_abort(const char *fmt
static void invoke_constructors(void)
static MOS_WARNING_POP void add_to_memmap(pfn_t start, size_t npages, bool reserved, u32 type, const char *typestr)
static void ap_entry(struct limine_smp_info *info)
#define LIMINE_MEMMAP_RESERVED
#define LIMINE_KERNEL_ADDRESS_REQUEST
#define LIMINE_STACK_SIZE_REQUEST
#define LIMINE_BASE_REVISION_SUPPORTED
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST
#define LIMINE_MEMMAP_ACPI_NVS
#define LIMINE_BOOTLOADER_INFO_REQUEST
#define LIMINE_MEMMAP_KERNEL_AND_MODULES
#define LIMINE_REQUESTS_START_MARKER
#define LIMINE_HHDM_REQUEST
#define LIMINE_DTB_REQUEST
#define LIMINE_MODULE_REQUEST
#define LIMINE_REQUESTS_END_MARKER
#define LIMINE_RSDP_REQUEST
#define LIMINE_MEMMAP_FRAMEBUFFER
#define LIMINE_BASE_REVISION(N)
#define LIMINE_SMP_REQUEST
#define LIMINE_MEMMAP_ACPI_RECLAIMABLE
#define LIMINE_KERNEL_FILE_REQUEST
#define LIMINE_MEMMAP_REQUEST
#define LIMINE_MEMMAP_USABLE
#define LIMINE_FRAMEBUFFER_REQUEST
#define LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE
#define LIMINE_MEMMAP_BAD_MEMORY
#define LIMINE_PAGING_MODE_REQUEST
void mos_cmdline_init(const char *bootloader_cmdline)
#define ALIGN_UP_TO_PAGE(addr)
#define MOS_WARNING_DISABLE(text)
#define mos_panic(fmt,...)
#define pr_info2(fmt,...)
#define pr_dinfo(feat, fmt,...)
#define pr_dinfo2(feat, fmt,...)
void startup_invoke_early_cmdline_hooks(void)
struct limine_dtb_response * response
struct limine_hhdm_response * response
struct limine_kernel_address_response * response
struct limine_kernel_file_response * response
struct limine_memmap_response * response
struct limine_paging_mode_response * response
struct limine_rsdp_response * response
struct limine_smp_response * response
#define PFNADDR(pfn, end)