Skip to content

Instantly share code, notes, and snippets.

@jdub

jdub/nxd.diff Secret

Created November 18, 2016 20:19
Show Gist options
  • Save jdub/d41ee66987567e7d8c2d276446a61837 to your computer and use it in GitHub Desktop.
Save jdub/d41ee66987567e7d8c2d276446a61837 to your computer and use it in GitHub Desktop.
project kernel/
diff --git a/include/arch/x86/arch/64/mode/object/structures.bf b/include/arch/x86/arch/64/mode/object/structures.bf
index 07f9157..677a753 100644
--- a/include/arch/x86/arch/64/mode/object/structures.bf
+++ b/include/arch/x86/arch/64/mode/object/structures.bf
@@ -206,7 +206,9 @@ tagged_union fault faultType {
-- VM attributes
block vm_attributes {
- padding 61
+ padding 59
+ field x86NXDBit 1
+ padding 1
field x86PATBit 1
field x86PCDBit 1
field x86PWTBit 1
diff --git a/libsel4/arch_include/x86/sel4/arch/types.h b/libsel4/arch_include/x86/sel4/arch/types.h
index 516556a..a369933 100644
--- a/libsel4/arch_include/x86/sel4/arch/types.h
+++ b/libsel4/arch_include/x86/sel4/arch/types.h
@@ -37,6 +37,7 @@ typedef enum {
seL4_X86_CacheDisabled = 2,
seL4_X86_Uncacheable = 3,
seL4_X86_WriteCombining = 4,
+ seL4_X86_ExecuteNever = 5,
SEL4_FORCE_LONG_ENUM(seL4_X86_VMAttributes),
} seL4_X86_VMAttributes;
diff --git a/src/arch/x86/64/kernel/vspace.c b/src/arch/x86/64/kernel/vspace.c
index 3357acd..834342a 100644
--- a/src/arch/x86/64/kernel/vspace.c
+++ b/src/arch/x86/64/kernel/vspace.c
@@ -797,7 +797,7 @@ static pdpte_t CONST
makeUserPDPTEHugePage(paddr_t paddr, vm_attributes_t vm_attr, vm_rights_t vm_rights)
{
return pdpte_pdpte_1g_new(
- 0, /* xd */
+ vm_attributes_get_x86NXDBit(vm_attr), /* xd */
paddr, /* physical address */
0, /* PAT */
0, /* global */
@@ -833,7 +833,7 @@ pde_t CONST
makeUserPDELargePage(paddr_t paddr, vm_attributes_t vm_attr, vm_rights_t vm_rights)
{
return pde_pde_large_new(
- 0, /* xd */
+ vm_attributes_get_x86NXDBit(vm_attr), /* xd */
paddr, /* page_base_address */
vm_attributes_get_x86PATBit(vm_attr), /* pat */
0, /* global */
@@ -852,7 +852,7 @@ makeUserPDEPageTable(paddr_t paddr, vm_attributes_t vm_attr)
{
return pde_pde_small_new(
- 0, /* xd */
+ vm_attributes_get_x86NXDBit(vm_attr), /* xd */
paddr, /* pt_base_address */
0, /* accessed */
vm_attributes_get_x86PCDBit(vm_attr), /* cache_disabled */
@@ -900,7 +900,7 @@ pte_t CONST
makeUserPTE(paddr_t paddr, vm_attributes_t vm_attr, vm_rights_t vm_rights)
{
return pte_new(
- 0, /* xd */
+ vm_attributes_get_x86NXDBit(vm_attr), /* xd */
paddr, /* page_base_address */
0, /* global */
vm_attributes_get_x86PATBit(vm_attr), /* pat */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment