diff mbox series

[v4,2/3] target/nios2: Move nios2-semi.c to nios2_softmmu_ss

Message ID 20220608023816.759426-3-richard.henderson@linaro.org
State Superseded
Headers show
Series target/nios2: semihosting cleanup | expand

Commit Message

Richard Henderson June 8, 2022, 2:38 a.m. UTC
Semihosting is not enabled for nios2-linux-user.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/nios2/nios2-semi.c | 5 -----
 target/nios2/meson.build  | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

Comments

Peter Maydell June 9, 2022, 10:36 a.m. UTC | #1
On Wed, 8 Jun 2022 at 03:43, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Semihosting is not enabled for nios2-linux-user.

True, but maybe it ought to be (in an ideal world)?

Anyway, as far as this patch goes
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

If we ever add semihosting support to linux-user nios2 it's
easy enough to undo this.

thanks
-- PMM
Philippe Mathieu-Daudé June 10, 2022, 1:33 p.m. UTC | #2
On 8/6/22 04:38, Richard Henderson wrote:
> Semihosting is not enabled for nios2-linux-user.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/nios2/nios2-semi.c | 5 -----
>   target/nios2/meson.build  | 4 ++--
>   2 files changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Richard Henderson June 20, 2022, 10:04 p.m. UTC | #3
On 6/9/22 03:36, Peter Maydell wrote:
> On Wed, 8 Jun 2022 at 03:43, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Semihosting is not enabled for nios2-linux-user.
> 
> True, but maybe it ought to be (in an ideal world)?

No, I think ideally there'd be no semihosting for user-only.
If you can write to semihosting, you can write to regular syscalls.

Semihosting is good for when we want to do testing of system-mode stuff, and we don't want 
the complication of a full os getting in the way.


r~
Peter Maydell June 21, 2022, 8:52 a.m. UTC | #4
On Mon, 20 Jun 2022 at 23:04, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 6/9/22 03:36, Peter Maydell wrote:
> > On Wed, 8 Jun 2022 at 03:43, Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> Semihosting is not enabled for nios2-linux-user.
> >
> > True, but maybe it ought to be (in an ideal world)?
>
> No, I think ideally there'd be no semihosting for user-only.
> If you can write to semihosting, you can write to regular syscalls.

You can, but there are also use cases (notably the gcc test suite)
where people want to run semihosting binaries under usermode.
We can't take away usermode semihosting for those targets where
people are actively using it, so I think it would be more consistent
to support it for usermode for all architectures rather than just
some.

-- PMM
diff mbox series

Patch

diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index bdf8849689..55061bb2dc 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -22,14 +22,9 @@ 
  */
 
 #include "qemu/osdep.h"
-
 #include "cpu.h"
 #include "exec/gdbstub.h"
-#if defined(CONFIG_USER_ONLY)
-#include "qemu.h"
-#else
 #include "semihosting/softmmu-uaccess.h"
-#endif
 #include "qemu/log.h"
 
 #define HOSTED_EXIT  0
diff --git a/target/nios2/meson.build b/target/nios2/meson.build
index 2bd60ba306..c6e2243cc3 100644
--- a/target/nios2/meson.build
+++ b/target/nios2/meson.build
@@ -1,7 +1,6 @@ 
 nios2_ss = ss.source_set()
 nios2_ss.add(files(
   'cpu.c',
-  'nios2-semi.c',
   'op_helper.c',
   'translate.c',
 ))
@@ -10,7 +9,8 @@  nios2_softmmu_ss = ss.source_set()
 nios2_softmmu_ss.add(files(
   'helper.c',
   'monitor.c',
-  'mmu.c'
+  'mmu.c',
+  'nios2-semi.c',
 ))
 
 target_arch += {'nios2': nios2_ss}