Bochs help

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
indiocolifa
Member
Member
Posts: 41
Joined: Sat May 24, 2008 12:41 pm
Location: La Plata, Argentina

Bochs help

Post by indiocolifa »

I'm using Bochs to debug my bootloader, and I did not find any guide to setup Bochs to debug properly (I'm using Archlinux and the Bochs binary from the repositories is not debugging-enabled I believe ).

Any guide or small example on how to debug with bochs, specially the Realmode bootloader assembly code?

Another question I got is about segments in Real Mode. I've the bootloader stage1/stage2 code in one file, and it's working really well. Tell me if I'm wrong about calling functions in other segments. In the main stage I load the second sector and jump to the code which is working well.

At the beginning of sector 2 my code is:

Code: Select all

	;; **************************************************************
	;;
	;; STAGE 2 at sector 2 of FD
	;;
	;; **************************************************************

	org	LDADDR_OFFSET 	; sector2 loaded at 1000:0000

	jmp	start2

	;; -- definitions for st2 ---

	EXECMSG		db	'Starting up...',0
	BASE10		dw	0010
	DIGIT		db	5 dup (0)

start2:	mov	ax, LDADDR_SEGMENT
 	mov	ds, ax
	
	mov	ax, 15995
	call	dispint
	jmp	$
This dispint label which prints integers is defined at the sector 2 stage which is executed from 1000:0000 (the stage 1 at 0000:7C00 as always). Of course since dispint is using the DIGIT and BASE10 bytes i'm changing basically DS=CS. My message printing function was early in the code, so if I want to display a string my program will malfunction, since CS:1000 now and the dispstring code piece was at CS:0000.
Can I call the old function at CS:0000 or I should redefine the function for
the new bootloader stage?

I hope you understand.

Thank you very much for your help.
[/code]
User avatar
bluecode
Member
Member
Posts: 202
Joined: Wed Nov 17, 2004 12:00 am
Location: Germany
Contact:

Post by bluecode »

The bochs manual perhaps? But yea, you have to compile with --enable-debugger, which most linux binaries are not compiled with.

edit: There is a problem with the current release though, see here.
indiocolifa
Member
Member
Posts: 41
Joined: Sat May 24, 2008 12:41 pm
Location: La Plata, Argentina

Post by indiocolifa »

THanks, and don't answer the question of code segment... i was coding at 3:00 AM.. it's evident that when you are tired you can't even solve the most stupid problems! :oops: :P


Seems that Bochs is the definite answer to OS dev full system emulation, I don't know the QEmu advantages however.

Thx again.,
Post Reply