OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:24 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Interrupts seem to be an issue...
PostPosted: Thu May 11, 2017 5:23 am 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
TheAlmostGenius wrote:
After the syscall:
Code:
int $0x80
there is a while loop. Could it be that GCC has optimised this to a hlt instruction? Maybe there is a hlt generated by the compiler. I do know however that I haven't added one in myself. I will try bochs as it is hailed as the better choice for debugging. If it is due to a hlt instruction the compiler has placed in the code, this would mean the int instruction doesn't execute my syscall code.

I would suggest GDB and single stepping, you'll get to know what actually happens. Using debugger is actually quite easy, though means you have to pay attention.

http://wiki.osdev.org/GDB#Using_Emulator_Stubs

The emulator stubs part of the Wiki tells how you start Qemu so it waits for GDB, and below that is how you start GDB. Then just instruct GDB to continue (c) which runs the OS, but first you probably want to set a breakpoint (b) at some point so you can then start single stepping. IIRC you don't want to start single stepping when GDB is started because Qemu will have EIP set to the BIOS code initially, single stepping thru that might take a while, so set a breakpoint to the beginning of your code and then start single stepping from there.

Also you could disassemble your code and see what's there (objdump).


Top
 Profile  
 
 Post subject: Re: Interrupts seem to be an issue...
PostPosted: Thu May 11, 2017 7:17 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
TheAlmostGenius wrote:
Could it be that GCC has optimised this to a hlt instruction?
Well, that's pretty easy to check, isn't it? Although it sounds pretty unlikely to me. Having said that, I would turn off optimization in the early days of OS development; speed and size are not big enough problems to counter the ease of debugging that unoptimized code presents.
Quote:
I will try bochs as it is hailed as the better choice for debugging.
This shouldn't be necessary if you like qemu. It has very good debugging facilities in its monitor, and used in conjunction with gdb probably makes a better debugging platform than Bochs.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group