aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/system/memory.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-06-13 10:00:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-06-13 10:00:18 +0100
commitfe18911af739d292ad2e62c6699a705a08302fca (patch)
treec4f58c4ec8f7328a175a6b99dac5e82c2716227a /tests/tcg/multiarch/system/memory.c
parenta050901d4b40092dc356b59912c6df39e389c7b9 (diff)
parentab4752ec8d9b0b19ab80915016b739350418a078 (diff)
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-gdbstub-cputlb-120619-3' into staging
Various fixes and updates: - editor config tweak for shell scripts - iotest updates (still not default for make check) - various docker updates - gcc/ubsan updates for travis - some clean-ups for tests/vm (no serial autoinstall) - semihosting fix for Coverity - fixes for cputlb in 64-on-32 cases - gdbstub re-factor + maintainership update # gpg: Signature made Wed 12 Jun 2019 17:55:04 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-testing-gdbstub-cputlb-120619-3: (40 commits) gdbstub: Implement qemu physical memory mode gdbstub: Clear unused variables in gdb_handle_packet gdbstub: Implement target halted (? pkt) with new infra gdbstub: Implement generic set/query (Q/q pkt) with new infra gdbstub: Implement v commands with new infra gdbstub: Implement step (s pkt) with new infra gdbstub: Implement file io (F pkt) with new infra gdbstub: Implement read all registers (g pkt) with new infra gdbstub: Implement write all registers (G pkt) with new infra gdbstub: Implement read memory (m pkt) with new infra gdbstub: Implement write memory (M pkt) with new infra gdbstub: Implement get register (p pkt) with new infra gdbstub: Implement set register (P pkt) with new infra gdbstub: Implement breakpoint commands (Z/z pkt) with new infra gdbstub: Implement set_thread (H pkt) with new infra gdbstub: Implement continue with signal (C pkt) with new infra gdbstub: Implement continue (c pkt) with new infra gdbstub: Implement thread_alive (T pkt) with new infra gdbstub: Implement deatch (D pkt) with new infra gdbstub: Add infrastructure to parse cmd packets ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/tcg/multiarch/system/memory.c')
-rw-r--r--tests/tcg/multiarch/system/memory.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c
index dc1d8a98ff..d124502d73 100644
--- a/tests/tcg/multiarch/system/memory.c
+++ b/tests/tcg/multiarch/system/memory.c
@@ -208,6 +208,7 @@ static bool read_test_data_u32(int offset)
for (i = 0; i < max; i++) {
uint8_t b1, b2, b3, b4;
+ int zeros = 0;
word = *ptr++;
b1 = word >> 24 & 0xff;
@@ -215,6 +216,16 @@ static bool read_test_data_u32(int offset)
b3 = word >> 8 & 0xff;
b4 = word & 0xff;
+ zeros += (b1 == 0 ? 1 : 0);
+ zeros += (b2 == 0 ? 1 : 0);
+ zeros += (b3 == 0 ? 1 : 0);
+ zeros += (b4 == 0 ? 1 : 0);
+ if (zeros > 1) {
+ ml_printf("Error @ %p, more zeros than expected: %d, %d, %d, %d",
+ ptr - 1, b1, b2, b3, b4);
+ return false;
+ }
+
if ((b1 < b2 && b1 != 0) ||
(b2 < b3 && b2 != 0) ||
(b3 < b4 && b3 != 0)) {
@@ -238,6 +249,7 @@ static bool read_test_data_u64(int offset)
for (i = 0; i < max; i++) {
uint8_t b1, b2, b3, b4, b5, b6, b7, b8;
+ int zeros = 0;
word = *ptr++;
b1 = ((uint64_t) (word >> 56)) & 0xff;
@@ -249,6 +261,20 @@ static bool read_test_data_u64(int offset)
b7 = (word >> 8) & 0xff;
b8 = (word >> 0) & 0xff;
+ zeros += (b1 == 0 ? 1 : 0);
+ zeros += (b2 == 0 ? 1 : 0);
+ zeros += (b3 == 0 ? 1 : 0);
+ zeros += (b4 == 0 ? 1 : 0);
+ zeros += (b5 == 0 ? 1 : 0);
+ zeros += (b6 == 0 ? 1 : 0);
+ zeros += (b7 == 0 ? 1 : 0);
+ zeros += (b8 == 0 ? 1 : 0);
+ if (zeros > 1) {
+ ml_printf("Error @ %p, more zeros than expected: %d, %d, %d, %d, %d, %d, %d, %d",
+ ptr - 1, b1, b2, b3, b4, b5, b6, b7, b8);
+ return false;
+ }
+
if ((b1 < b2 && b1 != 0) ||
(b2 < b3 && b2 != 0) ||
(b3 < b4 && b3 != 0) ||
@@ -272,7 +298,7 @@ read_ufn read_ufns[] = { read_test_data_u16,
read_test_data_u32,
read_test_data_u64 };
-bool do_unsigned_reads(void)
+bool do_unsigned_reads(int start_off)
{
int i;
bool ok = true;
@@ -280,11 +306,11 @@ bool do_unsigned_reads(void)
for (i = 0; i < ARRAY_SIZE(read_ufns) && ok; i++) {
#if CHECK_UNALIGNED
int off;
- for (off = 0; off < 8 && ok; off++) {
+ for (off = start_off; off < 8 && ok; off++) {
ok = read_ufns[i](off);
}
#else
- ok = read_ufns[i](0);
+ ok = read_ufns[i](start_off);
#endif
}
@@ -298,11 +324,11 @@ static bool do_unsigned_test(init_ufn fn)
int i;
for (i = 0; i < 8 && ok; i++) {
fn(i);
- ok = do_unsigned_reads();
+ ok = do_unsigned_reads(i);
}
#else
fn(0);
- return do_unsigned_reads();
+ return do_unsigned_reads(0);
#endif
}