Skip to contentSkip to conversation

Drop dead linux-user/unicore32 code

PATCH Applied Peter Maydell 2 participants 7 messages Mar 8, 2018 – Mar 9, 2018

lore
Share & tools
lore
#0 lore raw

cover Drop dead linux-user/unicore32 code

We disabled the unicore32-linux-user in commit 5e2b40f7271cf9d in 2016, due to a problem with the syscall ABI it implemented being out of date and out of sync with the mainline kernel. In the intervening year and a half there have been no proposals to fix these problems so that we could re-enable it. This patchset removes the 750 lines of dead code from linux-user. (I suggested this in
https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg06634.html
and there were no objections.)

The second patch is a cleanup we can make as a result, since with unicore32 gone all our targets implement signal handling:
we can remove the default "not implemented" stub functions. You could argue that these might be helpful for future new targets, but IMHO signal handling support is too important to allow a hypothetical new target to silently get away without implementing it. For initial development it's easy enough to stub out the per-architecture functions, and then we will have a clear view of which targets (if any) don't have the signal handling implemented yet, and the missing feature will show up in code review.

thanks
-- PMM

Peter Maydell (2):
linux-user: Drop unicore32 code
linux-user: Remove the unused "not implemented" signal handling stubs

 linux-user/qemu.h                     |   5 +-
 linux-user/syscall_defs.h             |   6 +-
 linux-user/unicore32/syscall_nr.h     | 371 ----------------------------------
 linux-user/unicore32/target_cpu.h     |  27 ---
 linux-user/unicore32/target_elf.h     |  14 --
 linux-user/unicore32/target_signal.h  |  30 ---
 linux-user/unicore32/target_structs.h |  58 ------
 linux-user/unicore32/target_syscall.h |  62 ------
 linux-user/unicore32/termbits.h       |   2 -
 linux-user/elfload.c                  |  72 -------
 linux-user/main.c                     |  99 +--------
 linux-user/signal.c                   |  32 +--
 12 files changed, 7 insertions(+), 771 deletions(-)
 delete mode 100644 linux-user/unicore32/syscall_nr.h
 delete mode 100644 linux-user/unicore32/target_cpu.h
 delete mode 100644 linux-user/unicore32/target_elf.h
 delete mode 100644 linux-user/unicore32/target_signal.h
 delete mode 100644 linux-user/unicore32/target_structs.h
 delete mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/unicore32/termbits.h
Signature · 1 line
2.16.2
#1 lore raw

PATCH 1/2 linux-user: Drop unicore32 code

We dropped the unicore32-linux-user target in commit 5e2b40f7271cf9 in 2016. Nobody has made any attempt to fix the issues that caused us to drop it, so remove the associated code. (The system emulation parts of unicore32 remain.)

---
 linux-user/qemu.h                     |   5 +-
 linux-user/syscall_defs.h             |   6 +-
 linux-user/unicore32/syscall_nr.h     | 371 ----------------------------------
 linux-user/unicore32/target_cpu.h     |  27 ---
 linux-user/unicore32/target_elf.h     |  14 --
 linux-user/unicore32/target_signal.h  |  30 ---
 linux-user/unicore32/target_structs.h |  58 ------
 linux-user/unicore32/target_syscall.h |  62 ------
 linux-user/unicore32/termbits.h       |   2 -
 linux-user/elfload.c                  |  72 -------
 linux-user/main.c                     |  99 +--------
 linux-user/signal.c                   |   5 +-
 12 files changed, 6 insertions(+), 745 deletions(-)
 delete mode 100644 linux-user/unicore32/syscall_nr.h
 delete mode 100644 linux-user/unicore32/target_cpu.h
 delete mode 100644 linux-user/unicore32/target_elf.h
 delete mode 100644 linux-user/unicore32/target_signal.h
 delete mode 100644 linux-user/unicore32/target_structs.h
 delete mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/unicore32/termbits.h
