pts
pts

Reputation: 87241

How to allocate memory to a specific virtual address with DPMI?

I'd like to allocate memory to a specific virtual address with DPMI and clear it like this:

mov edi, 0x400000  ; Base address.
mov ecx, 0x2000    ; Number of bytes to allocate.
???
cld
mov al, 0
rep stosb  ; Clear the allocated memory.

How do I do it, i.e. what should I write to the ??? part?

Upvotes: 0

Views: 91

Answers (1)

pts
pts

Reputation: 87241

It looks like this is no API in DPMI for this.

FYI Windows 3.11 with Win32s is also unable to load PE .exe files to arbitrary base addresses. (It requires the PE .exe file to have relocations.) If there was a DPMI API for memory allocation an arbitrary virtual address, then probably Windows 3.11 with Win32s would use a similar API in Windows 3.11 386 enhanced mode to load PE .exe files to an arbitrary base addresses.

Upvotes: 1

Related Questions