Fix annoying page zero bug

上级 a8028fca
...@@ -608,9 +608,10 @@ vmap::pagefault(uptr va, u32 err) ...@@ -608,9 +608,10 @@ vmap::pagefault(uptr va, u32 err)
err, va, m->va_type, m->n->ref(), myproc()->pid); err, va, m->va_type, m->n->ref(), myproc()->pid);
if (m->n && !m->n->page[npg]) if (m->n && !m->n->page[npg])
// m->n->ip != nullptr implies we'll copy over the page // XXX(sbw) you might think we don't need to zero if ONDEMAND;
// with loadpg before returning // however, our vmnode might include not backed by a file
if (m->n->allocpg(npg, m->n->ip == nullptr) < 0) { // (e.g. the bss section of an ELF segment)
if (m->n->allocpg(npg, true) < 0) {
cprintf("pagefault: couldn't allocate pages\n"); cprintf("pagefault: couldn't allocate pages\n");
return -1; return -1;
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论