linux-user/qemu.h +1 -4
index f4b4ca72ad..7a1a1ff57a 100644
@@ -100,9 +100,6 @@ typedef struct TaskState {
 # endif
     int swi_errno;
 #endif
-#ifdef TARGET_UNICORE32
-    int swi_errno;
-#endif
 #if defined(TARGET_I386) && !defined(TARGET_X86_64)
     abi_ulong target_v86;
     struct vm86_saved_state vm86_saved_regs;
@@ -115,7 +112,7 @@ typedef struct TaskState {
     int sim_syscalls;
     abi_ulong tp_value;
 #endif
-#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
+#if defined(TARGET_ARM) || defined(TARGET_M68K)
     /* Extra fields for semihosted binaries.  */
     abi_ulong heap_base;
     abi_ulong heap_limit;
linux-user/syscall_defs.h +3 -3
index a35c52a60a..3cce4dabf7 100644
@@ -69,7 +69,7 @@
 
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
     || defined(TARGET_M68K) || defined(TARGET_CRIS) \
-    || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \
+    || defined(TARGET_S390X) \
     || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
     || defined(TARGET_NIOS2)
 
@@ -433,7 +433,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
     || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
     || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
-    || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
+    || defined(TARGET_MICROBLAZE) \
     || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
     || defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2)
 
@@ -1408,7 +1408,7 @@ struct target_winsize {
 
 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
     || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
-    || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
+    || defined(TARGET_CRIS)
 struct target_stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
linux-user/unicore32/syscall_nr.h deleted +0 -371

371 lines not on this page · raw message

linux-user/unicore32/target_cpu.h deleted +0 -27
deleted file mode 100644
index d7d2e7b083..0000000000
@@ -1,27 +0,0 @@
-/*
- * UniCore32 specific CPU ABI and functions for linux-user
- *
- * Copyright (C) 2010-2012 Guan Xuetao
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation, or (at your option) any
- * later version. See the COPYING file in the top-level directory.
- */
-#ifndef UNICORE32_TARGET_CPU_H
-#define UNICORE32_TARGET_CPU_H
-
-static inline void cpu_clone_regs(CPUUniCore32State *env, target_ulong newsp)
-{
-    if (newsp) {
-        env->regs[29] = newsp;
-    }
-    env->regs[0] = 0;
-}
-
-static inline void cpu_set_tls(CPUUniCore32State *env, target_ulong newtls)
-{
-    env->regs[16] = newtls;
-}
-
-#endif
linux-user/unicore32/target_elf.h deleted +0 -14
deleted file mode 100644
index e2bfcb2ca3..0000000000
@@ -1,14 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation, or (at your option) any
- * later version. See the COPYING file in the top-level directory.
- */
-
-#ifndef UNICORE32_TARGET_ELF_H
-#define UNICORE32_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
-    return "any";
-}
-#endif
linux-user/unicore32/target_signal.h deleted +0 -30
deleted file mode 100644
index c6496fb9ea..0000000000
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2010-2011 GUAN Xue-tao
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef UNICORE32_TARGET_SIGNAL_H
-#define UNICORE32_TARGET_SIGNAL_H
-
-/* this struct defines a stack used during syscall handling */
-typedef struct target_sigaltstack {
-    abi_ulong ss_sp;
-    abi_ulong ss_flags;
-    abi_ulong ss_size;
-} target_stack_t;
-
-/*
- * sigaltstack controls
- */
-#define TARGET_SS_ONSTACK               1
-#define TARGET_SS_DISABLE               2
-
-static inline abi_ulong get_sp_from_cpustate(CPUUniCore32State *state)
-{
-    return state->regs[29];
-}
-
-
-#endif /* UNICORE32_TARGET_SIGNAL_H */
linux-user/unicore32/target_structs.h deleted +0 -58

58 lines not on this page · raw message

linux-user/unicore32/target_syscall.h deleted +0 -62

62 lines not on this page · raw message

linux-user/unicore32/termbits.h deleted +0 -2
deleted file mode 100644
index a5fcd64abf..0000000000
@@ -1,2 +0,0 @@
-/* NOTE: exactly the same as i386 */
-#include "../i386/termbits.h"
linux-user/elfload.c +0 -72

78 lines not on this page · raw message

linux-user/main.c +1 -98

117 lines not on this page · raw message

linux-user/signal.c +1 -4
index 9a380b9e31..bd85dcde17 100644
@@ -253,8 +253,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
     return 0;
 }
 
