modules/portlib/src/main/native/port/windows/hyvmem.c File Reference


Detailed Description

Virtual memory.

#include <windows.h>
#include "hyport.h"
#include "portpriv.h"
#include "hyportpg.h"
#include "ut_hyprt.h"

Functions

void *VMCALL hyvmem_commit_memory (struct HyPortLibrary *portLibrary, void *address, UDATA byteAmount, struct HyPortVmemIdentifier *identifier)
 Commit memory in virtual address space.
IDATA VMCALL hyvmem_decommit_memory (struct HyPortLibrary *portLibrary, void *address, UDATA byteAmount, struct HyPortVmemIdentifier *identifier)
 Decommit memory in virtual address space.
I_32 VMCALL hyvmem_free_memory (struct HyPortLibrary *portLibrary, void *address, UDATA byteAmount, struct HyPortVmemIdentifier *identifier)
 Free memory in virtual address space.
void *VMCALL hyvmem_reserve_memory (struct HyPortLibrary *portLibrary, void *address, UDATA byteAmount, struct HyPortVmemIdentifier *identifier, UDATA mode, UDATA pageSize)
 Reserve memory in virtual address space.
void VMCALL hyvmem_shutdown (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.
I_32 VMCALL hyvmem_startup (struct HyPortLibrary *portLibrary)
 PortLibrary startup.
UDATA *VMCALL hyvmem_supported_page_sizes (struct HyPortLibrary *portLibrary)
 Determine the page sizes supported.


Function Documentation

void* VMCALL hyvmem_commit_memory ( struct HyPortLibrary portLibrary,
void *  address,
UDATA  byteAmount,
struct HyPortVmemIdentifier *  identifier 
)

Commit memory in virtual address space.

Parameters:
[in] portLibrary The port library.
[in] address The page aligned starting address of the memory to commit.
[in] byteAmount The number of bytes to commit.
[in] identifier Descriptor for virtual memory block.
Returns:
pointer to the allocated memory on success, NULL on failure.

IDATA VMCALL hyvmem_decommit_memory ( struct HyPortLibrary portLibrary,
void *  address,
UDATA  byteAmount,
struct HyPortVmemIdentifier *  identifier 
)

Decommit memory in virtual address space.

Decommits physical storage of the size specified starting at the address specified.

Parameters:
[in] portLibrary The port library.
[in] address The starting address of the memory to be decommitted.
[in] byteAmount The number of bytes to be decommitted.
[in] identifier Descriptor for virtual memory block.
Returns:
0 on success, non zero on failure.

I_32 VMCALL hyvmem_free_memory ( struct HyPortLibrary portLibrary,
void *  address,
UDATA  byteAmount,
struct HyPortVmemIdentifier *  identifier 
)

Free memory in virtual address space.

Frees physical storage of the size specified starting at the address specified.

Parameters:
[in] portLibrary The port library.
[in] address The starting address of the memory to be de-allocated.
[in] byteAmount The number of bytes to be allocated.
[in] identifier Descriptor for virtual memory block.
Returns:
0 on success, non zero on failure.

void* VMCALL hyvmem_reserve_memory ( struct HyPortLibrary portLibrary,
void *  address,
UDATA  byteAmount,
struct HyPortVmemIdentifier *  identifier,
UDATA  mode,
UDATA  pageSize 
)

Reserve memory in virtual address space.

Reserves a range of virtual address space without allocating any actual physical storage. The memory is not available for use until committed hyvmem_commit_memory. The memory may not be used by other memory allocation routines until it is explicitly released.

Parameters:
[in] portLibrary The port library.
[in] address The starting address of the memory to be reserved.
[in] byteAmount The number of bytes to be reserved.
[in] identifier Descriptor for virtual memory block.
[in] mode Bitmap indicating how memory is to be reserved. Expected values combination of:
  • HYPORT_VMEM_MEMORY_MODE_READ memory is readable
  • HYPORT_VMEM_MEMORY_MODE_WRITE memory is writable
  • HYPORT_VMEM_MEMORY_MODE_EXECUTE memory is executable
  • HYPORT_VMEM_MEMORY_MODE_COMMIT commits memory as part of the reserve
[in] pageSize Size of the page requested, a value returned by hyvmem_supported_page_sizes, or the constant HYPORT_VMEM_PAGE_SIZE_DEFAULT for the system default page size.
Returns:
pointer to the reserved memory on success, NULL on failure.

void VMCALL hyvmem_shutdown ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

This function is called during shutdown of the portLibrary. Any resources that were created by hyvmem_startup should be destroyed here.

Parameters:
[in] portLibrary The port library.
Note:
Most implementations will be empty.

I_32 VMCALL hyvmem_startup ( struct HyPortLibrary portLibrary  ) 

PortLibrary startup.

This function is called during startup of the portLibrary. Any resources that are required for the virtual memory operations may be created here. All resources created here should be destroyed in hyvmem_shutdown.

Parameters:
[in] portLibrary The port library.
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_VMEM
Note:
Most implementations will simply return success.

UDATA* VMCALL hyvmem_supported_page_sizes ( struct HyPortLibrary portLibrary  ) 

Determine the page sizes supported.

Parameters:
[in] portLibrary The port library.
Returns:
A 0 terminated array of supported page sizes. The first entry is the default page size, other entries are the large page sizes supported.


Genereated on Tue Dec 9 14:13:00 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.