qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] bsd-user cleanup
@ 2021-05-10 22:15 Warner Losh
  2021-05-10 22:15 ` [PATCH 1/3] bsd-user: remove target_signal.h, it's unused Warner Losh
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Warner Losh @ 2021-05-10 22:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

Three more bsd-user cleanups.

The general plan after these patches is to get and keep i386 working as I flush
out the loader, the basic system calls, system tracing, etc.  I'll move files
around so they are like the current bsd-user tree.  Once that's all done, I'll
add the different architectures we currently support. Sparc64 was removed from
FreeBSD and never really worked in bsd-user, so would need to be deleted
eventually anyway. If we do it at the start of the series, we'll reduce the
burden on getting the other things in w/o ditching functionality we'll need in
the end.

Short term, this just removes sparc from the build, deletes a file that's
not in the final product and renames a bsd-specific structure to have
a bsd name, not a linux one.

Warner Losh (3):
  bsd-user: remove target_signal.h, it's unused
  bsd-user: Stop building the sparc platforms
  bsd-user: rename linux_binprm to bsd_binprm

 bsd-user/bsdload.c                           |  4 +--
 bsd-user/elfload.c                           |  4 +--
 bsd-user/i386/target_signal.h                | 20 ---------------
 bsd-user/qemu.h                              |  7 +++--
 bsd-user/signal.c                            |  1 -
 bsd-user/sparc/target_signal.h               | 27 --------------------
 bsd-user/sparc64/target_signal.h             | 27 --------------------
 bsd-user/x86_64/target_signal.h              | 19 --------------
 default-configs/targets/sparc-bsd-user.mak   |  3 ---
 default-configs/targets/sparc64-bsd-user.mak |  4 ---
 10 files changed, 7 insertions(+), 109 deletions(-)
 delete mode 100644 bsd-user/i386/target_signal.h
 delete mode 100644 bsd-user/sparc/target_signal.h
 delete mode 100644 bsd-user/sparc64/target_signal.h
 delete mode 100644 bsd-user/x86_64/target_signal.h
 delete mode 100644 default-configs/targets/sparc-bsd-user.mak
 delete mode 100644 default-configs/targets/sparc64-bsd-user.mak

-- 
2.22.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] bsd-user: remove target_signal.h, it's unused
  2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
@ 2021-05-10 22:15 ` Warner Losh
  2021-05-10 22:15 ` [PATCH 2/3] bsd-user: Stop building the sparc platforms Warner Losh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Warner Losh @ 2021-05-10 22:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

Remove the target_signal.h file. None of its contents are currently used and the
bsd-user fork doesn't use them (so this reduces the diffs there).

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/i386/target_signal.h    | 20 --------------------
 bsd-user/qemu.h                  |  1 -
 bsd-user/signal.c                |  1 -
 bsd-user/sparc/target_signal.h   | 27 ---------------------------
 bsd-user/sparc64/target_signal.h | 27 ---------------------------
 bsd-user/x86_64/target_signal.h  | 19 -------------------
 6 files changed, 95 deletions(-)
 delete mode 100644 bsd-user/i386/target_signal.h
 delete mode 100644 bsd-user/sparc/target_signal.h
 delete mode 100644 bsd-user/sparc64/target_signal.h
 delete mode 100644 bsd-user/x86_64/target_signal.h

diff --git a/bsd-user/i386/target_signal.h b/bsd-user/i386/target_signal.h
deleted file mode 100644
index 2ef36d1f98..0000000000
--- a/bsd-user/i386/target_signal.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
-
-#include "cpu.h"
-
-/* this struct defines a stack used during syscall handling */
-
-typedef struct target_sigaltstack {
-	abi_ulong ss_sp;
-	abi_long ss_flags;
-	abi_ulong ss_size;
-} target_stack_t;
-
-
-static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
-{
-    return state->regs[R_ESP];
-}
-
-#endif /* TARGET_SIGNAL_H */
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 5a82722281..369c649fe5 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -38,7 +38,6 @@ extern enum BSDType bsd_type;
 
 #include "syscall_defs.h"
 #include "target_syscall.h"
-#include "target_signal.h"
 #include "exec/gdbstub.h"
 
 #if defined(CONFIG_USE_NPTL)
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index f6f7aa2427..ad6d935569 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 
 #include "qemu.h"
-#include "target_signal.h"
 
 void signal_init(void)
 {
diff --git a/bsd-user/sparc/target_signal.h b/bsd-user/sparc/target_signal.h
deleted file mode 100644
index 5b2abba40f..0000000000
--- a/bsd-user/sparc/target_signal.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
-
-#include "cpu.h"
-
-/* this struct defines a stack used during syscall handling */
-
-typedef struct target_sigaltstack {
-	abi_ulong ss_sp;
-	abi_long ss_flags;
-	abi_ulong ss_size;
-} target_stack_t;
-
-
-#ifndef UREG_I6
-#define UREG_I6        6
-#endif
-#ifndef UREG_FP
-#define UREG_FP        UREG_I6
-#endif
-
-static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
-{
-    return state->regwptr[UREG_FP];
-}
-
-#endif /* TARGET_SIGNAL_H */
diff --git a/bsd-user/sparc64/target_signal.h b/bsd-user/sparc64/target_signal.h
deleted file mode 100644
index 5b2abba40f..0000000000
--- a/bsd-user/sparc64/target_signal.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
-
-#include "cpu.h"
-
-/* this struct defines a stack used during syscall handling */
-
-typedef struct target_sigaltstack {
-	abi_ulong ss_sp;
-	abi_long ss_flags;
-	abi_ulong ss_size;
-} target_stack_t;
-
-
-#ifndef UREG_I6
-#define UREG_I6        6
-#endif
-#ifndef UREG_FP
-#define UREG_FP        UREG_I6
-#endif
-
-static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
-{
-    return state->regwptr[UREG_FP];
-}
-
-#endif /* TARGET_SIGNAL_H */
diff --git a/bsd-user/x86_64/target_signal.h b/bsd-user/x86_64/target_signal.h
deleted file mode 100644
index 659cd401b8..0000000000
--- a/bsd-user/x86_64/target_signal.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef TARGET_SIGNAL_H
-#define TARGET_SIGNAL_H
-
-#include "cpu.h"
-
-/* this struct defines a stack used during syscall handling */
-
-typedef struct target_sigaltstack {
-	abi_ulong ss_sp;
-	abi_long ss_flags;
-	abi_ulong ss_size;
-} target_stack_t;
-
-static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
-{
-    return state->regs[R_ESP];
-}
-
-#endif /* TARGET_SIGNAL_H */
-- 
2.22.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] bsd-user: Stop building the sparc platforms
  2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
  2021-05-10 22:15 ` [PATCH 1/3] bsd-user: remove target_signal.h, it's unused Warner Losh
