module ti.sysbios.family.c64p.MemoryProtect |
|
|
|
MemoryProtect Module
This module provide an API to
get and to
set the permission attributes of a memory range.
A memory range can be set to user
executable,
user
writable, user
readable,
supervisor
executable, supervisor
writable, or supervisor
readable.
Setting a memory range to only user readable, writable or executable
should be done with caution because BIOS executes in supervisor mode.
Whenever setting the permission attributes of a memory range,
the
local CPU access field must be set, if the
local CPU accesses the memory range. If the local field is not set,
an exception is generated if the CPU tries to access the memory range.
[
more ... ]
#include <ti/sysbios/family/c64p/MemoryProtect.h>
Functions |
Bool | |
Bool | |
Functions common to all target modules |
|
|
Defines |
#define | |
#define | |
#define | |
#define | |
#define | |
#define | |
#define | |
DETAILS
This module provide an API to
get and to
set the permission attributes of a memory range.
A memory range can be set to user
executable,
user
writable, user
readable,
supervisor
executable, supervisor
writable, or supervisor
readable.
Setting a memory range to only user readable, writable or executable
should be done with caution because BIOS executes in supervisor mode.
Whenever setting the permission attributes of a memory range,
the
local CPU access field must be set, if the
local CPU accesses the memory range. If the local field is not set,
an exception is generated if the CPU tries to access the memory range.
This module is to be used in correlation with the
Exception module.
When this module is in use, external exceptions are enabled by default.
Any memory protection fault which arises generates an exception.
This exception is processed and decoded by the Exception module.
An example of setting Local L2 RAM to be supervisor read-only and
CPU accessible:
UInt32 paMask;
paMask = MemoryProtect_MPPA_LOCAL |
MemoryProtect_MPPA_SR;
MemoryProtect_setPA((Ptr)0x11800000, 0x40000, paMask);
Calling Context
Function | Hwi | Swi | Task | Main | Startup |
getPA | Y | Y | Y | Y | Y |
setPA | Y | Y | Y | Y | Y |
Definitions:
- Hwi: API is callable from a Hwi thread.
- Swi: API is callable from a Swi thread.
- Task: API is callable from a Task thread.
- Main: API is callable during any of these phases:
- In your module startup after this module is started (e.g. Mod_Module_startupDone() returns TRUE).
- During xdc.runtime.Startup.lastFxns.
- During main().
- During BIOS.startupFxns.
- Startup: API is callable during any of these phases:
- During xdc.runtime.Startup.firstFxns.
- In your module startup before this module is started (e.g. Mod_Module_startupDone() returns FALSE).
|
const MemoryProtect_MPPA_LOCAL |
|
Local CPU may access
#define MemoryProtect_MPPA_LOCAL (UInt32)0x00000100
const MemoryProtect_MPPA_SR |
|
Supervisor mode read
#define MemoryProtect_MPPA_SR (UInt32)0x00000020
const MemoryProtect_MPPA_SW |
|
Supervisor mode may write
#define MemoryProtect_MPPA_SW (UInt32)0x00000010
const MemoryProtect_MPPA_SX |
|
Supervisor mode may execute
#define MemoryProtect_MPPA_SX (UInt32)0x00000008
const MemoryProtect_MPPA_UR |
|
User mode may read
#define MemoryProtect_MPPA_UR (UInt32)0x00000004
const MemoryProtect_MPPA_UW |
|
User mode may write
#define MemoryProtect_MPPA_UW (UInt32)0x00000002
const MemoryProtect_MPPA_UX |
|
User mode may execute
#define MemoryProtect_MPPA_UX (UInt32)0x00000001
MemoryProtect_getPA() // module-wide |
|
Gets the PA (Permission Attribute) corresponding to addr
Bool MemoryProtect_getPA(Ptr addr, UInt32 *paMask);
ARGUMENTS
addr
address of memory location for which the PA applies
paMask
ptr to location where PA mask for addr is stored
RETURNS
if address doesn't belong to any configured MPC then
FALSE, otherwise TRUE and *paMask contains addr's
MPPA setting
MemoryProtect_setPA() // module-wide |
|
Sets the PA (Permission Attribute) corresponding to addr/size
Bool MemoryProtect_setPA(Ptr addr, SizeT size, UInt32 paMask);
ARGUMENTS
addr
begin address of memory block for which the PA applies
size
size of memory block
paMask
PA mask to assign for the memory block
RETURNS
if address doesn't belong to any configured MPC then
FALSE, otherwise TRUE and PA was written to addr's
MPPA register
DETAILS
The PA is applied to all addresses that are spanned by the
memory block.
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool MemoryProtect_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool MemoryProtect_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 MemoryProtect_Module_getMask();
// Returns the diagnostics mask for this module
Void MemoryProtect_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
var MemoryProtect = xdc.useModule('ti.sysbios.family.c64p.MemoryProtect');
module-wide constants & types
module-wide config parameters
generated on Tue, 18 Aug 2015 20:38:09 GMT