.global rt_jump_to_address .global rt_reset_hardware .text .intel_syntax noprefix /** @brief this function setups a stack and then jumps to a function */ rt_jump_to_address: mov rsp, r8 push rax push rdx mov rbx, rcx mov rcx, rdx jmp rbx pop rdx pop rax ret .code16 rt_reset_hardware: /* dont raise any interrupts. (except ofc NMIs.) */ cli wait_gate1: /* wait for gate 1 to be ready? */ in al,0x64 and al,2 jnz wait_gate1 mov al,0x0D1 out 0x64,al wait_gate2: /* wait for gate 2 to be ready? */ in al,0x64 and al,2 jnz wait_gate2 mov al,0x0FE out 0x60,al /* trigger triple fault */ xor eax,eax mov cr3,eax reset_wait: jmp reset_wait