113 lines
3.6 KiB
C
113 lines
3.6 KiB
C
/***************************************************************************
|
|
* Copyright 2008 - 2009 VMware, Inc. All rights reserved.
|
|
***************************************************************************/
|
|
|
|
/*
|
|
* @VMKAPIMOD_LICENSE@
|
|
*/
|
|
|
|
/*
|
|
***********************************************************************
|
|
* ExecMem */ /**
|
|
* \defgroup ExecMem Read-only Executable Memory Management Interfaces
|
|
* @{
|
|
***********************************************************************
|
|
*/
|
|
#ifndef _VMKAPI_EXECMEM_H_
|
|
#define _VMKAPI_EXECMEM_H_
|
|
|
|
/** \cond never */
|
|
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
|
|
#error This vmkapi file should never be included directly but only via vmkapi.h
|
|
#endif
|
|
/** \endcond never */
|
|
|
|
#include "base/vmkapi_types.h"
|
|
#include "base/vmkapi_lock.h"
|
|
#include "base/vmkapi_const.h"
|
|
|
|
/**
|
|
* \brief Maximum length of symbol name
|
|
*/
|
|
#define VMK_EXECMEM_MAX_SYM_NAME 128
|
|
|
|
/**
|
|
* \brief Opaque handle for an executable region
|
|
*/
|
|
typedef struct vmk_ExecMemInt *vmk_ExecMem;
|
|
|
|
/*
|
|
***********************************************************************
|
|
* vmk_ExecMemCreate -- */ /**
|
|
*
|
|
* \ingroup ExecMem
|
|
* \brief Create a read-only executable memory region
|
|
*
|
|
* \param[in] len Length of the R/O executable region.
|
|
* \param[out] ptr Pointer to the allocated region.
|
|
* \param[in] symbolName Symbol name for the region.
|
|
* \param[out] handle Handle to the region.
|
|
*
|
|
* \retval VMK_OK Executable memory region created
|
|
* successfully.
|
|
* \retval VMK_BAD_PARAM Symbol name length is greater than
|
|
* VMK_EXECMEM_MAX_SYM_NAME
|
|
* \retval VMK_NO_MEMORY System is out of memory so executable
|
|
* region cannot be created.
|
|
* \retval VMK_EXISTS Module symbol already exists
|
|
* \retval VMK_LIMIT_EXCEEDED No space for more symbols in symbol
|
|
* table.
|
|
*
|
|
***********************************************************************
|
|
*/
|
|
VMK_ReturnStatus vmk_ExecMemCreate(
|
|
vmk_uint32 len,
|
|
void **ptr,
|
|
const char *symbolName,
|
|
vmk_ExecMem *handle);
|
|
|
|
/*
|
|
***********************************************************************
|
|
* vmk_ExecMemCopyTo -- */ /**
|
|
*
|
|
* \ingroup ExecMem
|
|
* \brief Copy data to an executable memory region.
|
|
*
|
|
* \param[in] handle Handle to the destination memory .
|
|
* \param[in] src Pointer to the source to be copied.
|
|
* \param[in] len length in bytes to be copied.
|
|
*
|
|
* \retval VMK_OK Copy to executable memory was successful.
|
|
* \retval VMK_BAD_PARAM Src is NULL or handle is invalid or some other
|
|
* parameter is invalid.
|
|
*
|
|
***********************************************************************
|
|
*/
|
|
VMK_ReturnStatus vmk_ExecMemCopyTo(
|
|
vmk_ExecMem handle,
|
|
const void *src,
|
|
vmk_uint32 len);
|
|
|
|
/*
|
|
***********************************************************************
|
|
* vmk_ExecMemDestroy -- */ /**
|
|
*
|
|
* \ingroup ExecMem
|
|
* \brief Destroy an executable memory region.
|
|
*
|
|
* Frees the read-only region associated with the executable
|
|
* region.
|
|
*
|
|
* \param[in] handle Handle to the region to be destroyed.
|
|
*
|
|
* \retval VMK_OK Memory is freed.
|
|
* \retval VMK_BAD_PARAM Handle is invalid.
|
|
*
|
|
***********************************************************************
|
|
*/
|
|
|
|
VMK_ReturnStatus vmk_ExecMemDestroy(
|
|
vmk_ExecMem handle);
|
|
|
|
#endif /*_VMKAPI_EXECMEM_H_ */
|
|
/** @} */
|