aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-11-09 23:57:57 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-11-09 23:57:57 +0100
commitc9a43be4dbabad0d6f51712e60f2ff0834eed36a (patch)
treeb569b0e2859e172c6e6639b3e3838099d29c6351
parent253e855d715cf4abebbc4b99af8870a7196c862c (diff)
downloadrpi-MMU-example-c9a43be4dbabad0d6f51712e60f2ff0834eed36a.tar.gz
rpi-MMU-example-c9a43be4dbabad0d6f51712e60f2ff0834eed36a.zip
define struct for supersection
-rw-r--r--translation_table_descriptors.h74
1 files changed, 56 insertions, 18 deletions
diff --git a/translation_table_descriptors.h b/translation_table_descriptors.h
index 35062f8..8f92473 100644
--- a/translation_table_descriptors.h
+++ b/translation_table_descriptors.h
@@ -13,21 +13,21 @@
typedef struct
{
- uint32_t PXN : 1; // bit 0
- uint32_t Bit_1 : 1; // bit 1
- uint32_t B : 1; // bit 2
- uint32_t C : 1; // bit 3
- uint32_t XN : 1; // bit 4
- uint32_t Domain_3_0 : 4; // bits 8:5
- uint32_t Bit_9 : 1; // bit 9
- uint32_t AP_1_0 : 2; // bit 11:10
- uint32_t TEX_2_0 : 3; // bits 14:12
- uint32_t AP_2 : 1; // bit 15
- uint32_t S : 1; // bit 16
- uint32_t nG : 1; // bit 17
- uint32_t Bit_18 : 1; // bit 18
- uint32_t NS : 1; // bit 19
- uint32_t PA_31_20 : 12; // bits 31:20
+ uint32_t PXN : 1; // bit 0
+ uint32_t Bit_1 : 1; // bit 1
+ uint32_t B : 1; // bit 2
+ uint32_t C : 1; // bit 3
+ uint32_t XN : 1; // bit 4
+ uint32_t Domain_3_0 : 4; // bits 8:5
+ uint32_t Bit_9 : 1; // bit 9
+ uint32_t AP_1_0 : 2; // bit 11:10
+ uint32_t TEX_2_0 : 3; // bits 14:12
+ uint32_t AP_2 : 1; // bit 15
+ uint32_t S : 1; // bit 16
+ uint32_t nG : 1; // bit 17
+ uint32_t Bit_18 : 1; // bit 18
+ uint32_t NS : 1; // bit 19
+ uint32_t PA_31_20 : 12; // bits 31:20
#define PRIVILEGED_EXECUTE_NEVER_BIT PXN
#define DESCRIPTOR_TYPE_2 Bit_1
#define BUFFERABLE_BIT B
@@ -79,12 +79,50 @@ typedef struct
#define DESCRIBES_SECTION 0b0
#define DESCRIBES_SUPERSECTION 0b1
+typedef struct
+{
+ uint32_t PXN : 1; // bit 0
+ uint32_t Bit_1 : 1; // bit 1
+ uint32_t B : 1; // bit 2
+ uint32_t C : 1; // bit 3
+ uint32_t XN : 1; // bit 4
+ uint32_t PA_39_36 : 4; // bits 8:5
+ uint32_t Bit_9 : 1; // bit 9
+ uint32_t AP_1_0 : 2; // bit 11:10
+ uint32_t TEX_2_0 : 3; // bits 14:12
+ uint32_t AP_2 : 1; // bit 15
+ uint32_t S : 1; // bit 16
+ uint32_t nG : 1; // bit 17
+ uint32_t Bit_18 : 1; // bit 18
+ uint32_t NS : 1; // bit 19
+ uint32_t PA_35_32 : 4; // bits 23:20
+ uint32_t PA_31_24 : 8; // bits 31:24
+ // most of these are already defined the same for section
+ //#define PRIVILEGED_EXECUTE_NEVER_BIT PXN
+ //#define DESCRIPTOR_TYPE_2 Bit_1
+ //#define BUFFERABLE_BIT B
+ //#define CACHEABLE_BIT C
+ //#define EXECUTE_NEVER_BIT XN
+#define SUPERSECTION_BASE_ADDRESS_39_36 PA_39_36
+ //#define IMPLEMENTATION_DEFINED_BIT Bit_9
+ //#define ACCESS_PERMISSIONS_1_0 AP_1_0
+ //#define TYPE_EXTENSION_2_0 TEX_2_0
+ //#define ACCESS_PERMISSIONS_2 AP_2
+ //#define SHAREABLE_BIT S
+ //#define NON_GLOBAL_BIT nG
+ //#define SECTION_OR_SUPERSECTION_BIT Bit_18
+ //#define NON_SECURE_BIT NS
+#define SUPERSECTION_BASE_ADDRESS_35_32 PA_35_32
+#define SUPERSECTION_BASE_ADDRESS_31_24 PA_31_24
+} short_supersection_descriptor_t;
+
typedef union
{
- uint32_t raw;
- uint8_t descriptor_type;
+ uint32_t raw;
+ uint8_t descriptor_type;
- short_section_descriptor_t section_fields;
+ short_section_descriptor_t section_fields;
+ short_supersection_descriptor_t supersection_fields;
// more to come here (e.g. short_supersection_descriptor_t)
} short_descriptor_t;