-#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \
-    !defined(TARGET_NIOS2)
+#if !defined(TARGET_OPENRISC) && !defined(TARGET_NIOS2)
 /* Just set the guest's signal mask to the specified value; the
  * caller is assumed to have called block_signals() already.
  */
@@ -512,7 +511,6 @@ void signal_init(void)
     }
 }
 
-#ifndef TARGET_UNICORE32
 /* Force a synchronously taken signal. The kernel force_sig() function
  * also forces the signal to "not blocked, not ignored", but for QEMU
  * that work is done in process_pending_signals().
@@ -545,7 +543,6 @@ static void force_sigsegv(int oldsig)
     }
     force_sig(TARGET_SIGSEGV);
 }
-#endif
 
 /* abort execution with signal */
 static void QEMU_NORETURN dump_core_and_abort(int target_sig)
Signature · 1 line
2.16.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] linux-user: Drop unicore32 code

Le 08/03/2018 à 15:47, Peter Maydell a écrit :

Quoted 19 lines

We dropped the unicore32-linux-user target in commit 5e2b40f7271cf9 in 2016. Nobody has made any attempt to fix the issues that caused us to drop it, so remove the associated code. (The system emulation parts of unicore32 remain.)

---
 linux-user/qemu.h                     |   5 +-
 linux-user/syscall_defs.h             |   6 +-
 linux-user/unicore32/syscall_nr.h     | 371 ----------------------------------
 linux-user/unicore32/target_cpu.h     |  27 ---
 linux-user/unicore32/target_elf.h     |  14 --
 linux-user/unicore32/target_signal.h  |  30 ---
 linux-user/unicore32/target_structs.h |  58 ------
 linux-user/unicore32/target_syscall.h |  62 ------
 linux-user/unicore32/termbits.h       |   2 -
 linux-user/elfload.c                  |  72 -------
 linux-user/main.c                     |  99 +--------
 linux-user/signal.c                   |   5 +-
Quoted 9 lines
 12 files changed, 6 insertions(+), 745 deletions(-)
 delete mode 100644 linux-user/unicore32/syscall_nr.h
 delete mode 100644 linux-user/unicore32/target_cpu.h
 delete mode 100644 linux-user/unicore32/target_elf.h
 delete mode 100644 linux-user/unicore32/target_signal.h
 delete mode 100644 linux-user/unicore32/target_structs.h
 delete mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/unicore32/termbits.h
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] linux-user: Drop unicore32 code

In reply to Peter Maydell

Le 08/03/2018 à 15:47, Peter Maydell a écrit :

Quoted 19 lines

We dropped the unicore32-linux-user target in commit 5e2b40f7271cf9 in 2016. Nobody has made any attempt to fix the issues that caused us to drop it, so remove the associated code. (The system emulation parts of unicore32 remain.)

---
 linux-user/qemu.h                     |   5 +-
 linux-user/syscall_defs.h             |   6 +-
 linux-user/unicore32/syscall_nr.h     | 371 ----------------------------------
 linux-user/unicore32/target_cpu.h     |  27 ---
 linux-user/unicore32/target_elf.h     |  14 --
 linux-user/unicore32/target_signal.h  |  30 ---
 linux-user/unicore32/target_structs.h |  58 ------
 linux-user/unicore32/target_syscall.h |  62 ------
 linux-user/unicore32/termbits.h       |   2 -
 linux-user/elfload.c                  |  72 -------
 linux-user/main.c                     |  99 +--------
 linux-user/signal.c                   |   5 +-
