From d9a0f76e7af9477a209c37c02d924ab83fe9f931 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 4 Jun 2019 16:08:53 +0200 Subject: [PATCH] hw: extend long-descriptor page table format Ref #3405 --- repos/base-hw/src/include/hw/spec/arm/lpae.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/repos/base-hw/src/include/hw/spec/arm/lpae.h b/repos/base-hw/src/include/hw/spec/arm/lpae.h index 481098c93..7e78eecfd 100644 --- a/repos/base-hw/src/include/hw/spec/arm/lpae.h +++ b/repos/base-hw/src/include/hw/spec/arm/lpae.h @@ -28,6 +28,7 @@ namespace Hw { SIZE_LOG2_1GB = 30, SIZE_LOG2_4GB = 32, SIZE_LOG2_256GB = 38, + SIZE_LOG2_512GB = 39, }; /** @@ -93,7 +94,7 @@ namespace Hw { STAGE1, SIZE_LOG2_1GB>; using Level_1_stage_1_translation_table = Level_x_translation_table; + STAGE1, SIZE_LOG2_512GB>; using Level_3_stage_2_translation_table = Level_3_translation_table; using Level_2_stage_2_translation_table = @@ -162,7 +163,7 @@ class Hw::Long_translation_table struct Output_address : Descriptor::template Bitfield { }; + 47 - BLOCK_SIZE_LOG2> { }; /** * Indicates that 16 adjacent entries point to contiguous @@ -176,7 +177,7 @@ class Hw::Long_translation_table struct Table_descriptor : Descriptor { - struct Next_table : Descriptor::template Bitfield<12, 27> { }; + struct Next_table : Descriptor::template Bitfield<12, 36> { }; static typename Descriptor::access_t create(void * const pa) { @@ -293,8 +294,10 @@ class Hw::Long_translation_table template void _range_op(addr_t vo, addr_t pa, size_t size, FUNC &&func) { - for (size_t i = vo >> BLOCK_SIZE_LOG2; size > 0; - i = vo >> BLOCK_SIZE_LOG2) { + auto idx = [] (addr_t v) -> addr_t { + return (v >> BLOCK_SIZE_LOG2) & (MAX_ENTRIES-1); }; + + for (size_t i = idx(vo); size > 0; i = idx(vo)) { addr_t end = (vo + BLOCK_SIZE) & BLOCK_MASK; size_t sz = Genode::min(size, end-vo);