提交 5e954eaa 编写于 作者: K Kefeng Wang 提交者: Zheng Zengkai

ARM: mm: Provide is_write_fault()

hulk inclusion
category: feature
bugzilla: 181005 https://gitee.com/openeuler/kernel/issues/I4EUY7

-----------------------------------------------

The function will check whether the fault is caused by a write access.
Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NPeng Liu <liupeng256@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 12c11a8b
......@@ -112,6 +112,11 @@ void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
{ }
#endif /* CONFIG_MMU */
static inline bool is_write_fault(unsigned int fsr)
{
return (fsr & FSR_WRITE) && !(fsr & FSR_CM);
}
static void die_kernel_fault(const char *msg, struct mm_struct *mm,
unsigned long addr, unsigned int fsr,
struct pt_regs *regs)
......@@ -274,7 +279,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (user_mode(regs))
flags |= FAULT_FLAG_USER;
if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) {
if (is_write_fault(fsr)) {
flags |= FAULT_FLAG_WRITE;
vm_flags = VM_WRITE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册