Quoted 9 lines
 12 files changed, 6 insertions(+), 745 deletions(-)
 delete mode 100644 linux-user/unicore32/syscall_nr.h
 delete mode 100644 linux-user/unicore32/target_cpu.h
 delete mode 100644 linux-user/unicore32/target_elf.h
 delete mode 100644 linux-user/unicore32/target_signal.h
 delete mode 100644 linux-user/unicore32/target_structs.h
 delete mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/unicore32/termbits.h

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent

#4 lore raw

PATCH 2/2 linux-user: Remove the unused "not implemented" signal handling stubs

In reply to Peter Maydell

Now we've dropped unicore32, all of the architectures we support for linux-user implement the signal handling routines. The dummy "just print a message" versions are unimplemented, so we can drop them entirely.

---
IMHO signal handling support is too important to allow a hypothetical new architecture target to silently get away without implementing it. For initial development it's easy enough to stub out the per-architecture functions, and then we will have a clear view of which targets (if any) don't have the signal handling implemented yet, and the missing feature will show up in code review.

---
 linux-user/signal.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)
linux-user/signal.c +1 -26
index bd85dcde17..1f7b5e398e 100644
@@ -6572,32 +6572,7 @@ long do_rt_sigreturn(CPUArchState *env)
 }
 
 #else
-
-static void setup_frame(int sig, struct target_sigaction *ka,
-                        target_sigset_t *set, CPUArchState *env)
-{
-    fprintf(stderr, "setup_frame: not implemented\n");
-}
-
-static void setup_rt_frame(int sig, struct target_sigaction *ka,
-                           target_siginfo_t *info,
-                           target_sigset_t *set, CPUArchState *env)
-{
-    fprintf(stderr, "setup_rt_frame: not implemented\n");
-}
-
-long do_sigreturn(CPUArchState *env)
-{
-    fprintf(stderr, "do_sigreturn: not implemented\n");
-    return -TARGET_ENOSYS;
-}
-
-long do_rt_sigreturn(CPUArchState *env)
-{
-    fprintf(stderr, "do_rt_sigreturn: not implemented\n");
-    return -TARGET_ENOSYS;
-}
-
+#error Target needs to add support for signal handling
 #endif
 
 static void handle_pending_signal(CPUArchState *cpu_env, int sig,
Signature · 1 line
2.16.2
Reviewed-by on v1 2/2
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] linux-user: Remove the unused "not implemented" signal handling stubs

Le 08/03/2018 à 15:47, Peter Maydell a écrit :

Quoted 14 lines

Now we've dropped unicore32, all of the architectures we support for linux-user implement the signal handling routines. The dummy "just print a message" versions are unimplemented, so we can drop them entirely.

---
IMHO signal handling support is too important to allow a hypothetical new architecture target to silently get away without implementing it. For initial development it's easy enough to stub out the per-architecture functions, and then we will have a clear view of which targets (if any) don't have the signal handling implemented yet, and the missing feature will show up in code review.

Quoted 4 lines
---
 linux-user/signal.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] linux-user: Remove the unused "not implemented" signal handling stubs

In reply to Peter Maydell

Le 08/03/2018 à 15:47, Peter Maydell a écrit :

Quoted 14 lines

Now we've dropped unicore32, all of the architectures we support for linux-user implement the signal handling routines. The dummy "just print a message" versions are unimplemented, so we can drop them entirely.

---
IMHO signal handling support is too important to allow a hypothetical new architecture target to silently get away without implementing it. For initial development it's easy enough to stub out the per-architecture functions, and then we will have a clear view of which targets (if any) don't have the signal handling implemented yet, and the missing feature will show up in code review.

Quoted 3 lines
---
 linux-user/signal.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

Applied to my 'linux-user-for-2.12' branch.

Thanks,
Laurent