diff options
author | danh-arm <dan.handley@arm.com> | 2016-07-15 18:55:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 18:55:43 +0100 |
commit | aadb1350eed3c18aec6cd999519cef55d93678b3 (patch) | |
tree | d851cbd6afa9f9b14676cde93bbf4e49f0cfebf1 /include/lib/xlat_tables.h | |
parent | 9306f135922bc7811dfc1e24a755c38ce2e671cd (diff) | |
parent | 91fad6551ee3e5529f9b442cd4a084251cdebe1d (diff) |
Merge pull request #662 from sandrine-bailleux-arm/sb/rodata-xn
Map read-only data as execute-never
Diffstat (limited to 'include/lib/xlat_tables.h')
-rw-r--r-- | include/lib/xlat_tables.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/lib/xlat_tables.h b/include/lib/xlat_tables.h index 7d57521b..b51a1de5 100644 --- a/include/lib/xlat_tables.h +++ b/include/lib/xlat_tables.h @@ -134,6 +134,8 @@ #define MT_PERM_SHIFT 3 /* Security state (SECURE/NS) */ #define MT_SEC_SHIFT 4 +/* Access permissions for instruction execution (EXECUTE/EXECUTE_NEVER) */ +#define MT_EXECUTE_SHIFT 5 /* * Memory mapping attributes @@ -155,8 +157,21 @@ typedef enum { MT_SECURE = 0 << MT_SEC_SHIFT, MT_NS = 1 << MT_SEC_SHIFT, + + /* + * Access permissions for instruction execution are only relevant for + * normal read-only memory, i.e. MT_MEMORY | MT_RO. They are ignored + * (and potentially overridden) otherwise: + * - Device memory is always marked as execute-never. + * - Read-write normal memory is always marked as execute-never. + */ + MT_EXECUTE = 0 << MT_EXECUTE_SHIFT, + MT_EXECUTE_NEVER = 1 << MT_EXECUTE_SHIFT, } mmap_attr_t; +#define MT_CODE (MT_MEMORY | MT_RO | MT_EXECUTE) +#define MT_RO_DATA (MT_MEMORY | MT_RO | MT_EXECUTE_NEVER) + /* * Structure for specifying a single region of memory. */ |