From 7138b2740a816a11da21be837e80f7666040fac1 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Wed, 28 May 2014 11:44:44 +0200 Subject: [PATCH] hw: fix section insertion in translation tables Fixes an alignment problem introduced by commit "hw: map core on demand" where physical address alignment wasn't checked anymore, when inserting a section within the first-level table of ARM's short translation table format. Many thanks to Christian Prochaska for helping to debug the problem. --- repos/base-hw/src/core/arm/short_translation_table.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/repos/base-hw/src/core/arm/short_translation_table.h b/repos/base-hw/src/core/arm/short_translation_table.h index 042d37671..49e0656d1 100644 --- a/repos/base-hw/src/core/arm/short_translation_table.h +++ b/repos/base-hw/src/core/arm/short_translation_table.h @@ -394,10 +394,10 @@ class Arm::Section_table */ static bool valid(access_t & v) { return type(v) != FAULT; } - static inline Type align(addr_t vo, size_t size) + static inline Type align(addr_t vo, addr_t pa, size_t size) { - return ((vo & VIRT_OFFSET_MASK) || size < VIRT_SIZE) - ? PAGE_TABLE : SECTION; + return ((vo & VIRT_OFFSET_MASK) || (pa & VIRT_OFFSET_MASK) || + size < VIRT_SIZE) ? PAGE_TABLE : SECTION; } }; @@ -588,7 +588,7 @@ class Arm::Section_table & Descriptor::VIRT_BASE_MASK; /* decide granularity of entry that can be inserted */ - switch (Descriptor::align(vo, size)) { + switch (Descriptor::align(vo, pa, size)) { case Descriptor::SECTION: {