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.
This commit is contained in:
Stefan Kalkowski 2014-05-28 11:44:44 +02:00
parent a42a5995cf
commit 7138b2740a
1 changed files with 4 additions and 4 deletions

View File

@ -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:
{