@ 2021-05-10 22:15 ` Warner Losh
  2021-05-11 18:08   ` Philippe Mathieu-Daudé
  2021-05-10 22:15 ` [PATCH 3/3] bsd-user: rename linux_binprm to bsd_binprm Warner Losh
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Warner Losh @ 2021-05-10 22:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

The forked bsd-user tree doesn't really support these platforms.  They aren't
functional at the moment anyway. Remove them from the build so that the major
reorg patch series can focus on one platform (x86) before adding addition
platforms once things are shuffled. This should make it easier to review
and satisfy that all revisions of a patch series are buildable.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 default-configs/targets/sparc-bsd-user.mak   | 3 ---
 default-configs/targets/sparc64-bsd-user.mak | 4 ----
 2 files changed, 7 deletions(-)
 delete mode 100644 default-configs/targets/sparc-bsd-user.mak
 delete mode 100644 default-configs/targets/sparc64-bsd-user.mak

diff --git a/default-configs/targets/sparc-bsd-user.mak b/default-configs/targets/sparc-bsd-user.mak
deleted file mode 100644
index 9ba3d7b07f..0000000000
--- a/default-configs/targets/sparc-bsd-user.mak
+++ /dev/null
@@ -1,3 +0,0 @@
-TARGET_ARCH=sparc
-TARGET_ALIGNED_ONLY=y
-TARGET_WORDS_BIGENDIAN=y
diff --git a/default-configs/targets/sparc64-bsd-user.mak b/default-configs/targets/sparc64-bsd-user.mak
deleted file mode 100644
index 8dd3217800..0000000000
--- a/default-configs/targets/sparc64-bsd-user.mak
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET_ARCH=sparc64
-TARGET_BASE_ARCH=sparc
-TARGET_ALIGNED_ONLY=y
-TARGET_WORDS_BIGENDIAN=y
-- 
2.22.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] bsd-user: rename linux_binprm to bsd_binprm
  2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
  2021-05-10 22:15 ` [PATCH 1/3] bsd-user: remove target_signal.h, it's unused Warner Losh
  2021-05-10 22:15 ` [PATCH 2/3] bsd-user: Stop building the sparc platforms Warner Losh
@ 2021-05-10 22:15 ` Warner Losh
  2021-05-10 22:21 ` [PATCH 0/3] bsd-user cleanup no-reply
  2021-05-11 17:06 ` Richard Henderson
  4 siblings, 0 replies; 7+ messages in thread
