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
This commit is contained in:
Ben Gras 2013-01-29 17:52:08 +00:00
parent e641d42a37
commit 08cb986d3f
2 changed files with 26 additions and 8 deletions

View 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__ */
}

View 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;