Skip to contentSkip to conversation

bsd-user: image_info cleanups

PATCH In review Richard Henderson 3 participants 11 messages Aug 18, 2023 – Aug 20, 2023

lore
Share & tools
lore
#0 lore raw

cover bsd-user: image_info cleanups

This mirrors some changes I've posted for linux-user, removing stuff from image_info which is unused.

r~

Richard Henderson (3):
bsd-user: Remove ELF_START_MMAP and image_info.start_mmap
bsd-user: Remove image_info.mmap
bsd-user: Remove image_info.start_brk

 bsd-user/arm/target_arch_elf.h    | 1 -
 bsd-user/i386/target_arch_elf.h   | 1 -
 bsd-user/qemu.h                   | 3 ---
 bsd-user/x86_64/target_arch_elf.h | 1 -
 bsd-user/elfload.c                | 4 +---
 bsd-user/main.c                   | 2 --
 6 files changed, 1 insertion(+), 11 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 bsd-user: Remove ELF_START_MMAP and image_info.start_mmap

The start_mmap value is write-only.
Remove the field and the defines that populated it.

---
 bsd-user/arm/target_arch_elf.h    | 1 -
 bsd-user/i386/target_arch_elf.h   | 1 -
 bsd-user/qemu.h                   | 1 -
 bsd-user/x86_64/target_arch_elf.h | 1 -
 bsd-user/elfload.c                | 1 -
 5 files changed, 5 deletions(-)
bsd-user/arm/target_arch_elf.h +0 -1
index 935bce347f..b1c0fd2b32 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x80000000
 #define ELF_ET_DYN_LOAD_ADDR    0x500000
 
 #define elf_check_arch(x) ((x) == EM_ARM)
bsd-user/i386/target_arch_elf.h +0 -1
index cbcd1f08e2..4ac27b02e7 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x80000000
 #define ELF_ET_DYN_LOAD_ADDR    0x01001000
 #define elf_check_arch(x) (((x) == EM_386) || ((x) == EM_486))
 
bsd-user/qemu.h +0 -1
index 8f2d6a3c78..178114b423 100644
@@ -52,7 +52,6 @@ struct image_info {
     abi_ulong end_data;
     abi_ulong start_brk;
     abi_ulong brk;
-    abi_ulong start_mmap;
     abi_ulong mmap;
     abi_ulong rss;
     abi_ulong start_stack;
bsd-user/x86_64/target_arch_elf.h +0 -1
index b244711888..e51c2faf08 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x2aaaaab000ULL
 #define ELF_ET_DYN_LOAD_ADDR    0x01021000
 #define elf_check_arch(x) (((x) == ELF_ARCH))
 
bsd-user/elfload.c +0 -1
index 1f650bdde8..38a3439d2c 100644
@@ -738,7 +738,6 @@ int load_elf_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
     /* OK, This is the point of no return */
     info->end_data = 0;
     info->end_code = 0;
-    info->start_mmap = (abi_ulong)ELF_START_MMAP;
     info->mmap = 0;
     elf_entry = (abi_ulong) elf_ex.e_entry;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] bsd-user: Remove ELF_START_MMAP and image_info.start_mmap

Quoted 5 lines · Richard Henderson

The start_mmap value is write-only.
Remove the field and the defines that populated it.

This one won't interfere with anything, but unless I hear otherwise, I'll queue it.
It applies to the blitz branch (though it needs a few more targets there), and none
of these files are being modified by Kariim Taha, my gsoc student.

Warner

Quoted 76 lines
---
 bsd-user/arm/target_arch_elf.h    | 1 -
 bsd-user/i386/target_arch_elf.h   | 1 -
 bsd-user/qemu.h                   | 1 -
 bsd-user/x86_64/target_arch_elf.h | 1 -
 bsd-user/elfload.c                | 1 -
 5 files changed, 5 deletions(-)
bsd-user/arm/target_arch_elf.h +0 -1
index 935bce347f..b1c0fd2b32 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x80000000
 #define ELF_ET_DYN_LOAD_ADDR    0x500000
 
 #define elf_check_arch(x) ((x) == EM_ARM)
bsd-user/i386/target_arch_elf.h +0 -1
index cbcd1f08e2..4ac27b02e7 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x80000000
 #define ELF_ET_DYN_LOAD_ADDR    0x01001000
 #define elf_check_arch(x) (((x) == EM_386) || ((x) == EM_486))
 
