www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/01/05/18:06:15

Date: Mon, 06 Jan 1997 12:01:02 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Debuggers and mouse hooking (or maybe dpmi memory allocatio
To: "Salvador Eduardo Tropea (SET)" <salvador AT natacha DOT inti DOT edu DOT ar>
Cc: djgpp-workers AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <32D0E97E.2288@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <m0vegXf-000S1eC AT natacha DOT inti DOT edu DOT ar>

This is a multi-part message in MIME format.

--------------47F41D8348E7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Salvador Eduardo Tropea (SET) wrote:
> 
> Hi All:
> 
> Bill (I) wrote:
> > I'm having some problems with v2.01 debuggers locking up with my
> > editor and I would like some advice on what mods were made to
> > dbgcom.c so I can work out what's going on (the story is below).
> Amazing, I have a similar problem with my editor (the one inside of
> RHIDE)!
> 
> debuggee, if I use Win3.1 all works OK (puaj, puaj and puaj).

Eh? Is the english printable? :)  Nice to know I wasn't the only one
with
the problem.

[massive snip of SET and myself comparing our problems and code]

> P.S. The first time that I saw that was in machine with low memory (8
> Mb), but when I tried at home (20Mb) I got the same problem. My
> workaround was using Win3.1 but that sucks!.

MAJOR suck!

However, I found and FIXED the problem!!!!!!!!!

The debugger's (in 2.01) don't preserve the flags register properly.
ALL of the return flags are set from within the isr (rather than just
the
carry flag).  This also explains why it worked under windows: in
windows,
the isr is called with interrupts enabled but cwsdpmi calls the isr with
them disabled, and so the interrupts were being disabled!

There was aslo some other problems with register preservation with some
of the
intercepted functions, so I fixed those whils I was at it.

Bill
-- 
Leave others their otherness.

--------------47F41D8348E7
Content-Type: text/plain; charset=us-ascii; name="DBGCOM.DIF"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="DBGCOM.DIF"

diff -r -c3 src/debug/common/dbgcom.c new/debug/common/dbgcom.c
*** src/debug/common/dbgcom.c	Tue Aug 13 00:08:04 1996
--- new/debug/common/dbgcom.c	Sun Dec 29 19:25:04 1996
***************
*** 193,199 ****
  	.align  2,0x90							\n\
  _change_descriptor:							\n\
  	pushl	%ecx							\n\
- 	pushl	%eax							\n\
  	xorl	%ecx,%ecx						\n\
  CL3:									\n\
  	.byte	0x2e 							\n\
--- 193,198 ----
***************
*** 205,218 ****
  	movw	%ax,%ds							\n\
  	movw	%dx,_descriptors(,%ecx,2)				\n\
  	pop	%ds							\n\
- 	popl	%eax							\n\
  	popl	%ecx							\n\
  	ret								\n\
  CL4:									\n\
  	incl	%ecx							\n\
  	cmpl	$128,%ecx	/* DESCRIPTOR_COUNT */			\n\
  	jl	CL3							\n\
- 	popl	%eax							\n\
  	popl	%ecx							\n\
  	ret								\n"
  );
--- 204,215 ----
***************
*** 252,258 ****
  	.text								\n\
  	.align  2,0x90							\n\
  _change_dos_descriptor:							\n\
- 	pushl	%eax							\n\
  	pushl	%ecx							\n\
  	xorl	%ecx,%ecx						\n\
  CL6:									\n\
--- 249,254 ----
***************
*** 266,279 ****
  	movw	%dx,_dos_descriptors(,%ecx,2)				\n\
  	pop	%ds							\n\
  	popl	%ecx							\n\
- 	popl	%eax							\n\
  	ret								\n\
  CL7:									\n\
  	incl	%ecx							\n\
  	cmpl	$128,%ecx	/* DOS_DESCRIPTOR_COUNT */		\n\
  	jl	CL6							\n\
  	popl	%ecx							\n\
- 	popl	%eax							\n\
  	ret								\n"
  );
  
--- 262,273 ----
***************
*** 331,337 ****
  Lc31a_:	pushl	%eax							\n\
  	pushf								\n\
  	popl	%eax		/* store the right flags for iret */	\n\
! 	movl	%eax,12(%esp)						\n\
  	popl	%eax							\n\
  Lc31a:	iret								\n\
  Lc31b:	.byte	0x2e							\n\
--- 325,332 ----
  Lc31a_:	pushl	%eax							\n\
  	pushf								\n\
  	popl	%eax		/* store the right flags for iret */	\n\
! 	andl	$1,%eax		/* we only want the carry flag */	\n\
! 	orl	%eax,12(%esp)						\n\
  	popl	%eax							\n\
  Lc31a:	iret								\n\
  Lc31b:	.byte	0x2e							\n\
***************
*** 358,363 ****
--- 353,359 ----
  	lcall	_old_i31						\n\
  	jc	Lc31a_							\n\
  	pushf								\n\
+ 	pushl	%eax							\n\
  	pushl	%edx							\n\
  	pushw	%si							\n\
  	pushw	%di							\n\
