[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 73/88] include/hw/elf: Remove truncating signed casts
From: |
Richard Henderson |
Subject: |
[PATCH v3 73/88] include/hw/elf: Remove truncating signed casts |
Date: |
Wed, 1 Nov 2023 18:30:01 -0700 |
There's nothing about elf that specifically requires signed vs unsigned.
This is very much a target-specific preference.
In the meantime, casting low and high from uint64_t back to Elf_SWord
to uint64_t discards high bits that might have been set by translate_fn.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/elf_ops.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index dffb0e73d2..0a5c258fe6 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -385,10 +385,11 @@ static ssize_t glue(load_elf, SZ)(const char *name, int
fd,
}
if (pflags) {
- *pflags = (elf_word)ehdr.e_flags;
+ *pflags = ehdr.e_flags;
+ }
+ if (pentry) {
+ *pentry = ehdr.e_entry;
}
- if (pentry)
- *pentry = (uint64_t)(elf_sword)ehdr.e_entry;
glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb, sym_cb);
@@ -610,10 +611,12 @@ static ssize_t glue(load_elf, SZ)(const char *name, int
fd,
}
}
- if (lowaddr)
- *lowaddr = (uint64_t)(elf_sword)low;
- if (highaddr)
- *highaddr = (uint64_t)(elf_sword)high;
+ if (lowaddr) {
+ *lowaddr = low;
+ }
+ if (highaddr) {
+ *highaddr = high;
+ }
ret = total_size;
fail:
if (mapped_file) {
--
2.34.1
- [PATCH v3 69/88] target/hppa: Implement PERMH, (continued)
- [PATCH v3 69/88] target/hppa: Implement PERMH, Richard Henderson, 2023/11/01
- [PATCH v3 71/88] target/hppa: Precompute zero into DisasContext, Richard Henderson, 2023/11/01
- [PATCH v3 59/88] target/hppa: Remove remaining TARGET_REGISTER_BITS redirections, Richard Henderson, 2023/11/01
- [PATCH v3 64/88] target/hppa: Implement HSUB, Richard Henderson, 2023/11/01
- [PATCH v3 46/88] target/hppa: Decode d for cmpb instructions, Richard Henderson, 2023/11/01
- [PATCH v3 50/88] target/hppa: Implement DEPD, DEPDI, Richard Henderson, 2023/11/01
- [PATCH v3 52/88] target/hppa: Implement SHRPD, Richard Henderson, 2023/11/01
- [PATCH v3 53/88] target/hppa: Implement CLRBTS, POPBTS, PUSHBTS, PUSHNOM, Richard Henderson, 2023/11/01
- [PATCH v3 54/88] target/hppa: Implement STDBY, Richard Henderson, 2023/11/01
- [PATCH v3 60/88] target/hppa: Adjust vmstate_env for pa2.0 tlb, Richard Henderson, 2023/11/01
- [PATCH v3 73/88] include/hw/elf: Remove truncating signed casts,
Richard Henderson <=
- [PATCH v3 61/88] target/hppa: Use tcg_temp_new_i64 not tcg_temp_new, Richard Henderson, 2023/11/01
- [PATCH v3 77/88] target/hppa: Add pa2.0 cpu local tlb flushes, Richard Henderson, 2023/11/01
- [PATCH v3 65/88] target/hppa: Implement HAVG, Richard Henderson, 2023/11/01
- [PATCH v3 62/88] target/hppa: Replace tcg_gen_*_tl with tcg_gen_*_i64, Richard Henderson, 2023/11/01
- [PATCH v3 67/88] target/hppa: Implement HSHLADD, HSHRADD, Richard Henderson, 2023/11/01
- [PATCH v3 75/88] linux-user/hppa: Drop EXCP_DUMP from handled exceptions, Richard Henderson, 2023/11/01
- [PATCH v3 45/88] target/hppa: Decode d for bb instructions, Richard Henderson, 2023/11/01
- [PATCH v3 78/88] target/hppa: Avoid async_safe_run_on_cpu on uniprocessor system, Richard Henderson, 2023/11/01
- [PATCH v3 74/88] hw/hppa: Translate phys addresses for the cpu, Richard Henderson, 2023/11/01
- [PATCH v3 70/88] target/hppa: Fix interruption based on default PSW, Richard Henderson, 2023/11/01