🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.asm
Article #363

Re: pmode debugging

#363
From: Christopher Giese
Date: Fri, 03 Jul 1998 00:00
42 lines
2437 bytes
The artificial intelligence formerly known as "PR Schmitz"
<mcschmitz@kabelfoon.nl> wrote:

>I'm trying to write a protected mode program (no dos extender or something
>like that). To protected mode and back works ok, but I am unable to debug
>the program. I've got BC3.1 and BC5.0 available. How can I debug a program
>once it enters protected mode. The system hangs at the instruction mov
>cr0,ax.

I don't know if there's a debugger that can follow a program into
protected mode. Maybe SoftICE?

You can use Borland's debugger to follow the code only so far, maybe
to the LIDT or LGDT instruction. After that, you're on your own!

In my protected-mode code, I have a "linear" data descriptor with base
address 0 and maximum limit (0xFFFFF). I can use it to poke characters
into video memory to see how far my code is getting:
	mov ax,LINEAR_SEL
	mov gs,ax
	mov byte [gs:0B8000h],'A'
		(protected-mode code)
	mov byte [gs:0B8002h],'B'
		(more protected-mode code)
	mov byte [gs:0B8004h],'C'

Or, you can use "die" loops. Bad protected-mode code often makes the
CPU triple-fault, and it resets itself, so you do:

	(questionable protected-mode code)
die:	jmp die

If the system freezes up instead of rebooting, there's a good chance
the PM code is working.

Hope this helps.
-- 
geezer@ | Sales rushes in   | "In chapter one, Boron slays the
netwurx | where Engineering |  entire Marketing department by
.net    | fears to tread.   |  explaining asynchronous
  www.netwurx.net/~geezer   |  protocols..."
Technical Details
Message-ID: <6njfj1$eeg$1@winter.news.erols.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6nisvs$abr$4@winter.news.erols.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: feaef,1869fded4b51db7c
X-Google-Attributes: gidfeaef,public
X-Google-Thread: f7d8d,1869fded4b51db7c
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: 114917,1869fded4b51db7c
X-Google-Attributes: gid114917,public
From: no@email.ads (Christopher Giese)
Subject: Re: pmode debugging
Date: 1998/07/03
Message-ID: <6njfj1$eeg$1@winter.news.erols.com>
X-Deja-AN: 368491928
Approved: <johnfine@erols.com>
References: <6nisvs$abr$4@winter.news.erols.com>
X-Mozilla-Status: 0801
X-Cache: nntpcache 2.3.2.1 (see http://www.nntpcache.org/)
Cache-Post-Path: cnn.axisnet.net!unknown@dial224.netwurx.net
X-Complaints-To: abuse@erols.com
X-Trace: winter.news.erols.com 899498401 14800 207.172.241.72 (3 Jul 1998 20:40:01 GMT)
Organization: Cheeseland Clench
Newsgroups: alt.lang.asm,borland.public.tasm,comp.lang.asm.x86