I'm trying to code an OS and every thing went well until here. I'm in Long-Mode and my 'kernel' code is executing if I pagemap it to an address that's 32-Bit. But if i don't do that my kernel stops working. In the end I found out that my compiler (NASM 2.15.05) compiles all addresses in a mov instruction as a 32-Bit val not a 64-bit val. I use
nasm test.asm -f bin -o test.bin
to compile my code. So my question is how do I get it to work so it compiles 64-bit addresses as 64-bit not 32-bit ?
[org 0x100000000]
[bits 64]
;this does not work
mov rax, [l1]
;nasm bin output = 48 8b 02 25 | 1c 00 00 00 | <--- this is the addr (32-bit)
;this works
mov rbx, l1
mov rax, [l1]
jmp $
l1: dq 0x1234