Jump to HULK from assembly
This commit is contained in:
parent
f29bd9d00c
commit
f761d0a445
@ -11,6 +11,7 @@ import hulk.header : HulkHeader = Header;
|
|||||||
import hos.page_table;
|
import hos.page_table;
|
||||||
import hos.cpu;
|
import hos.cpu;
|
||||||
import hos.memory;
|
import hos.memory;
|
||||||
|
import ldc.llvmasm;
|
||||||
|
|
||||||
__gshared EFI_SYSTEM_TABLE * st;
|
__gshared EFI_SYSTEM_TABLE * st;
|
||||||
private __gshared BootInfo bootinfo;
|
private __gshared BootInfo bootinfo;
|
||||||
@ -376,10 +377,12 @@ private void build_page_tables(ulong max_physical_address, ulong bss_phys, ulong
|
|||||||
/**
|
/**
|
||||||
* Jump to HULK entry point.
|
* Jump to HULK entry point.
|
||||||
*/
|
*/
|
||||||
private void jump_to_hulk()
|
private void jump_to_hulk(ulong stack_end)
|
||||||
{
|
{
|
||||||
void function(BootInfo *) hulk_entry_fn = cast(void function(BootInfo *))hulk_header().entry;
|
__asm(
|
||||||
hulk_entry_fn(&bootinfo);
|
"jmpq *$0",
|
||||||
|
"r,{rdi},{rsp}",
|
||||||
|
hulk_header().entry, &bootinfo, stack_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -431,7 +434,7 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
|
|||||||
bootinfo.bss_phys = bss_phys;
|
bootinfo.bss_phys = bss_phys;
|
||||||
bootinfo.stack_phys = stack_phys;
|
bootinfo.stack_phys = stack_phys;
|
||||||
|
|
||||||
jump_to_hulk();
|
jump_to_hulk(stack_phys + hulk_stack_size());
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ private __gshared Header hulk_header = {
|
|||||||
*
|
*
|
||||||
* @param bootinfo Pointer to HULK boot information structure.
|
* @param bootinfo Pointer to HULK boot information structure.
|
||||||
*/
|
*/
|
||||||
extern(C) void hulk_start(ulong rdi, ulong rsi, ulong rdx, BootInfo * bootinfo)
|
void hulk_start(BootInfo * bootinfo)
|
||||||
{
|
{
|
||||||
fb.initialize(bootinfo.fb.buffer, bootinfo.fb.width, bootinfo.fb.height, bootinfo.fb.stride);
|
fb.initialize(bootinfo.fb.buffer, bootinfo.fb.width, bootinfo.fb.height, bootinfo.fb.stride);
|
||||||
console.initialize();
|
console.initialize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user