KnVmAllocate()

This function is declared in the coresrv/vmm/vmm_api.h file.

void *KnVmAllocate(void *addr, rtl_size_t size, int flags);

Reserves a range of physical pages defined by the addr and size parameters. If the VMM_FLAG_COMMIT flag is indicated, the function reserves and commits pages for one call.

Parameters:

Returns the base virtual address of the reserved area. If it is not possible to reserve a memory area, the function returns RTL_NULL.

Allocation flags

In the flags parameter, you can use the following flags (vmm/flags.h):

Permissible combinations of memory protection attributes:

Example

coredump->base = KnVmAllocate(RTL_NULL, vmaSize,

VMM_FLAG_READ | VMM_FLAG_RESERVE |

VMM_FLAG_WRITE | VMM_FLAG_COMMIT |

VMM_FLAG_LOCKED).

The KnVmProtect() function can be used to modify the defined memory area protection attributes if necessary.

Page top