Skip to content

Commit

Permalink
boot/x86: inline try_boot_sys_node()
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-h committed Jun 21, 2023
1 parent 7eda6d3 commit c0e4a97
Showing 1 changed file with 46 additions and 54 deletions.
100 changes: 46 additions & 54 deletions src/arch/x86/kernel/boot_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,59 +139,6 @@ BOOT_CODE static paddr_t load_boot_module(word_t boot_module_start, paddr_t load
return load_paddr;
}

static BOOT_CODE bool_t try_boot_sys_node(cpu_id_t cpu_id)
{
p_region_t boot_mem_reuse_p_reg;

if (!map_kernel_window(
boot_state.num_ioapic,
boot_state.ioapic_paddr,
boot_state.num_drhu,
boot_state.drhu_list
)) {
return false;
}
setCurrentVSpaceRoot(kpptr_to_paddr(X86_KERNEL_VSPACE_ROOT), 0);
/* Sync up the compilers view of the world here to force the PD to actually
* be set *right now* instead of delayed */
asm volatile("" ::: "memory");

#ifdef CONFIG_KERNEL_SKIM_WINDOW
if (!map_skim_window((vptr_t)ki_skim_start, (vptr_t)ki_skim_end)) {
return false;
}
#endif

/* reuse boot code/data memory */
boot_mem_reuse_p_reg.start = KERNEL_ELF_PADDR_BASE;
boot_mem_reuse_p_reg.end = kpptr_to_paddr(ki_boot_end);

/* initialise the CPU */
if (!init_cpu(config_set(CONFIG_IRQ_IOAPIC) ? 1 : 0)) {
return false;
}

/* initialise NDKS and kernel heap */
if (!init_sys_state(
cpu_id,
&boot_state.mem_p_regs,
boot_state.ui_info,
boot_mem_reuse_p_reg,
/* parameters below not modelled in abstract specification */
boot_state.num_drhu,
boot_state.drhu_list,
&boot_state.rmrr_list,
&boot_state.acpi_rsdp,
&boot_state.vbe_info,
&boot_state.mb_mmap_info,
&boot_state.fb_info
)) {
return false;
}

return true;
}

static BOOT_CODE bool_t add_mem_p_regs(p_region_t reg)
{
if (reg.start == reg.end) {
Expand Down Expand Up @@ -492,7 +439,52 @@ static BOOT_CODE bool_t try_boot_sys(void)
ksNumCPUs = boot_state.num_cpus;

printf("Starting node #0 with APIC ID %lu\n", boot_state.cpus[0]);
if (!try_boot_sys_node(boot_state.cpus[0])) {

if (!map_kernel_window(
boot_state.num_ioapic,
boot_state.ioapic_paddr,
boot_state.num_drhu,
boot_state.drhu_list
)) {
return false;
}
setCurrentVSpaceRoot(kpptr_to_paddr(X86_KERNEL_VSPACE_ROOT), 0);
/* Sync up the compilers view of the world here to force the PD to actually
* be set *right now* instead of delayed */
asm volatile("" ::: "memory");

#ifdef CONFIG_KERNEL_SKIM_WINDOW
if (!map_skim_window((vptr_t)ki_skim_start, (vptr_t)ki_skim_end)) {
return false;
}
#endif

/* initialise the CPU */
if (!init_cpu(config_set(CONFIG_IRQ_IOAPIC) ? 1 : 0)) {
return false;
}

/* reuse boot code/data memory */
p_region_t boot_mem_reuse_p_reg = {
.start = KERNEL_ELF_PADDR_BASE,
.end = kpptr_to_paddr(ki_boot_end)
};

/* initialise NDKS and kernel heap */
if (!init_sys_state(
boot_state.cpus[0],
&boot_state.mem_p_regs,
boot_state.ui_info,
boot_mem_reuse_p_reg,
/* parameters below not modelled in abstract specification */
boot_state.num_drhu,
boot_state.drhu_list,
&boot_state.rmrr_list,
&boot_state.acpi_rsdp,
&boot_state.vbe_info,
&boot_state.mb_mmap_info,
&boot_state.fb_info
)) {
return false;
}

Expand Down

0 comments on commit c0e4a97

Please sign in to comment.