added code for debugging pagefaults

This commit is contained in:
Ben Gras 2008-12-16 14:33:53 +00:00
parent 4be5b6f437
commit 710f44c4b8
2 changed files with 7 additions and 4 deletions

View file

@ -54,7 +54,7 @@ _PROTOTYPE( int sys_vmctl_get_pagefault_i386, (endpoint_t *who, u32_t *cr2, u32_
_PROTOTYPE( int sys_vmctl_get_cr3_i386, (endpoint_t who, u32_t *cr3) );
_PROTOTYPE( int sys_vmctl_get_memreq, (endpoint_t *who, vir_bytes *mem,
vir_bytes *len, int *wrflag) );
_PROTOTYPE( int sys_vmctl_stacktrace(endpoint_t who));
_PROTOTYPE( int sys_vmctl_stacktrace, (endpoint_t who));

View file

@ -70,8 +70,9 @@ PUBLIC void handle_pagefaults(void)
/* See if address is valid at all. */
if(!(region = map_lookup(vmp, addr))) {
vm_assert(PFERR_NOPAGE(err));
printf("VM: SIGSEGV %d bad addr 0x%lx %s\n",
printf("VM: pagefault: SIGSEGV %d bad addr 0x%lx %s\n",
ep, arch_map2vir(vmp, addr), pf_errstr(err));
sys_vmctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
vm_panic("sys_kill failed", s);
continue;
@ -84,8 +85,9 @@ PUBLIC void handle_pagefaults(void)
/* If process was writing, see if it's writable. */
if(!(region->flags & VR_WRITABLE) && wr) {
printf("VM: SIGSEGV %d ro map 0x%lx %s\n",
printf("VM: pagefault: SIGSEGV %d ro map 0x%lx %s\n",
ep, arch_map2vir(vmp, addr), pf_errstr(err));
sys_vmctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
vm_panic("sys_kill failed", s);
continue;
@ -96,7 +98,8 @@ PUBLIC void handle_pagefaults(void)
/* Access is allowed; handle it. */
if((r=map_pagefault(vmp, region, offset, wr)) != OK) {
printf("VM: SIGSEGV %d pagefault not handled\n", ep);
printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep);
sys_vmctl_stacktrace(vmp->vm_endpoint);
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
vm_panic("sys_kill failed", s);
continue;