提交 6a371af4 创建 作者: Austin Clements's avatar Austin Clements 提交者: Silas Boyd-Wickizer

Use uerr in lots of places in trap/vm

So we can hush up spurious errors.
上级 e0824a1c
......@@ -68,6 +68,9 @@ struct vma
NEW_DELETE_OPS(vma)
};
class print_stream;
void to_stream(print_stream *s, vma *v);
// An address space: a set of vmas plus h/w page table.
// The elements of e[] are not ordered by address.
struct vmap {
......
......@@ -12,6 +12,7 @@
#include "bits.hh"
#include "kalloc.hh"
#include "apic.hh"
#include "kstream.hh"
extern "C" void __uaccess_end(void);
......@@ -73,7 +74,7 @@ do_pagefault(struct trapframe *tf)
#endif
return 0;
}
cprintf("pagefault: failed in user\n");
uerr.println("pagefault: failed in user");
cli();
}
return -1;
......@@ -171,10 +172,11 @@ trap(struct trapframe *tf)
kerneltrap(tf);
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %lu err %d on cpu %d "
"rip 0x%lx rsp 0x%lx addr 0x%lx--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno, tf->err,
mycpu()->id, tf->rip, tf->rsp, rcr2());
uerr.println("pid ", myproc()->pid, ' ', myproc()->name,
": trap ", (u64)tf->trapno, " err ", (u32)tf->err,
" on cpu ", mycpuid(), " rip ", shex(tf->rip),
" rsp ", shex(tf->rsp), " addr ", shex(rcr2()),
"--kill proc");
myproc()->killed = 1;
}
......
......@@ -16,6 +16,7 @@
#include "sperf.hh"
#include "uwq.hh"
#include "kmtrace.hh"
#include "kstream.hh"
enum { vm_debug = 0 };
enum { tlb_shootdown = 1 };
......@@ -188,6 +189,13 @@ vma::~vma()
n->decref();
}
void
to_stream(print_stream *s, vma *v)
{
s->print("vma@[", shex(v->vma_start), ',', shex(v->vma_end), ')',
v->va_type == COW ? "/COW" : "");
}
/*
* vmap
*/
......@@ -425,8 +433,7 @@ again:
goto again;
vma *rvma = (vma*) r;
cprintf("vmap::insert: overlap with %p: 0x%lx--0x%lx\n",
rvma, rvma->vma_start, rvma->vma_end);
uerr.println("vmap::insert: overlap with ", rvma);
return -1;
}
#endif
......@@ -509,8 +516,9 @@ vmap::remove(uptr vma_start, uptr len)
for (auto r: span) {
vma *rvma = (vma*) r;
if (rvma->vma_start < vma_start || rvma->vma_end > vma_end) {
cprintf("vmap::remove: partial unmap not supported; unmapping [%#lx,%#lx) from [%#lx,%#lx)\n",
vma_start, vma_start+len, rvma->vma_start, rvma->vma_end);
uerr.println("vmap::remove: partial unmap not supported; "
"unmapping [", shex(vma_start),",",shex(vma_start+len), ")"
" from ", rvma);
return -1;
}
}
......@@ -821,8 +829,8 @@ vmap::sbrk(ssize_t n, uptr *addr)
prev = e;
#endif
} else {
cprintf("growproc: overlap with existing mapping; brk %lx n %ld\n",
curbrk, n);
uerr.println("growproc: overlap with existing mapping; "
"brk ", shex(curbrk), " n ", n);
return -1;
}
}
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论