Bare Bones only works after running "info registers" in QEMU

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
Wallacoloo
Posts: 2
Joined: Sat Dec 18, 2010 3:53 pm

Bare Bones only works after running "info registers" in QEMU

Post by Wallacoloo »

I couldn't get the Bare Bones working in Qemu. Everything compiled and linked with no errors, but simply didn't do anything when I ran it in qemu.

So I decided to try and see where things were going wrong. I ran Qemu from the terminal (btw, I'm using Linux) like so:

Code: Select all

qemu -monitor stdio -kernel kernel.bin
That makes it so I can enter commands into the terminal window while my OS is running.
So at the (Qemu) prompt, I type:

Code: Select all

info registers
To, obviously, dump the registers.
The instant I hit enter, the upper left character is replaced with an A, which is exactly what the program was supposed to do.

I repeated that process a few times to make sure it was reproducible, and it is (on my system).
All OSes that I've tried which don't switch into protected mode seem to work fine on Qemu, and the 2 tutorials for protected mode that I've followed only work after doing the above process (1 was the bare bones, the other can be found here: http://www.osdever.net/tutorials/view/t ... ected-mode). So I figure it's got something to do with switching to protected mode.

Code: Select all

qemu -version
shows
QEMU PC emulator version 0.12.5 (qemu-kvm-0.12.5), Copyright (c) 2003-2008 Fabrice Bellard

What can I do to avoid having to do this every time?
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Bare Bones only works after running "info registers" in

Post by gerryg400 »

Make sure interrupts are ENABLED when you execute the hlt instruction. Like this

Code: Select all

   sti
hang:
   hlt                                ; halt machine should kernel return
   jmp   hang
If a trainstation is where trains stop, what is a workstation ?
Wallacoloo
Posts: 2
Joined: Sat Dec 18, 2010 3:53 pm

Re: Bare Bones only works after running "info registers" in

Post by Wallacoloo »

Thanks for the tip. That was precisely the problem!
Post Reply