提交 fca2e672 编写于 作者: Z ZhangZifei

PTW: update a,d throuth pf

上级 68d20a15
......@@ -256,6 +256,9 @@ vaddr_t isa_exec_once() {
exec(&s);
if (cpu.mem_exception != MEM_OK) {
#ifdef XIANGSHAN_DEBUG
printf("[NEMU] raise page fault\n");
#endif
raise_intr(&s, cpu.mem_exception, cpu.pc);
cpu.mem_exception = MEM_OK;
}
......
......@@ -108,14 +108,18 @@ static paddr_t ptw(vaddr_t vaddr, int type) {
pg_base = (pg_base & ~pg_mask) | (vaddr & pg_mask & ~PGMASK);
}
#if !_SHARE
// #if !_SHARE
bool is_write = (type == MEM_TYPE_WRITE);
if (!pte.a || (!pte.d && is_write)) {
pte.a = true;
pte.d |= is_write;
paddr_write(p_pte, pte.val, PTE_SIZE);
}
#ifdef XIANGSHAN_DEBUG
printf("[NEMU] update a/d throgh pf\n");
#endif
return MEM_RET_FAIL;
// pte.a = true;
// pte.d |= is_write;
// paddr_write(p_pte, pte.val, PTE_SIZE);
}
// #endif
return pg_base | MEM_RET_OK;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册