Re: DosAllocMem and OBJ_ANY
- From: "Lars Erdmann" <lars.erdmann@xxxxxxxx>
- Date: Wed, 20 Feb 2008 15:47:38 +0100
"Ilya Zakharevich" <nospam-abuse@xxxxxxxxx> schrieb im Newsbeitrag
news:fpf9vj$ooo$1@xxxxxxxxxxxxxxxxxxxxx
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Lars Erdmann
<lars.erdmann@xxxxxxxx>], who wrote in article
<47b9b7db$0$23012$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:
I thought that display drivers are 32-bit all the way through ? And it's
them that eventually implement all the GPI routines (or, to be more
precise
the set of device dependent functions that the GPI routines use). I think
16-bit display drivers were dropped starting with OS/2 2.1.
[By IBM, or by OEM?]
see below. It's not only IBM or OEM. OS/2 moved from 16-bit display driver
DLLs to 32-bit display driver DLLs. It was a design change everyone had to
follow.
The last time we had this discussion, somebody explained that even
16-bit DRIVERS would be able to support high memory (my knowledge of
DD is very limited, so I can't do anything but quote somebody else;
sorry!). It was noted that is the 16-bit DLLs which implement ring-3
part of the services which may break...
Memory that is allocated in the GDT (and therefore accessible to any process
calling into the device driver) will always be in the high memory region by
nature. There is no "low memory" for GDT mapped memory objects.
On the other hand, 16-bit device drivers have to be coded to support "user"
high memory (that is memory seen only by a specific process) with specific
allocation flags of VMAlloc. Technically, it's possible but it has to be
coded that way explicitely. No older 16-bit device drivers will therefore
support high memory in user space as high memory did not exist when those
drivers were written.
See VMAlloc, with flags VMDHA_USEHMA | VMDHA_PROCESS that allow allocation
of memory from within the device driver for a specific process calling into
the device driver.
Similarly, flags VMDHA_USEHMA | VMDHA_SHARED will allow to allocate memory
from within the device driver in the high memory arena not for a specific
process but shared memory for all processes (like shared memory for a DLL).
Still, this is DIFFERENT from memory allocated through the GDT (GDT memory
is normally only accessible by Ring-0 code, like device drivers, IFSs, the
kernel etc.)
In short: VMAlloc with the flags stated is the "Ring-0 extension" of the
APIs DosAllocMem, DosAllocSharedMem with the OBJ_HMA flag set.
See also VMGlobalToProcess, with flag VMDHGP_HMA32 that (on demand) maps
global memory allocated in GDT into high memory for the process calling into
the device driver.
Side note: flags VMDHA_USEHMA (,VMDHA_SHARED) and VMDHGP_HMA32, along with
some others, are "barely" documented in the Yahoo "os2ddprog" (Device Driver
Programming) group, see messages 994, 995 and 2465.
About DLLs: that's the point: starting with OS/2 2.1, the display driver
DLLs are 32-bit all the way through (and the 16-bit DLL DISPLAY.DLL that
contained all screen drawing code was dropped). The question is if the
32-bit display driver DLL still calls into some 16-bit code. One such
example might be that a display driver DLL might use the SCREEN IOCTLs
(SCREENDD_CATEGORY) provided by SCREENDD$ device driver (screen01.sys,
screen02.sys). That device driver is very old and most certainly does not
support "user" high memory.
However that is no problem if the 32-bit DLL only passes via the IOCTL
memory addresses of structures etc. that it allocates on the stack or
anywhere else in low memory.
Lars
.
- Follow-Ups:
- Re: DosAllocMem and OBJ_ANY
- From: Ilya Zakharevich
- Re: DosAllocMem and OBJ_ANY
- From: Marty
- Re: DosAllocMem and OBJ_ANY
- References:
- DosAllocMem and OBJ_ANY
- From: Heiko Nitzsche
- Re: DosAllocMem and OBJ_ANY
- From: Heiko Nitzsche
- Re: DosAllocMem and OBJ_ANY
- From: Marty
- Re: DosAllocMem and OBJ_ANY
- From: Lars Erdmann
- Re: DosAllocMem and OBJ_ANY
- From: Ilya Zakharevich
- DosAllocMem and OBJ_ANY
- Prev by Date: Re: DosAllocMem and OBJ_ANY
- Next by Date: Re: DosAllocMem and OBJ_ANY
- Previous by thread: Re: DosAllocMem and OBJ_ANY
- Next by thread: Re: DosAllocMem and OBJ_ANY
- Index(es):
Relevant Pages
|