[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH 5/6] target/s390x: fix PACK reading 1 byte less an
From: |
Pavel Zbitskiy |
Subject: |
[Qemu-trivial] [PATCH 5/6] target/s390x: fix PACK reading 1 byte less and writing 1 byte more |
Date: |
Sun, 5 Aug 2018 14:28:30 -0400 |
PACK fails on the test from the Principles of Operation: F1F2F3F4
becomes 0000234C instead of 0001234C due to an off-by-one error.
Furthermore, it overwrites one extra byte to the left of F1.
Signed-off-by: Pavel Zbitskiy <address@hidden>
---
target/s390x/mem_helper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 704d0193b5..bacae4f503 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -1019,15 +1019,15 @@ void HELPER(pack)(CPUS390XState *env, uint32_t len,
uint64_t dest, uint64_t src)
len_src--;
/* now pack every value */
- while (len_dest >= 0) {
+ while (len_dest > 0) {
b = 0;
- if (len_src > 0) {
+ if (len_src >= 0) {
b = cpu_ldub_data_ra(env, src, ra) & 0x0f;
src--;
len_src--;
}
- if (len_src > 0) {
+ if (len_src >= 0) {
b |= cpu_ldub_data_ra(env, src, ra) << 4;
src--;
len_src--;
--
2.16.2.windows.1
- [Qemu-trivial] [PATCH 0/6] Some improvements in z/Arch instructions support, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 0/6] Some improvements in z/Arch instructions support, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 1/6] target/s390x: add BAL and BALR instructions, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 2/6] target/s390x: fix CSST decoding and runtime alignment check, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 3/6] target/s390x: fix ipm polluting irrelevant bits, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 4/6] target/s390x: add EX support for TRT and TRTR, Pavel Zbitskiy, 2018/08/05
- [Qemu-trivial] [PATCH 5/6] target/s390x: fix PACK reading 1 byte less and writing 1 byte more,
Pavel Zbitskiy <=
- [Qemu-trivial] [PATCH 6/6] target/s390x: implement CVB, CVBY and CVBG, Pavel Zbitskiy, 2018/08/05
- Re: [Qemu-trivial] [Qemu-devel] [PATCH 0/6] Some improvements in z/Arch instructions support, Cornelia Huck, 2018/08/06