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: Johannes Stezenbach <js@sig21.net>
Tested-by: Johannes Stezenbach <js@sig21.net>
Fixes: 5cbad0ebf45c ("kgdb: support for ARCH=arm")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

+28 -8
+28 -8
arch/arm/kernel/kgdb.c
··· 154 return 0; 155 } 156 157 - static struct undef_hook kgdb_brkpt_hook = { 158 .instr_mask = 0xffffffff, 159 .instr_val = KGDB_BREAKINST, 160 - .cpsr_mask = MODE_MASK, 161 .cpsr_val = SVC_MODE, 162 .fn = kgdb_brk_fn 163 }; 164 165 - static struct undef_hook kgdb_compiled_brkpt_hook = { 166 .instr_mask = 0xffffffff, 167 .instr_val = KGDB_COMPILED_BREAK, 168 - .cpsr_mask = MODE_MASK, 169 .cpsr_val = SVC_MODE, 170 .fn = kgdb_compiled_brk_fn 171 }; 172 ··· 226 if (ret != 0) 227 return ret; 228 229 - register_undef_hook(&kgdb_brkpt_hook); 230 - register_undef_hook(&kgdb_compiled_brkpt_hook); 231 232 return 0; 233 } ··· 242 */ 243 void kgdb_arch_exit(void) 244 { 245 - unregister_undef_hook(&kgdb_brkpt_hook); 246 - unregister_undef_hook(&kgdb_compiled_brkpt_hook); 247 unregister_die_notifier(&kgdb_notifier); 248 } 249
··· 154 return 0; 155 } 156 157 + static struct undef_hook kgdb_brkpt_arm_hook = { 158 .instr_mask = 0xffffffff, 159 .instr_val = KGDB_BREAKINST, 160 + .cpsr_mask = PSR_T_BIT | MODE_MASK, 161 .cpsr_val = SVC_MODE, 162 .fn = kgdb_brk_fn 163 }; 164 165 + static struct undef_hook kgdb_brkpt_thumb_hook = { 166 + .instr_mask = 0xffff, 167 + .instr_val = KGDB_BREAKINST & 0xffff, 168 + .cpsr_mask = PSR_T_BIT | MODE_MASK, 169 + .cpsr_val = PSR_T_BIT | SVC_MODE, 170 + .fn = kgdb_brk_fn 171 + }; 172 + 173 + static struct undef_hook kgdb_compiled_brkpt_arm_hook = { 174 .instr_mask = 0xffffffff, 175 .instr_val = KGDB_COMPILED_BREAK, 176 + .cpsr_mask = PSR_T_BIT | MODE_MASK, 177 .cpsr_val = SVC_MODE, 178 + .fn = kgdb_compiled_brk_fn 179 + }; 180 + 181 + static struct undef_hook kgdb_compiled_brkpt_thumb_hook = { 182 + .instr_mask = 0xffff, 183 + .instr_val = KGDB_COMPILED_BREAK & 0xffff, 184 + .cpsr_mask = PSR_T_BIT | MODE_MASK, 185 + .cpsr_val = PSR_T_BIT | SVC_MODE, 186 .fn = kgdb_compiled_brk_fn 187 }; 188 ··· 210 if (ret != 0) 211 return ret; 212 213 + register_undef_hook(&kgdb_brkpt_arm_hook); 214 + register_undef_hook(&kgdb_brkpt_thumb_hook); 215 + register_undef_hook(&kgdb_compiled_brkpt_arm_hook); 216 + register_undef_hook(&kgdb_compiled_brkpt_thumb_hook); 217 218 return 0; 219 } ··· 224 */ 225 void kgdb_arch_exit(void) 226 { 227 + unregister_undef_hook(&kgdb_brkpt_arm_hook); 228 + unregister_undef_hook(&kgdb_brkpt_thumb_hook); 229 + unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook); 230 + unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook); 231 unregister_die_notifier(&kgdb_notifier); 232 } 233