未验证 提交 67474301 编写于 作者: P Pekka Enberg 提交者: Palmer Dabbelt

riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault()

Let's handle the translation of EXC_STORE_PAGE_FAULT to FAULT_FLAG_WRITE
once before looking up the VMA. This makes it easier to extract access
error logic in the next patch.
Signed-off-by: NPekka Enberg <penberg@kernel.org>
Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
上级 7a75f3d4
......@@ -208,6 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
if (cause == EXC_STORE_PAGE_FAULT)
flags |= FAULT_FLAG_WRITE;
retry:
mmap_read_lock(mm);
vma = find_vma(mm, addr);
......@@ -251,7 +254,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
bad_area(regs, mm, code, addr);
return;
}
flags |= FAULT_FLAG_WRITE;
break;
default:
panic("%s: unhandled cause %lu", __func__, cause);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册