qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/7] semihosting: proper QEMU exit on semihosted exit syscall


From: Richard Henderson
Subject: Re: [PATCH 0/7] semihosting: proper QEMU exit on semihosted exit syscall
Date: Mon, 20 Jun 2022 08:59:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 6/20/22 07:24, Luc Michel wrote:
Hi,

This series implements a clean way for semihosted exit syscalls to
terminate QEMU with a given return code.

Until now, exit syscalls implementations consisted in calling exit()
with the wanted return code. The problem with this approach is that
other CPUs are not properly stopped, leading to possible crashes in
MTTCG mode, especially when at_exit callbacks have been registered. This
can be the case e.g., when plugins are in use. Plugins can register
at_exit callbacks. Those will be called on the CPU thread the exit
syscall is comming from, while other CPUs can continue to run and thus
call other plugin callbacks.

The semihosting_exit_request function provides a mean to cleanly
terminate QEMU. It introduces an new exit reason
(SHUTDOWN_CAUSE_GUEST_SEMI_EXIT) used in this case. The CPU is stopped
and returns to the main CPU loop so that no more instruction get
executed (the semihosting_exit_request is declared G_NORETURN).

All targets are converted to use this new function.

Did you test a complete build? At a glance I would guess that arm-linux-user will no longer link because qemu_set/get_exit_status is missing.


r~


Thanks,
Luc

Luc Michel (7):
   softmmu: add qemu_[set|get]_exit_status functions
   semihosting: add the semihosting_exit_request function
   semihosting/arm-compat-semi: use semihosting_exit_request
   target/m68k: use semihosting_exit_request on semihosted exit syscall
   target/mips: use semihosting_exit_request on semihosted exit syscall
   target/nios2: use semihosting_exit_request on semihosted exit syscall
   target/xtensa: use semihosting_exit_request on semihosted exit syscall

  qapi/run-state.json                |  4 +++-
  include/semihosting/semihost.h     |  4 ++++
  include/sysemu/sysemu.h            |  2 ++
  semihosting/arm-compat-semi.c      |  3 +--
  semihosting/config.c               | 17 +++++++++++++++++
  softmmu/main.c                     |  2 +-
  softmmu/runstate.c                 | 11 +++++++++++
  target/m68k/m68k-semi.c            |  4 ++--
  target/mips/tcg/sysemu/mips-semi.c |  2 +-
  target/nios2/nios2-semi.c          |  4 ++--
  target/xtensa/xtensa-semi.c        |  2 +-
  11 files changed, 45 insertions(+), 10 deletions(-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]