delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/25/08:03:13

Date: Tue, 25 Aug 1998 15:01:49 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: jonslaughter AT my-dejanews DOT com
cc: djgpp AT delorie DOT com
Subject: Re: __dpmi_resize_dos_memory problem(not working?)
In-Reply-To: <6r8psp$qmm$1@nnrp1.dejanews.com>
Message-ID: <Pine.SUN.3.91.980825150049.7520U-100000@is>
MIME-Version: 1.0

On Mon, 17 Aug 1998 jonslaughter AT my-dejanews DOT com wrote:

> I'm having a HUGE problem trying to get __dpmi_resize_dos_memory to
> work...  it always fails and I don't understand why...

Thanks for reporting this.  This is a bug in the function
__dpmi_resize_dos_memory: it calls the DPMI server incorrectly.

To correct that, you will need to compile the fixed version of that
function attached below, put it into your C library, and then relink
your application.  Save the first attached source into a file called
d0102.S, the second file into dpmidefs.h, chdir to the directory where
these two files are, then type these commands:

      gcc -c -O3 d0102.S
      ar rvs c:/djgpp/libc.a d0102.o

(if DJGPP's main directory on your system is something other than
c:\djgpp, change the second command accordingly).

That's it!  Now relink your program, and it should work.

---------------------------- d0102.S --------------------------
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#define USE_EBX
#include "dpmidefs.h"

	FUNC(___dpmi_resize_dos_memory)
	ENTER

	movl	ARG1, %edx
	movl	ARG2, %ebx
	DPMIce(0x0102)

	xorl	%eax,%eax
	RET

L_error:
	movl	ARG3, %ecx
	movzwl	%bx, %ebx
	movl	%ebx, (%ecx)
	movl	$-1, %eax
	
	LEAVE

--------------------------- dpmidefs.h --------------------------
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/asmdefs.h>

#define DPMI(x)		movw $(x),%ax; int $0x31; jnc L_noerror; movw %ax,___dpmi_error; movl $-1,%eax; jmp L_leave; L_noerror:
#define DPMIce(x)	movw $(x),%ax; int $0x31; movw %ax,___dpmi_error; jc L_error

	.comm	___dpmi_error,2

	.text

- Raw text -


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