Skip to content

Commit

Permalink
target/m68k: Support semihosting on non-ColdFire targets
Browse files Browse the repository at this point in the history
According to the m68k semihosting spec:

"The instruction used to trigger a semihosting request depends on the
 m68k processor variant.  On ColdFire, "halt" is used; on other processors
 (which don't implement "halt"), "bkpt #0" may be used."

Add support for non-CodeFire processors by matching BKPT #0 instructions.

Signed-off-by: Keith Packard <keithp@keithp.com>
[rth: Use semihosting_test()]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
keith-packard authored and rth7680 committed Apr 24, 2024
1 parent f161e72 commit 0815c22
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions target/m68k/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,11 @@ DISAS_INSN(bkpt)
#if defined(CONFIG_USER_ONLY)
gen_exception(s, s->base.pc_next, EXCP_DEBUG);
#else
/* BKPT #0 is the alternate semihosting instruction. */
if ((insn & 7) == 0 && semihosting_test(s)) {
gen_exception(s, s->pc, EXCP_SEMIHOSTING);
return;
}
gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
#endif
}
Expand Down

0 comments on commit 0815c22

Please sign in to comment.