Page 1 of 1

Tracing the kernel code and debugging

Posted: Mon Nov 16, 2009 8:57 pm
by Areal Person
Hi,

I'm new to assembly language, I love this OS. It's really
nice ! I'm using Windows Vista and QEMU.

QUESTIONS

(1)
Could someone please tell me the first kernal function that is executed
inside Kernel.asm at boot? I'm booting from floppy, It looks like
boot_fat12.asm is loading the kernel, but I can't find the first function
inside kernel.asm that is executed.

(2)
Also, I'm looking for the best way to debug kernel.asm
I've found information on QEMU and GDB. Is that the best way ? Or is there a better way under Vista?
Would it be better if I set up a Linux box for debugging?
I want to step through the code in a debugger so I can understand the execution sequence.

(3)
What is the name of the function and asm file that displayes the first blue screen
where you setup the screen resolution before the OS boots?

Thanks for the help.
-Areal

Re: Tracing the kernel code and debugging

Posted: Mon Nov 16, 2009 9:45 pm
by hidnplayr
Areal Person wrote: Could someone please tell me the first kernal function that is executed
inside Kernel.asm at boot? I'm booting from floppy, It looks like
boot_fat12.asm is loading the kernel, but I can't find the first function
inside kernel.asm that is executed.
in the beginning of kernel.asm there is the following code:

Code: Select all

112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
113 ;;                                                                      ;;  
114 ;;                  16 BIT ENTRY FROM BOOTSECTOR                        ;;  
115 ;;                                                                      ;;  
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
117  
118 use16  
119                   org   0x0  
120                   jmp   start_of_code  
Areal Person wrote: Also, I'm looking for the best way to debug kernel.asm
I've found information on QEMU and GDB. Is that the best way ? Or is there a better way under Vista?
Would it be better if I set up a Linux box for debugging?
I want to step through the code in a debugger so I can understand the execution sequence.
I believe that is possible, but not very practical, BOCHS was made for this purpose AFAIK.
If you want to understand the code, read it, together with the 'Flat assemblers manual'
(Or if you dont understand anything about assembler yet, better start with 'The Art of Assembly' ebook.)
Areal Person wrote: What is the name of the function and asm file that displayes the first blue screen
where you setup the screen resolution before the OS boots?
These files are located in the folder 'boot', files bootcode.inc and booteng.inc for english menu


Good luck on your quest ;)