Mail Archives: djgpp/1994/11/09/07:55:56
> 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 -