vm: fix sanity checks on arm
The 'polarity' of the RW bit is inversed on ARM, causing one of the sanity check compensations to fail. ARM now runs basic stuff with sanity checks passing. Change-Id: Iee28ab63e430e759f204eeb204b24c301d5ea3c9
This commit is contained in:
parent
3de9b14567
commit
b7ea9f3fd1
1 changed files with 10 additions and 6 deletions
|
@ -171,15 +171,10 @@ static u32_t findhole(int pages)
|
||||||
assert(pages > 0);
|
assert(pages > 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SANITYCHECKS
|
|
||||||
curv = ((u32_t) random()) % ((vmax - vmin)/VM_PAGE_SIZE);
|
|
||||||
curv *= VM_PAGE_SIZE;
|
|
||||||
curv += vmin;
|
|
||||||
#else
|
|
||||||
curv = lastv;
|
curv = lastv;
|
||||||
if(curv < vmin || curv >= vmax)
|
if(curv < vmin || curv >= vmax)
|
||||||
curv = vmin;
|
curv = vmin;
|
||||||
#endif
|
|
||||||
try_restart = 1;
|
try_restart = 1;
|
||||||
|
|
||||||
/* Start looking for a free page starting at vmin. */
|
/* Start looking for a free page starting at vmin. */
|
||||||
|
@ -958,10 +953,17 @@ int pt_writemap(struct vmproc * vmp,
|
||||||
maskedentry &= ~(I386_VM_ACC|I386_VM_DIRTY);
|
maskedentry &= ~(I386_VM_ACC|I386_VM_DIRTY);
|
||||||
#endif
|
#endif
|
||||||
/* Verify pagetable entry. */
|
/* Verify pagetable entry. */
|
||||||
|
#if defined(__i386__)
|
||||||
if(entry & ARCH_VM_PTE_RW) {
|
if(entry & ARCH_VM_PTE_RW) {
|
||||||
/* If we expect a writable page, allow a readonly page. */
|
/* If we expect a writable page, allow a readonly page. */
|
||||||
maskedentry |= ARCH_VM_PTE_RW;
|
maskedentry |= ARCH_VM_PTE_RW;
|
||||||
}
|
}
|
||||||
|
#elif defined(__arm__)
|
||||||
|
if(!(entry & ARCH_VM_PTE_RO)) {
|
||||||
|
/* If we expect a writable page, allow a readonly page. */
|
||||||
|
maskedentry &= ~ARCH_VM_PTE_RO;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if(maskedentry != entry) {
|
if(maskedentry != entry) {
|
||||||
printf("pt_writemap: mismatch: ");
|
printf("pt_writemap: mismatch: ");
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
|
@ -979,6 +981,8 @@ int pt_writemap(struct vmproc * vmp,
|
||||||
printf(" masked %s; ",
|
printf(" masked %s; ",
|
||||||
ptestr(maskedentry));
|
ptestr(maskedentry));
|
||||||
printf(" expected %s\n", ptestr(entry));
|
printf(" expected %s\n", ptestr(entry));
|
||||||
|
printf("found 0x%x, wanted 0x%x\n",
|
||||||
|
pt->pt_pt[pde][pte], entry);
|
||||||
ret = EFAULT;
|
ret = EFAULT;
|
||||||
goto resume_exit;
|
goto resume_exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue