提交 0f449948 编写于 作者: W Wu Liliu 提交者: guzitao

sw64: check processor state by user_mode(regs)

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG

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

The `regs->ps & 8` and `regs->ps & ~IPL_MAX` don't have a clear meaning.
We replace them with user_mode(regs) and !user_mode(regs), and reserve
regs->ps[63:4] for future extension.
Signed-off-by: NWu Liliu <wuliliu@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 3c72e2d1
......@@ -77,7 +77,7 @@ dik_show_code(unsigned int *pc)
void die_if_kernel(char *str, struct pt_regs *regs, long err)
{
if (regs->ps & 8)
if (user_mode(regs))
return;
#ifdef CONFIG_SMP
printk("CPU %d ", hard_smp_processor_id());
......@@ -149,7 +149,7 @@ do_entIF(unsigned long inst_type, struct pt_regs *regs)
type = inst_type & 0xffffffff;
inst = inst_type >> 32;
if ((regs->ps & ~IPL_MAX) == 0 && type != 4) {
if (!user_mode(regs) && type != 4) {
if (type == 1) {
const unsigned int *data
= (const unsigned int *) regs->pc;
......@@ -253,7 +253,7 @@ do_entIF(unsigned long inst_type, struct pt_regs *regs)
if (notify_die(DIE_UPROBE_XOL, "uprobe_xol", regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
return;
}
if ((regs->ps & ~IPL_MAX) == 0)
if (!user_mode(regs))
die_if_kernel("Instruction fault", regs, type);
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册