bsd-user/qemu.h +0 -1
index 8f2d6a3c78..178114b423 100644
@@ -52,7 +52,6 @@ struct image_info {
     abi_ulong end_data;
     abi_ulong start_brk;
     abi_ulong brk;
-    abi_ulong start_mmap;
     abi_ulong mmap;
     abi_ulong rss;
     abi_ulong start_stack;
bsd-user/x86_64/target_arch_elf.h +0 -1
index b244711888..e51c2faf08 100644
@@ -20,7 +20,6 @@
 #ifndef TARGET_ARCH_ELF_H
 #define TARGET_ARCH_ELF_H
 
-#define ELF_START_MMAP 0x2aaaaab000ULL
 #define ELF_ET_DYN_LOAD_ADDR    0x01021000
 #define elf_check_arch(x) (((x) == ELF_ARCH))
 
bsd-user/elfload.c +0 -2
index 1f650bdde8..38a3439d2c 100644
@@ -738,7 +738,6 @@ int load_elf_binary(struct bsd_binprm *bprm, struct
 target_pt_regs *regs,
     /* OK, This is the point of no return */
     info->end_data = 0;
     info->end_code = 0;
-    info->start_mmap = (abi_ulong)ELF_START_MMAP;
     info->mmap = 0;
     elf_entry = (abi_ulong) elf_ex.e_entry;
 
--

2.34.1

#3 lore raw

PATCH 2/3 bsd-user: Remove image_info.mmap

In reply to Richard Henderson

This value is unused.

---
 bsd-user/qemu.h    | 1 -
 bsd-user/elfload.c | 1 -
 2 files changed, 2 deletions(-)
bsd-user/qemu.h +0 -1
index 178114b423..898fe3e8b3 100644
@@ -52,7 +52,6 @@ struct image_info {
     abi_ulong end_data;
     abi_ulong start_brk;
     abi_ulong brk;
-    abi_ulong mmap;
     abi_ulong rss;
     abi_ulong start_stack;
     abi_ulong entry;
bsd-user/elfload.c +0 -1
index 38a3439d2c..2d39e59258 100644
@@ -738,7 +738,6 @@ int load_elf_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
     /* OK, This is the point of no return */
     info->end_data = 0;
     info->end_code = 0;
-    info->mmap = 0;
     elf_entry = (abi_ulong) elf_ex.e_entry;
 
     /* XXX Join this with PT_INTERP search? */
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/3] bsd-user: Remove image_info.mmap

Quoted 4 lines · Richard Henderson

This value is unused.

Reviewed by: Warner Losh <[email protected]>

Same comments as patch 1/3.

Warner

Quoted 34 lines
---
 bsd-user/qemu.h    | 1 -
 bsd-user/elfload.c | 1 -
 2 files changed, 2 deletions(-)
bsd-user/qemu.h +0 -1
index 178114b423..898fe3e8b3 100644
@@ -52,7 +52,6 @@ struct image_info {
     abi_ulong end_data;
     abi_ulong start_brk;
     abi_ulong brk;
-    abi_ulong mmap;
     abi_ulong rss;
     abi_ulong start_stack;
     abi_ulong entry;
bsd-user/elfload.c +0 -1
index 38a3439d2c..2d39e59258 100644
@@ -738,7 +738,6 @@ int load_elf_binary(struct bsd_binprm *bprm, struct
 target_pt_regs *regs,
     /* OK, This is the point of no return */
     info->end_data = 0;
     info->end_code = 0;
-    info->mmap = 0;
     elf_entry = (abi_ulong) elf_ex.e_entry;
 
     /* XXX Join this with PT_INTERP search? */

--
2.34.1

#5 lore raw

PATCH 3/3 bsd-user: Remove image_info.start_brk

In reply to Richard Henderson

This has the same value is image_info.brk, which is also logged, and is otherwise unused.

---
 bsd-user/qemu.h    | 1 -
 bsd-user/elfload.c | 2 +-
 bsd-user/main.c    | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
bsd-user/qemu.h +0 -1
index 898fe3e8b3..61501c321b 100644
@@ -50,7 +50,6 @@ struct image_info {
     abi_ulong end_code;
     abi_ulong start_data;
     abi_ulong end_data;
-    abi_ulong start_brk;
     abi_ulong brk;
     abi_ulong rss;
     abi_ulong start_stack;
bsd-user/elfload.c +1 -1
index 2d39e59258..baf2f63d2f 100644
@@ -811,7 +811,7 @@ int load_elf_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
                                        bprm->stringp, &elf_ex, load_addr,
                                        et_dyn_addr, interp_load_addr, info);
     info->load_addr = reloc_func_desc;
-    info->start_brk = info->brk = elf_brk;
+    info->brk = elf_brk;
     info->start_stack = bprm->p;
     info->load_bias = 0;
 
bsd-user/main.c +0 -2
index 381bb18df8..f913cb55a7 100644
@@ -553,8 +553,6 @@ int main(int argc, char **argv)
             fprintf(f, "page layout changed following binary load\n");
             page_dump(f);
 
-            fprintf(f, "start_brk   0x" TARGET_ABI_FMT_lx "\n",
-                    info->start_brk);
             fprintf(f, "end_code    0x" TARGET_ABI_FMT_lx "\n",
                     info->end_code);
             fprintf(f, "start_code  0x" TARGET_ABI_FMT_lx "\n",
Signature · 1 line
2.34.1
Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] bsd-user: Remove image_info.start_brk

Quoted 5 lines · Richard Henderson

This has the same value is image_info.brk, which is also logged, and is otherwise unused.

Same comments as 1/3.

Forgot on 1/3 to mention I'm planning on doing a pull request right after the
release (subject to our release engineer's ok) and can include this there.

Warner

Quoted 50 lines
---
 bsd-user/qemu.h    | 1 -
 bsd-user/elfload.c | 2 +-
 bsd-user/main.c    | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
bsd-user/qemu.h +0 -1
index 898fe3e8b3..61501c321b 100644
@@ -50,7 +50,6 @@ struct image_info {
     abi_ulong end_code;
     abi_ulong start_data;
     abi_ulong end_data;
-    abi_ulong start_brk;
     abi_ulong brk;
     abi_ulong rss;
     abi_ulong start_stack;
bsd-user/elfload.c +1 -1
index 2d39e59258..baf2f63d2f 100644
@@ -811,7 +811,7 @@ int load_elf_binary(struct bsd_binprm *bprm, struct
 target_pt_regs *regs,
                                        bprm->stringp, &elf_ex, load_addr,
                                        et_dyn_addr, interp_load_addr,
 info);
     info->load_addr = reloc_func_desc;
-    info->start_brk = info->brk = elf_brk;
+    info->brk = elf_brk;
     info->start_stack = bprm->p;
     info->load_bias = 0;
bsd-user/main.c +0 -3
index 381bb18df8..f913cb55a7 100644
@@ -553,8 +553,6 @@ int main(int argc, char **argv)
             fprintf(f, "page layout changed following binary load\n");
             page_dump(f);
 
-            fprintf(f, "start_brk   0x" TARGET_ABI_FMT_lx "\n",
-                    info->start_brk);
             fprintf(f, "end_code    0x" TARGET_ABI_FMT_lx "\n",
                     info->end_code);
             fprintf(f, "start_code  0x" TARGET_ABI_FMT_lx "\n",
--

2.34.1

#7 lore raw

Re: [PATCH 3/3] bsd-user: Remove image_info.start_brk

Quoted 2 lines · Warner Losh

Forgot on 1/3 to mention I'm planning on doing a pull request right after the release (subject to our release engineer's ok) and can include this there.

Excellent, thanks.

r~

#8 lore raw
In reply to Richard Henderson

These all look good. Right now I'm planning on queueing them for the next pull request I have, which is all the reviewed changes from my GSoC student's work and one submission from another user in the bsd-user fork (I think, that one's up in the air). So next week sometime after the release (since last time I did a pull request on a late rc, it caused rebase issues and there's no reason for me not to wait).

Warner

Quoted 24 lines · Richard Henderson

This mirrors some changes I've posted for linux-user, removing stuff from image_info which is unused.

r~

Richard Henderson (3):
bsd-user: Remove ELF_START_MMAP and image_info.start_mmap
bsd-user: Remove image_info.mmap
bsd-user: Remove image_info.start_brk

 bsd-user/arm/target_arch_elf.h    | 1 -
 bsd-user/i386/target_arch_elf.h   | 1 -
 bsd-user/qemu.h                   | 3 ---
 bsd-user/x86_64/target_arch_elf.h | 1 -
 bsd-user/elfload.c                | 4 +---
 bsd-user/main.c                   | 2 --
 6 files changed, 1 insertion(+), 11 deletions(-)

--
2.34.1

#10 lore raw
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Richard Henderson

Richard Henderson (3):
bsd-user: Remove ELF_START_MMAP and image_info.start_mmap
bsd-user: Remove image_info.mmap
bsd-user: Remove image_info.start_brk

Series:

Queued for post release freeze pull request.