V86MMGR_Allocate_Buffer

include v86mmgr.inc

VxDcall V86MMGR_Allocate_Buffer


The V86MMGR_Allocate_Buffer service allocates a portion of the current virtual machine's translation buffer, and optionally copies data from the protected-mode pointer in FS:ESI registers into the allocated buffer.

Parameters

EBX

Specifies the current virtual machine handle. The current virtual machine must be in protected mode.

EBP

Points to a Client_Reg_Struc structure containing the register values of the current virtual machine.

ECX

Specifies the number of bytes to allocate.

FS:ESI

Specifies a pointer to the extended memory to copy. If the carry flag is set, the service copies the source buffer into a V86 buffer; otherwise, it copies the source buffer into V86 memory.

Return Value

The carry flag is clear if the service is successful. The ECX register contains the actual number of bytes allocated ( less than or equal to the original ECX parameter). The high word of the EDI register contains the V86 segment for the translation buffer, and the low word of the EDI register contains the offset of the allocated buffer.

If the carry flag is set, the service could not allocate buffer.

Comments

This service maps fewer bytes than the value specified in the ECX parameter if the length of the buffer would extend past the FS segment limit. Therefore, a virtual device needs to preserve the value returned in ECX from this service to use when deallocating the buffer using the V86MMGR_Free_Buffer service.

The buffers are maintained as a stack. Therefore, the last buffer allocated must be the first buffer freed.

Uses

ECX, EDI, Flags