From: Warner Losh @ 2021-05-10 22:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

Rename linux_binprm to bsd_binprm to reflect that we're loading BSD binaries,
not ELF ones.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/bsdload.c | 4 ++--
 bsd-user/elfload.c | 4 ++--
 bsd-user/qemu.h    | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c
index e1ed3b7b60..8d83f21eda 100644
--- a/bsd-user/bsdload.c
+++ b/bsd-user/bsdload.c
@@ -32,7 +32,7 @@ static int count(char **vec)
     return i;
 }
 
-static int prepare_binprm(struct linux_binprm *bprm)
+static int prepare_binprm(struct bsd_binprm *bprm)
 {
     struct stat         st;
     int mode;
@@ -127,7 +127,7 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
 int loader_exec(const char *filename, char **argv, char **envp,
              struct target_pt_regs *regs, struct image_info *infop)
 {
-    struct linux_binprm bprm;
+    struct bsd_binprm bprm;
     int retval;
     int i;
 
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 5f4d824d78..d658d722a5 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -662,7 +662,7 @@ static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
     return p;
 }
 
-static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm,
+static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
                                  struct image_info *info)
 {
     abi_ulong stack_base, size, error;
@@ -1143,7 +1143,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)
     syminfos = s;
 }
 
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info)
 {
     struct elfhdr elf_ex;
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 369c649fe5..5c33b4279f 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -114,7 +114,7 @@ extern unsigned long mmap_min_addr;
  * This structure is used to hold the arguments that are
  * used when loading binaries.
  */
-struct linux_binprm {
+struct bsd_binprm {
         char buf[128];
         void *page[MAX_ARG_PAGES];
         abi_ulong p;
@@ -132,9 +132,9 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
 int loader_exec(const char * filename, char ** argv, char ** envp,
              struct target_pt_regs * regs, struct image_info *infop);
 
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);
-int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_flt_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);
 
 abi_long memcpy_to_target(abi_ulong dest, const void *src,
-- 
2.22.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] bsd-user cleanup
  2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
                   ` (2 preceding siblings ...)
  2021-05-10 22:15 ` [PATCH 3/3] bsd-user: rename linux_binprm to bsd_binprm Warner Losh
@ 2021-05-10 22:21 ` no-reply
  2021-05-11 17:06 ` Richard Henderson
  4 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2021-05-10 22:21 UTC (permalink / raw)
  To: imp; +Cc: kevans, qemu-devel, imp

Patchew URL: https://patchew.org/QEMU/20210510221511.14205-1-imp@bsdimp.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210510221511.14205-1-imp@bsdimp.com
Subject: [PATCH 0/3] bsd-user cleanup

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210510221511.14205-1-imp@bsdimp.com -> patchew/20210510221511.14205-1-imp@bsdimp.com
 - [tag update]      patchew/a898b0d5-7086-9699-ae8b-9524ad319b01@t-online.de -> patchew/a898b0d5-7086-9699-ae8b-9524ad319b01@t-online.de
Switched to a new branch 'test'
29436b2 bsd-user: rename linux_binprm to bsd_binprm
6dfc63b bsd-user: Stop building the sparc platforms
7664bfd bsd-user: remove target_signal.h, it's unused

=== OUTPUT BEGIN ===
1/3 Checking commit 7664bfde8daf (bsd-user: remove target_signal.h, it's unused)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#22: 
deleted file mode 100644

total: 0 errors, 1 warnings, 14 lines checked

Patch 1/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/3 Checking commit 6dfc63b98ef1 (bsd-user: Stop building the sparc platforms)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#21: 
deleted file mode 100644

total: 0 errors, 1 warnings, 0 lines checked

Patch 2/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/3 Checking commit 29436b2be985 (bsd-user: rename linux_binprm to bsd_binprm)
ERROR: "foo * bar" should be "foo *bar"
#58: FILE: bsd-user/elfload.c:1146:
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,

ERROR: "foo * bar" should be "foo *bar"
#80: FILE: bsd-user/qemu.h:134:
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,

ERROR: "foo * bar" should be "foo *bar"
#83: FILE: bsd-user/qemu.h:136:
+int load_flt_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,

total: 3 errors, 0 warnings, 51 lines checked

Patch 3/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210510221511.14205-1-imp@bsdimp.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] bsd-user cleanup
  2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
                   ` (3 preceding siblings ...)
  2021-05-10 22:21 ` [PATCH 0/3] bsd-user cleanup no-reply
@ 2021-05-11 17:06 ` Richard Henderson
  4 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2021-05-11 17:06 UTC (permalink / raw)
  To: Warner Losh, qemu-devel; +Cc: kevans

On 5/10/21 5:15 PM, Warner Losh wrote:
> Warner Losh (3):
>    bsd-user: remove target_signal.h, it's unused
>    bsd-user: Stop building the sparc platforms
>    bsd-user: rename linux_binprm to bsd_binprm

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] bsd-user: Stop building the sparc platforms
  2021-05-10 22:15 ` [PATCH 2/3] bsd-user: Stop building the sparc platforms Warner Losh
@ 2021-05-11 18:08   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-11 18:08 UTC (permalink / raw)
  To: Warner Losh, qemu-devel; +Cc: kevans

On 5/11/21 12:15 AM, Warner Losh wrote:
> The forked bsd-user tree doesn't really support these platforms.  They aren't
> functional at the moment anyway. Remove them from the build so that the major
> reorg patch series can focus on one platform (x86) before adding addition
> platforms once things are shuffled. This should make it easier to review
> and satisfy that all revisions of a patch series are buildable.

I'd s/platform/target/ in subject and description to make it clearer.

> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>  default-configs/targets/sparc-bsd-user.mak   | 3 ---
>  default-configs/targets/sparc64-bsd-user.mak | 4 ----
>  2 files changed, 7 deletions(-)
>  delete mode 100644 default-configs/targets/sparc-bsd-user.mak
>  delete mode 100644 default-configs/targets/sparc64-bsd-user.mak


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-11 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 22:15 [PATCH 0/3] bsd-user cleanup Warner Losh
2021-05-10 22:15 ` [PATCH 1/3] bsd-user: remove target_signal.h, it's unused Warner Losh
2021-05-10 22:15 ` [PATCH 2/3] bsd-user: Stop building the sparc platforms Warner Losh
2021-05-11 18:08   ` Philippe Mathieu-Daudé
2021-05-10 22:15 ` [PATCH 3/3] bsd-user: rename linux_binprm to bsd_binprm Warner Losh
2021-05-10 22:21 ` [PATCH 0/3] bsd-user cleanup no-reply
2021-05-11 17:06 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).