diff mbox series

target/m68k: Handle EXCP_SEMIHOSTING for m68k class CPU

Message ID 20241229-m68k-semihosting-v1-1-db131e2b5212@flygoat.com (mailing list archive)
State New
Headers show
Series target/m68k: Handle EXCP_SEMIHOSTING for m68k class CPU | expand

Commit Message

Jiaxun Yang Dec. 29, 2024, 12:22 a.m. UTC
EXCP_SEMIHOSTING can be generated by m68k class CPU with
HALT instruction, but it is never handled properly and cause
guest fall into deadlock.

Handle it as what we've done to coldfire.

Fixes: f161e723fdfd ("target/m68k: Perform the semihosting test during translate")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 target/m68k/op_helper.c | 3 +++
 1 file changed, 3 insertions(+)


---
base-commit: 2b7a80e07a29074530a0ebc8005a418ee07b1faf
change-id: 20241229-m68k-semihosting-2c49c86d3e3c

Best regards,

Comments

Richard Henderson Dec. 29, 2024, 1:49 a.m. UTC | #1
On 12/28/24 16:22, Jiaxun Yang wrote:
> EXCP_SEMIHOSTING can be generated by m68k class CPU with
> HALT instruction, but it is never handled properly and cause
> guest fall into deadlock.
> 
> Handle it as what we've done to coldfire.
> 
> Fixes: f161e723fdfd ("target/m68k: Perform the semihosting test during translate")
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   target/m68k/op_helper.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
> index 15bad5dd46518c6e86b6273d4a2b26b3b6f991de..95b3d5cf052c6ffd515afdffd5465550ae3af455 100644
> --- a/target/m68k/op_helper.c
> +++ b/target/m68k/op_helper.c
> @@ -285,6 +285,9 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
>               /* Return from an exception.  */
>               m68k_rte(env);
>               return;
> +        case EXCP_SEMIHOSTING:
> +            do_m68k_semihosting(env, env->dregs[0]);
> +            return;
>           }

Oops.

Anyway, better to hoist both calls to do_interrupt_all.


r~
diff mbox series

Patch

diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 15bad5dd46518c6e86b6273d4a2b26b3b6f991de..95b3d5cf052c6ffd515afdffd5465550ae3af455 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -285,6 +285,9 @@  static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
             /* Return from an exception.  */
             m68k_rte(env);
             return;
+        case EXCP_SEMIHOSTING:
+            do_m68k_semihosting(env, env->dregs[0]);
+            return;
         }
     }