From ab3821772091bda3debed50ccb82612ceaefda66 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Sun, 25 Feb 2018 14:37:44 +0100 Subject: [PATCH] Fix mmu descriptor mistakes --- exosphere/memory_map.h | 10 +++++----- exosphere/mmu.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exosphere/memory_map.h b/exosphere/memory_map.h index 15a0725e5..a0a05a8dc 100644 --- a/exosphere/memory_map.h +++ b/exosphere/memory_map.h @@ -47,8 +47,8 @@ static const struct { size_t size; uint64_t attributes; } g_lp0_entry_ram_segments[] = { - { 0x40020000, 0x10000, MMU_PTE_TABLE_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted TZRAM */ - { 0x40003000, 0x01000, MMU_PTE_TABLE_NS | ATTRIB_MEMTYPE_DEVICE }, /* LP0 entry code */ + { 0x40020000, 0x10000, MMU_PTE_BLOCK_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted TZRAM */ + { 0x40003000, 0x01000, MMU_PTE_BLOCK_NS | ATTRIB_MEMTYPE_DEVICE }, /* LP0 entry code */ { 0x7C010000, 0x10000, MMU_AP_PRIV_RO | ATTRIB_MEMTYPE_NORMAL }, /* TZRAM to encrypt */ }; @@ -57,8 +57,8 @@ static const struct { size_t size; uint64_t attributes; } g_warmboot_ram_segments[] = { - { 0x8000F000, 0x01000, MMU_PTE_TABLE_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted SE state for bootROM */ - { 0x80010000, 0x10000, MMU_PTE_TABLE_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted TZRAM for warmboot.bin */ + { 0x8000F000, 0x01000, MMU_PTE_BLOCK_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted SE state for bootROM */ + { 0x80010000, 0x10000, MMU_PTE_BLOCK_NS | ATTRIB_MEMTYPE_DEVICE }, /* Encrypted TZRAM for warmboot.bin */ }; static const struct { @@ -170,7 +170,7 @@ static inline uintptr_t mmio_get_device_address(unsigned int device_id) { static inline void mmio_map_all_devices(uintptr_t *mmu_l3_tbl) { static const uint64_t secure_device_attributes = MMU_PTE_BLOCK_XN | MMU_PTE_BLOCK_INNER_SHAREBLE | ATTRIB_MEMTYPE_DEVICE; - static const uint64_t device_attributes = MMU_PTE_TABLE_NS | secure_device_attributes; + static const uint64_t device_attributes = MMU_PTE_BLOCK_NS | secure_device_attributes; for(size_t i = 0, offset = 0; i < sizeof(g_devices) / sizeof(g_devices[0]); i++) { uint64_t attributes = g_devices[i].is_secure ? secure_device_attributes : device_attributes; diff --git a/exosphere/mmu.h b/exosphere/mmu.h index f41da88f3..391e0b9cc 100644 --- a/exosphere/mmu.h +++ b/exosphere/mmu.h @@ -49,7 +49,7 @@ #define MMU_PTE_TYPE_BLOCK 1 /* L3 only */ -#define MMU_PTE_TYPE_PAGE 1 +#define MMU_PTE_TYPE_PAGE 3 #define MMU_PTE_TABLE_PXN BITL(59) #define MMU_PTE_TABLE_XN BITL(60)