]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: fix sanity checks on arm 86/286/1
authorBen Gras <ben@minix3.org>
Fri, 1 Feb 2013 16:48:40 +0000 (17:48 +0100)
committerBen Gras <ben@minix3.org>
Fri, 1 Feb 2013 16:45:56 +0000 (16:45 +0000)
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

servers/vm/arch/i386/pagetable.c

index 0d51fd2ba69b48ff59a1d2554eeeb78939235e17..30cf912fbd2e3cbf858eab866b906ab561beeca2 100644 (file)
@@ -171,15 +171,10 @@ static u32_t findhole(int pages)
        assert(pages > 0);
 #endif
 
-#if SANITYCHECKS
-       curv = ((u32_t) random()) % ((vmax - vmin)/VM_PAGE_SIZE);
-       curv *= VM_PAGE_SIZE;
-       curv += vmin;
-#else
        curv = lastv;
        if(curv < vmin || curv >= vmax)
                curv = vmin;
-#endif
+
        try_restart = 1;
 
        /* 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);
 #endif
                        /* Verify pagetable entry. */
+#if defined(__i386__)
                        if(entry & ARCH_VM_PTE_RW) {
                                /* If we expect a writable page, allow a readonly page. */
                                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) {
                                printf("pt_writemap: mismatch: ");
 #if defined(__i386__)
@@ -979,6 +981,8 @@ int pt_writemap(struct vmproc * vmp,
                                printf(" masked %s; ",
                                        ptestr(maskedentry));
                                printf(" expected %s\n", ptestr(entry));
+                               printf("found 0x%x, wanted 0x%x\n", 
+                                       pt->pt_pt[pde][pte], entry);
                                ret = EFAULT;
                                goto resume_exit;
                        }