As the title says, I'm trying to write a simple boot loader in assembly to help with my virtual machine monitor that I've tried to implement using the D programming language. Can anyone help me resolve the following error, nasm -f elf64 -o bootloader.o boot.asm
boot.asm:28: error: instruction not supported in 64-bit mode
?
jmp eax
is the instruction on line 28.
Here is the assembly code:
section .text align=1
start:
; Load the kernel code into memory
mov edx, 0x8000
mov dh, 0x02
mov dl, 0x80
mov ah, 0x02
int 0x13
jnc kernel_loaded
jmp error
kernel_loaded:
; Set the entry point for the kernel
mov eax, [0x8000 + 0x218]
mov ecx, [0x8000 + 0x21A]
mov edx, 0
add edx, ecx
add ecx, ecx
add edx, ecx
add ecx, ecx
add edx, ecx
add ecx, ecx
add edx, ecx
add ecx, ecx
add edx, ecx
add eax, edx
add eax, 0x8000
jmp eax
; Display "Loading complete." on the screen
mov ah, 0x00
mov al, 'L'
int 0x10
mov ah, 0x00
mov al, 'o'
int 0x10
mov ah, 0x00
mov al, 'a'
int 0x10
mov ah, 0x00
mov al, 'd'
int 0x10
mov ah, 0x00
mov al, 'i'
int 0x10
mov ah, 0x00
mov al, 'n'
int 0x10
mov ah, 0x00
mov al, 'g'
int 0x10
mov ah, 0x00
mov al, ' '
int 0x10
mov ah, 0x00
mov al, 'c'
int 0x10
mov ah, 0x00
mov al, 'o'
int 0x10
mov ah, 0x00
mov al, 'm'
int 0x10
mov ah, 0x00
mov al, 'p'
int 0x10
mov ah, 0x00
mov al, 'l'
int 0x10
mov ah, 0x00
mov al, 'e'
int 0x10
mov ah, 0x00
mov al, 't'
int 0x10
mov ah, 0x00
mov al, 'e'
error:
; Error handling code here
; Pad the boot loader to 512 bytes
times 510 - ($-$$) db 0
dd 0xAA55
I tried removing jmp eax from the assembly code but I feel like that might be a bad move. It did allow everything to get compiled and run in virtualbox but I see no output.
Here's how I built the iso file:
1) dmd -c vmmonitor.d
2) nasm -f elf64 -o bootloader.o boot.asm
3) ld -Ttext 0x7C00 -o boot.bin bootloader.o vmmonitor.o -L /usr/include/dmd/phobos/ -lphobos2
4) genisoimage -o boot.iso -b boot.bin -no-emul-boot boot.bin