***************
*** 365,370 ****
--- 361,367 ----
  	xorl	%eax,%eax						\n\
  	call	_change_handle						\n\
  	popl	%edx							\n\
+ 	popl	%eax							\n\
  	popf								\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
***************
*** 375,384 ****
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
  	jc	Lc31_resize_mem_error					\n\
! 	popl	%eax							\n\
  	xorl	%edx,%edx						\n\
  	call	_change_handle						\n\
! 	xorl	%eax,%eax						\n\
  	jmp	Lc31a_							\n\
  Lc31_resize_mem:							\n\
  	pushw	%si							\n\
--- 372,383 ----
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
  	jc	Lc31_resize_mem_error					\n\
! 	xchgl	%eax,(%esp)						\n\
! 	pushl	%edx							\n\
  	xorl	%edx,%edx						\n\
  	call	_change_handle						\n\
! 	popl	%edx							\n\
! 	popl	%eax							\n\
  	jmp	Lc31a_							\n\
  Lc31_resize_mem:							\n\
  	pushw	%si							\n\
***************
*** 388,403 ****
  	lcall	_old_i31						\n\
  	jnc	Lc31_resize_mem_ok					\n\
  Lc31_resize_mem_error:							\n\
! 	addl	$4,%esp							\n\
  	stc								\n\
  	jmp	Lc31a_							\n\
  Lc31_resize_mem_ok:							\n\
! 	popl	%eax							\n\
  	pushw	%si							\n\
  	pushw	%di							\n\
  	popl	%edx							\n\
  	call	_change_handle						\n\
! 	xorl	%eax,%eax						\n\
  	jmp	Lc31a_							\n\
  Lc31_alloc_descriptors:							\n\
  	pushl	%ecx							\n\
--- 387,405 ----
  	lcall	_old_i31						\n\
  	jnc	Lc31_resize_mem_ok					\n\
  Lc31_resize_mem_error:							\n\
! 	xchgl	%eax,(%esp)						\n\
! 	popl	%eax							\n\
  	stc								\n\
  	jmp	Lc31a_							\n\
  Lc31_resize_mem_ok:							\n\
! 	xchgl	%eax,(%esp)						\n\
! 	pushl	%edx							\n\
  	pushw	%si							\n\
  	pushw	%di							\n\
  	popl	%edx							\n\
  	call	_change_handle						\n\
! 	popl	%edx							\n\
! 	popl	%eax							\n\
  	jmp	Lc31a_							\n\
  Lc31_alloc_descriptors:							\n\
  	pushl	%ecx							\n\
***************
*** 414,434 ****
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
! 	popl	%edx							\n\
! 	jc	Lc31a_							\n\
  	xorw	%ax,%ax							\n\
  	call	_change_descriptor					\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
  Lc31_create_alias_descriptor:						\n\
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
  	jc	Lc31a_							\n\
  	pushl	%eax							\n\
  	movw	%ax,%dx							\n\
  	xorw	%ax,%ax							\n\
  	call	_change_descriptor					\n\
  	popl	%eax							\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
--- 416,445 ----
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
! 	jc	Lc31a_free_descriptor_error				\n\
! 	xchgl	%eax,(%esp)						\n\
! 	pushl	%edx							\n\
! 	movl	%eax,%edx						\n\
  	xorw	%ax,%ax							\n\
  	call	_change_descriptor					\n\
+ 	popl	%edx							\n\
+ 	popl	%eax							\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
+ Lc31_free_descriptor_error:						\n\
+ 	popl	%ebx							\n\
+ 	jmp	Lc31a_							\n\
  Lc31_create_alias_descriptor:						\n\
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
  	jc	Lc31a_							\n\
  	pushl	%eax							\n\
+ 	pushl	%edx							\n\
  	movw	%ax,%dx							\n\
  	xorw	%ax,%ax							\n\
  	call	_change_descriptor					\n\
+ 	popl	%edx							\n\
  	popl	%eax							\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
***************
*** 448,458 ****
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
! 	popl	%eax							\n\
! 	jc	Lc31a_							\n\
  	xorw	%dx,%dx							\n\
  	call	_change_dos_descriptor					\n\
  	clc								\n\
  	jmp	Lc31a_							\n\
  	.align  2,0x90							\n\
  _i21_hook:								\n\
--- 459,475 ----
  	pushf								\n\
  	.byte	0x2e							\n\
  	lcall	_old_i31						\n\
! 	jc	Lc31_free_dos_memory_error				\n\
! 	xchgl	%eax,(%esp)						\n\
! 	pushl	%edx							\n\
  	xorw	%dx,%dx							\n\
  	call	_change_dos_descriptor					\n\
+ 	popl	%edx							\n\
+ 	popl	%eax							\n\
  	clc								\n\
+ 	jmp	Lc31a_							\n\
+ Lc31_free_dos_memory_error:						\n\
+ 	popl	%edx							\n\
  	jmp	Lc31a_							\n\
  	.align  2,0x90							\n\
  _i21_hook:								\n\

--------------47F41D8348E7--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019