[PATCH] test: do not write to 0x0 except on sandbox

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Nov 5 19:07:47 CET 2025


ARM and RISC-V do not have memory at 0x0.
On X86 interrupt vectors are stored at 0x0.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 test/cmd/fdt.c      | 4 ++++
 test/common/print.c | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index 96a8488e172..6b07999c88f 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -269,6 +269,10 @@ static int fdt_test_move(struct unit_test_state *uts)
 	uint32_t ts;
 	void *buf;
 
+	/* This test requires low writable memory */
+	if (!IS_ENABLED(CONFIG_SANDBOX))
+		return -EAGAIN;
+
 	/* Original source DT */
 	ut_assertok(make_test_fdt(uts, fdt, size, &addr));
 	ts = fdt_totalsize(fdt);
diff --git a/test/common/print.c b/test/common/print.c
index 76ee851fe6a..389d6bf4069 100644
--- a/test/common/print.c
+++ b/test/common/print.c
@@ -169,7 +169,7 @@ static int print_display_buffer(struct unit_test_state *uts)
 	int i;
 
 	/* This test requires writable memory at zero */
-	if (IS_ENABLED(CONFIG_X86))
+	if (!IS_ENABLED(CONFIG_SANDBOX))
 		return -EAGAIN;
 
 	buf = map_sysmem(0, BUF_SIZE);
@@ -244,6 +244,10 @@ static int print_hexdump_line(struct unit_test_state *uts)
 	u8 *buf;
 	int i;
 
+	/* This test requires writable memory at zero */
+	if (!IS_ENABLED(CONFIG_SANDBOX))
+		return -EAGAIN;
+
 	buf = map_sysmem(0, BUF_SIZE);
 	memset(buf, '\0', BUF_SIZE);
 	for (i = 0; i < 0x11; i++)
@@ -270,7 +274,7 @@ static int print_do_hex_dump(struct unit_test_state *uts)
 	int i;
 
 	/* This test requires writable memory at zero */
-	if (IS_ENABLED(CONFIG_X86))
+	if (!IS_ENABLED(CONFIG_SANDBOX))
 		return -EAGAIN;
 
 	buf = map_sysmem(0, BUF_SIZE);
-- 
2.51.0



More information about the U-Boot mailing list