]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: fix kernel-requested mappings for arm 68/268/1
authorBen Gras <ben@minix3.org>
Tue, 29 Jan 2013 17:52:08 +0000 (17:52 +0000)
committerBen Gras <ben@minix3.org>
Tue, 29 Jan 2013 17:57:04 +0000 (17:57 +0000)
. make vm tell kernel virtual locations of mappings
. makes _minix_kerninfo feature work
. fix for mappings being larger than what 1 pde can address
  (e.g. devices memory requested on arm)
. still requires a special case for devices memory for the
  kernel, which has to switch to virtual addressing

Change-Id: I2e94090aa432346fa4da0edeba72f0b7406c2ad7

lib/libc/sys-minix/init.c
servers/vm/arch/i386/pagetable.c

index a515761eabd56686ed1c014d66fc1992bb7aeec3..544a60d53f03d5edb847ecd3411139436433bb5c 100644 (file)
@@ -19,9 +19,6 @@ struct minix_ipcvecs _minix_ipcvecs = {
 
 void __minix_init(void)
 {
-#ifdef __arm__
-       _minix_kerninfo = NULL;
-#else
        if((_minix_kernel_info_struct(&_minix_kerninfo)) != 0
          || _minix_kerninfo->kerninfo_magic != KERNINFO_MAGIC) {
                _minix_kerninfo = NULL;
@@ -29,6 +26,5 @@ void __minix_init(void)
                _minix_kerninfo->minix_ipcvecs) {
                _minix_ipcvecs = *_minix_kerninfo->minix_ipcvecs;
          }
-#endif /* __arm__ */
 }
 
index 660e91178376ad0de1c23b7d94856fd4ab58b0ee..0d51fd2ba69b48ff59a1d2554eeeb78939235e17 100644 (file)
@@ -646,7 +646,9 @@ int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
                                 */
                                return r;
                        }
+                       assert(pt->pt_pt[pde]);
                }
+               assert(pt->pt_pt[pde]);
                assert(pt->pt_dir[pde]);
                assert(pt->pt_dir[pde] & ARCH_VM_PDE_PRESENT);
        }
@@ -1215,17 +1217,14 @@ void pt_init(void)
 
                while(sys_vmctl_get_mapping(index, &addr, &len,
                        &flags) == OK)  {
+                       int usedpde;
                        vir_bytes vir;
                        if(index >= MAX_KERNMAPPINGS)
                                panic("VM: too many kernel mappings: %d", index);
                        kern_mappings[index].phys_addr = addr;
                        kern_mappings[index].len = len;
                        kern_mappings[index].flags = flags;
-#if defined(__i386__)
                        kern_mappings[index].vir_addr = offset;
-#elif defined(__arm__)
-                       kern_mappings[index].vir_addr = addr;
-#endif
                        kern_mappings[index].flags =
                                ARCH_VM_PTE_PRESENT;
                        if(flags & VMMF_UNCACHED)
@@ -1262,6 +1261,17 @@ void pt_init(void)
                        offset += len;
                        index++;
                        kernmappings++;
+
+#if defined(__i386__)
+                       usedpde = I386_VM_PDE(offset);
+#elif defined(__arm__)
+                       usedpde = ARM_VM_PDE(offset);
+#endif
+                       while(usedpde > kernmap_pde) {
+                               int newpde = freepde();
+                               assert(newpde == kernmap_pde+1);
+                               kernmap_pde = newpde;
+                       }
                }
        }
 
@@ -1474,6 +1484,18 @@ int pt_mapkernel(pt_t *pt)
                        kern_mappings[i].flags, 0)) != OK) {
                        return r;
                }
+
+#if defined(__arm__)
+               if(kern_mappings[i].phys_addr == 0x48000000) {
+                       if((r=pt_writemap(NULL, pt,
+                               kern_mappings[i].phys_addr,
+                               kern_mappings[i].phys_addr,
+                               kern_mappings[i].len,
+                               kern_mappings[i].flags, 0)) != OK) {
+                               return r;
+                       }
+               }
+#endif
        }
 
        return OK;