NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO
#include <mem/chMem.h>int rgnSetProtect(KnCap *actorcap, KnRgnDesc *rgndesc);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
MEM_FLAT, MEM_PROTECTED, MEM_VIRTUAL
The rgnSetProtect() function allows you to change the protection attributes of all regions of the target address range of the target actor address space.
The target actor is specified by actorcap, which is a pointer to the actor capability. If actorcap is -K_MYACTOR, the address space of the current actor is used. If actorcap is -K_SVACTOR, the supervisor address space is used.
The rgndesc pointer points to a KnRgnDesc structure which contains the specification of the target address range and the new values of the attributes. Only the following members of the structure are used:
VmAddr startAddr ; VmSize size ; VmFlags options ; |
The startAddr field gives the start of the target address range and the size field gives its size. rgndesc->startAddr must be aligned with a page boundary (see vmPageSize(2K)). If rgndesc->size is not page-aligned, the microkernel rounds it up to the next virtual page boundary.
The options field gives the new attributes of the regions from the target address range.
The target address range can contain holes - sub-ranges without regions mapped to them.
If rgndesc->startAddr is inside a region, the implementation replaces the original region with two regions. The first region conserves the old attributes and terminates at rgndesc->startAddr - 1. The second region takes the new attributes and starts immediately after the first one.
If rgndesc->startAddr + rgndesc->size is inside a region, the implementation replaces the original region with three regions. The first region conserves the old attributes and terminates at rgndesc->startAddr - 1. The second region takes the new attributes and terminates at rgndesc->startAddr + rgndesc->size - 1. The third region conserves the old attributes and starts immediately after the second one.
An attribute modification can sometimes replace a number of consecutive regions with a single one.
The values for the options field of the rgndesc parameter must be among -K_READABLE, -K_WRITABLE, -K_EXECUTABLE and -K_SUPERVISOR.
The rgnSetProtect() function replaces the values of the -K_READABLE, -K_WRITABLE, -K_EXECUTABLE and -K_SUPERVISOR attributes with the corresponding values from the options field of rgndesc.
If successful, K_OK is returned. Otherwise a negative error code is returned.
Some of the arguments provided are outside the caller's address space.
An inconsistent actor capability or invalid options were given.
actorcap does not specify a reachable actor.
rgndesc->startAddr is not page-aligned.
The system is out of resources.
The segment mapper has detected a mapper-level error.
The target actor and the current actor must be located on the same site.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO