www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/09/07:55:56

To: sad AT id DOT net (Scott Deming)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Real Mode pointers.
Date: Wed, 09 Nov 94 08:43:42 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>

> What I need to do is allocate a chunk of conventional memory.
>    convAlloc.size = (fStat.st_size+15)/16;
>    if (_go32_dpmi_allocate_dos_memory(&convAlloc) != 0) {
>        return (NULL);
>    }
>    convBuffer = convAlloc.rm_segment;

No, this is not the way to go.  The allocation part is fine, but
you can't get a protected-mode pointer to lower memory chunk (well,
actually you can, but this requires a DPMI call which isn't
supported by go32, and is thus limited to running under real DPMI
server).  So, the rm_segment field which you get from
_go32_dpmi_allocate_dos_memory() is intended to be passed to a real-
mode program (like DOS functions which need a buffer to work on).
To access that buffer from your program, you should use either
dosmemget()/dosmemput(), or movedata() (which is faster, since it
moves 32-bit words instead of bytes).  For small chunks (like a byte
or a word) you can also use functions declared and documented in the
file include/sys/farptr.h.

- Raw text -


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