www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000318

When Created: 04/05/2000 22:00:55
Against DJGPP version: 2.03
By whom: npattinson@symantec.com
Abstract: __dpmi_simulate_real_mode_procedure_retf_stack causes stack corruption
__dpmi_simulate_real_mode_procedure_retf_stack copies an arbitrary number of words supplied by the caller to the stack prior to calling DPMI function 0x301. Unfortunately it doesn't reserve sufficient space on the stack for this, causing other information on the stack to be overwritten. Specifically, it reserves the caller-supplied number of bytes, rather than the caller-supplied number of words.

Solution added: 04/12/2000 20:00:07
By whom: billd@orbnet.com
rewrite the function and recompile djgpp

Note added: 07/08/2000 02:07:48
By whom: marko.ahcan@uni-lj.si
After a two recursive calls of three "big" interpreter procedures, djgpp 
returns to first call of a procedure(doesn't return to the last).

Solution added: 07/23/2000 14:40:02
By whom: eliz@is.elta.co.il
The following patch should solve the problem.  It will be in v2.04.

--- d0301_s.S   1999/08/04 19:58:23     1.3
+++ d0301_s.S	2000/07/23 15:34:38	1.4
@@ -18,6 +18,7 @@
 
 	/* Set up %esi, %edi to copy data to the PM stack. */
 	subl	%ecx, %esp
+	subl	%ecx, %esp
 	movl	%esp, %edi
 	movl	ARG3, %esi
 
@@ -37,5 +38,5 @@
 
 	xorl	%eax, %eax
 
-#define RESTORE_ESP	addl ARG2, %esp	 /* comma confuses LEAVEP macro. */
+#define RESTORE_ESP	addl ARG2, %esp ; addl ARG2, %esp  /* comma confuses LEAVEP macro. */
 	LEAVEP(RESTORE_ESP ; popl %es)

Solution added: 07/23/2000 14:40:04
By whom: eliz@is.elta.co.il
The following patch should solve the problem.  It will be in v2.04.

--- d0301_s.S   1999/08/04 19:58:23     1.3
+++ d0301_s.S	2000/07/23 15:34:38	1.4
@@ -18,6 +18,7 @@
 
 	/* Set up %esi, %edi to copy data to the PM stack. */
 	subl	%ecx, %esp
+	subl	%ecx, %esp
 	movl	%esp, %edi
 	movl	ARG3, %esi
 
@@ -37,5 +38,5 @@
 
 	xorl	%eax, %eax
 
-#define RESTORE_ESP	addl ARG2, %esp	 /* comma confuses LEAVEP macro. */
+#define RESTORE_ESP	addl ARG2, %esp ; addl ARG2, %esp  /* comma confuses LEAVEP macro. */
 	LEAVEP(RESTORE_ESP ; popl %es)

Fixed in version on 07/23/2000 14:40:56
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010