提交 d920eaa4 编写于 作者: R Russell King (Oracle)

ARM: Fix kgdb breakpoint for Thumb2

The kgdb code needs to register an undef hook for the Thumb UDF
instruction that will fault in order to be functional on Thumb2
platforms.
Reported-by: NJohannes Stezenbach <js@sig21.net>
Tested-by: NJohannes Stezenbach <js@sig21.net>
Fixes: 5cbad0eb ("kgdb: support for ARCH=arm")
Signed-off-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
上级 9f80ccda
...@@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) ...@@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
return 0; return 0;
} }
static struct undef_hook kgdb_brkpt_hook = { static struct undef_hook kgdb_brkpt_arm_hook = {
.instr_mask = 0xffffffff, .instr_mask = 0xffffffff,
.instr_val = KGDB_BREAKINST, .instr_val = KGDB_BREAKINST,
.cpsr_mask = MODE_MASK, .cpsr_mask = PSR_T_BIT | MODE_MASK,
.cpsr_val = SVC_MODE, .cpsr_val = SVC_MODE,
.fn = kgdb_brk_fn .fn = kgdb_brk_fn
}; };
static struct undef_hook kgdb_compiled_brkpt_hook = { static struct undef_hook kgdb_brkpt_thumb_hook = {
.instr_mask = 0xffff,
.instr_val = KGDB_BREAKINST & 0xffff,
.cpsr_mask = PSR_T_BIT | MODE_MASK,
.cpsr_val = PSR_T_BIT | SVC_MODE,
.fn = kgdb_brk_fn
};
static struct undef_hook kgdb_compiled_brkpt_arm_hook = {
.instr_mask = 0xffffffff, .instr_mask = 0xffffffff,
.instr_val = KGDB_COMPILED_BREAK, .instr_val = KGDB_COMPILED_BREAK,
.cpsr_mask = MODE_MASK, .cpsr_mask = PSR_T_BIT | MODE_MASK,
.cpsr_val = SVC_MODE, .cpsr_val = SVC_MODE,
.fn = kgdb_compiled_brk_fn .fn = kgdb_compiled_brk_fn
}; };
static struct undef_hook kgdb_compiled_brkpt_thumb_hook = {
.instr_mask = 0xffff,
.instr_val = KGDB_COMPILED_BREAK & 0xffff,
.cpsr_mask = PSR_T_BIT | MODE_MASK,
.cpsr_val = PSR_T_BIT | SVC_MODE,
.fn = kgdb_compiled_brk_fn
};
static int __kgdb_notify(struct die_args *args, unsigned long cmd) static int __kgdb_notify(struct die_args *args, unsigned long cmd)
{ {
struct pt_regs *regs = args->regs; struct pt_regs *regs = args->regs;
...@@ -210,8 +226,10 @@ int kgdb_arch_init(void) ...@@ -210,8 +226,10 @@ int kgdb_arch_init(void)
if (ret != 0) if (ret != 0)
return ret; return ret;
register_undef_hook(&kgdb_brkpt_hook); register_undef_hook(&kgdb_brkpt_arm_hook);
register_undef_hook(&kgdb_compiled_brkpt_hook); register_undef_hook(&kgdb_brkpt_thumb_hook);
register_undef_hook(&kgdb_compiled_brkpt_arm_hook);
register_undef_hook(&kgdb_compiled_brkpt_thumb_hook);
return 0; return 0;
} }
...@@ -224,8 +242,10 @@ int kgdb_arch_init(void) ...@@ -224,8 +242,10 @@ int kgdb_arch_init(void)
*/ */
void kgdb_arch_exit(void) void kgdb_arch_exit(void)
{ {
unregister_undef_hook(&kgdb_brkpt_hook); unregister_undef_hook(&kgdb_brkpt_arm_hook);
unregister_undef_hook(&kgdb_compiled_brkpt_hook); unregister_undef_hook(&kgdb_brkpt_thumb_hook);
unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook);
unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook);
unregister_die_notifier(&kgdb_notifier); unregister_die_notifier(&kgdb_notifier);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册