OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: why use qemu '-kernel' option can't hit '0x7c00' breakpoint
PostPosted: Sat Aug 13, 2022 8:10 am 
Offline

Joined: Mon Jul 05, 2021 7:05 am
Posts: 8
env:
qemu-system-i386
QEMU emulator version 7.0.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers

hi:
I use "qemu-system-i386 -kernel Prekernel" to run my kernel and then I use lldb to debug it, I add '0x7c00' breakpoint, then I run 'c' in lldb,it was not hit the '0x7c00' breakpiont, but if I use qemu '-cdrom' option, it can hit '0x7c00' breakpoint! I don't know why, it confuse me! any help is greatly appreciated!


Top
 Profile  
 
 Post subject: Re: why use qemu '-kernel' option can't hit '0x7c00' breakpo
PostPosted: Sat Aug 13, 2022 8:44 am 
Offline

Joined: Mon Jul 05, 2021 7:05 am
Posts: 8
qemu-system-i386 -help


Linux/Multiboot boot specific:
-kernel bzImage use 'bzImage' as kernel image


https://qemu-project.gitlab.io/qemu/sys ... xboot.html

what is qemu Direct Linux Boot process?


Top
 Profile  
 
 Post subject: Re: why use qemu '-kernel' option can't hit '0x7c00' breakpo
PostPosted: Sat Aug 13, 2022 1:26 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Princekin wrote:
I use "qemu-system-i386 -kernel Prekernel" to run my kernel and then I use lldb to debug it, I add '0x7c00' breakpoint, then I run 'c' in lldb,it was not hit the '0x7c00' breakpiont, but if I use qemu '-cdrom' option, it can hit '0x7c00' breakpoint! I don't know why, it confuse me! any help is greatly appreciated!

When booting from CD, the bootloader starts executing at 0x7C00, so you hit the breakpoint at the start of the bootloader. When booting using QEMU's "-kernel" option, there is no bootloader at 0x7C00, so you don't hit the breakpoint.

If you want to debug your kernel, set a breakpoint in your kernel instead of in your bootloader.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 65 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