my state.

trying to get some memory optimisation (less pagetable reloading,
less tlb purging) features working smoothly.

to be documented when committing to trunk :)
This commit is contained in:
Ben Gras
2009-06-06 23:27:10 +00:00
parent 9d56ac3fc9
commit 4dae6c4bbc
30 changed files with 721 additions and 588 deletions

View File

@@ -290,8 +290,11 @@ PRIVATE void get_work()
continue;
}
if(who_p >= 0 && fproc[who_p].fp_endpoint != who_e) {
printf("FS: receive endpoint inconsistent (%d, %d, %d).\n",
who_e, fproc[who_p].fp_endpoint, who_e);
if(fproc[who_p].fp_endpoint == NONE) {
printf("slot unknown even\n");
}
printf("FS: receive endpoint inconsistent (source %d, who_p %d, stored ep %d, who_e %d).\n",
m_in.m_source, who_p, fproc[who_p].fp_endpoint, who_e);
#if 0
panic(__FILE__, "FS: inconsistent endpoint ", NO_NUM);
#endif

View File

@@ -145,9 +145,12 @@ PUBLIC int do_fork(message *msg)
}
if(fullvm) {
if(handle_memory(vmc, msgaddr, sizeof(message), 1) != OK)
vir_bytes vir;
vir = arch_vir2map(vmc, msgaddr);
if(handle_memory(vmc, vir, sizeof(message), 1) != OK)
vm_panic("can't make message writable (child)", NO_NUM);
if(handle_memory(vmp, msgaddr, sizeof(message), 1) != OK)
vir = arch_vir2map(vmp, msgaddr);
if(handle_memory(vmp, vir, sizeof(message), 1) != OK)
vm_panic("can't make message writable (parent)", NO_NUM);
if((r=pt_bind(&vmc->vm_pt, vmc)) != OK)
vm_panic("fork can't pt_bind", r);

View File

@@ -719,10 +719,8 @@ PUBLIC void pt_init(void)
pt_bind(newpt, vmp);
/* Now actually enable paging. */
if((r=sys_vmctl(SELF, VMCTL_ENABLE_PAGING,
vmp->vm_arch.vm_seg)) != OK) {
vm_panic("VMCTL_ENABLE_PAGING failed", r);
}
if(sys_vmctl_enable_paging(vmp->vm_arch.vm_seg) != OK)
vm_panic("pt_init: enable paging failed", NO_NUM);
/* Back to reality - this is where the stack actually is. */
vmp->vm_arch.vm_seg[S].mem_len -= extra_clicks;

View File

@@ -118,6 +118,8 @@ PUBLIC int main(void)
* verified, and/or pagefaults handled.
*/
do_memory();
break;
case HARDWARE:
do_pagefaults();
break;
case PM_PROC_NR:

View File

@@ -61,6 +61,11 @@ PUBLIC void do_pagefaults(void)
vir_bytes offset;
int p, wr = PFERR_WRITE(err);
#if 0
printf("VM: pagefault: ep %d 0x%lx %s\n",
ep, arch_map2vir(vmp, addr), pf_errstr(err));
#endif
if(vm_isokendpt(ep, &p) != OK)
vm_panic("do_pagefaults: endpoint wrong", ep);
@@ -104,9 +109,11 @@ PUBLIC void do_pagefaults(void)
vm_panic("sys_kill failed", s);
continue;
}
#if 0
printf("VM: map_pf done; ep %d 0x%lx %s\n",
ep, arch_map2vir(vmp, addr), pf_errstr(err));
printf("VM: handling pagefault OK: %d addr 0x%lx %s\n",
ep, arch_map2vir(vmp, addr), pf_errstr(err));
#endif
@@ -126,12 +133,13 @@ PUBLIC void do_pagefaults(void)
PUBLIC void do_memory(void)
{
int r, s;
endpoint_t who;
endpoint_t who, requestor;
vir_bytes mem;
vir_bytes len;
int wrflag;
while((r=sys_vmctl_get_memreq(&who, &mem, &len, &wrflag)) == OK) {
while((r=sys_vmctl_get_memreq(&who, &mem, &len, &wrflag, &requestor))
== OK) {
int p, r = OK;
struct vmproc *vmp;
@@ -141,7 +149,7 @@ PUBLIC void do_memory(void)
r = handle_memory(vmp, mem, len, wrflag);
if(sys_vmctl(who, VMCTL_MEMREQ_REPLY, r) != OK)
if(sys_vmctl(requestor, VMCTL_MEMREQ_REPLY, r) != OK)
vm_panic("do_memory: sys_vmctl failed", r);
#if 0
@@ -170,6 +178,7 @@ int handle_memory(struct vmproc *vmp, vir_bytes mem, vir_bytes len, int wrflag)
if(o > 0) len += VM_PAGE_SIZE - o;
if(!(region = map_lookup(vmp, mem))) {
map_printmap(vmp);
printf("VM: do_memory: memory doesn't exist\n");
r = EFAULT;
} else if(mem + len > region->vaddr + region->length) {