Page 1 of 1

Loading PE kernel

Posted: Tue Mar 24, 2020 10:14 am
by john12
Hi,

I wrote a ASM bootloader with NASM and I want to switch to my C kernel (with PE headers). I searched a lot and I wrote this code

Code: Select all


xor rsi, rsi
xor r8, r8

mov rsi, [0x20000 + kernel + 0x3c] 
add rsi, 0x20000 + kernel 

; RSI has pointer to PE header
; Set r8 to Entry Point Address
lea r8, [rsi + 0x0028]
; Jump to kernel
jmp r8
I load kernel binary after kernel asm point. OS restarts every time and I dont know how to fix it.