Kernel won't run in Virtualbox after using protected mode?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Kaius
Posts: 20
Joined: Sat Dec 31, 2022 10:59 am
Libera.chat IRC: Kaius

Kernel won't run in Virtualbox after using protected mode?

Post by Kaius »

Hello. I'm fairly new to OS development, but I managed to create a bootloader and a simple kernel in C (in protected mode). I was originally in real mode, messing around with BIOS interrupts, and then I'd use NASM to compile that script to a .bin file and run it in Qemu. After that, I'd use dd to write those same bytes to a .vfd file so it would run in Virtualbox.

This worked great, until I switched to protected mode. My kernel runs fine in Qemu, but I'd like to be able to run it in Virtualbox as well. The above didn't work, it just tells me that the .vfd file is inaccessable or unreadable. My code contains a simple assembly script that switches over to protected mode using GDT, and then a file that enters the main function in the C kernel, which prints "Hello, world!" on the screen. It's all compiled into a few .bin files and written to one big OS.bin file, that I then run in Qemu using this command: `qemu-system-x86_64 -drive format=raw,file="Binaries/OS.bin",index=0,if=floppy, -m 128M`. Does anybody know how I could possibly run this in a Virtualbox environment? Thanks in advance!
Octocontrabass
Member
Member
Posts: 5562
Joined: Mon Mar 25, 2013 7:01 pm

Re: Kernel won't run in Virtualbox after using protected mod

Post by Octocontrabass »

Kaius wrote:The above didn't work, it just tells me that the .vfd file is inaccessable or unreadable.
How big is the .vfd file?
Post Reply