From: Ben Gras Date: Tue, 29 Jan 2013 17:52:08 +0000 (+0000) Subject: vm: fix kernel-requested mappings for arm X-Git-Tag: v3.2.1~49 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-keyfromlabel.html?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F268%2F1;p=minix.git vm: fix kernel-requested mappings for arm . 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 --- diff --git a/lib/libc/sys-minix/init.c b/lib/libc/sys-minix/init.c index a515761ea..544a60d53 100644 --- a/lib/libc/sys-minix/init.c +++ b/lib/libc/sys-minix/init.c @@ -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__ */ } diff --git a/servers/vm/arch/i386/pagetable.c b/servers/vm/arch/i386/pagetable.c index 660e91178..0d51fd2ba 100644 --- a/servers/vm/arch/i386/pagetable.c +++ b/servers/vm/arch/i386/pagetable.c @@ -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;