Cc'ing Akihiko for commit a1eaa6281f.
On 7/1/24 08:19, Helge Deller wrote:
Update the TCI interpreter test matrix for big-endian hosts with
big- (hppa, hppa64) and little-endian (x86,x96-64) targets.
I used native ppc64 and hppa hosts for those tests.
Starting TCI on a hppa host crashed immediately, because hppa is
the only archive left where the stack grows upwards.
Write-protecting the stack guard page at the top of the stack
fixes the crash.
Fixes: a1eaa6281f ("util: Delete checks for old host definitions")
Signed-off-by: Helge Deller <del...@gmx.de>
diff --git a/tcg/tci/README b/tcg/tci/README
index 4a8b5b5401..0c1e50779e 100644
--- a/tcg/tci/README
+++ b/tcg/tci/README
@@ -72,16 +72,16 @@ host and target with same or different endianness.
| host (le) host (be)
| 32 64 32 64
------------+------------------------------------------------------------
-target (le) | s0, u0 s1, u1 s?, u? s?, u?
+target (le) | s0, u0 s1, u1 s2, u? s2, u?
32 bit |
|
-target (le) | sc, uc s1, u1 s?, u? s?, u?
+target (le) | sc, uc s1, u1 s2, u? s2, u?
64 bit |
|
-target (be) | sc, u0 sc, uc s?, u? s?, u?
+target (be) | sc, u0 sc, uc s2, u? s2, u?
32 bit |
|
-target (be) | sc, uc sc, uc s?, u? s?, u?
+target (be) | sc, uc sc, uc s?, u? s2, u?
64 bit |
|
@@ -110,6 +115,10 @@ u1 = linux-user-test works
A cross compiled QEMU for ppc host works at least partially:
i386-linux-user/qemu-i386 can run a simple hello-world program
(tested in a ppc emulation).
+ The big-endian tests were run on native hppa (big-endian, 32-bit) and
+ ppc64 (big-endian, 64-bit) machines. Tested target machines were
+ x86 and x86-64 (little-endian, debian install ISO) and 32- and 64-bit
+ big-endian hppa (NetBSD and Debian install ISOs).
* Some TCG opcodes are either missing in the code generator and/or
in the interpreter. These opcodes raise a runtime exception, so it is
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index e86fd64e09..e378b71641 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -585,11 +585,8 @@ char *qemu_get_pid_name(pid_t pid)
void *qemu_alloc_stack(size_t *sz)
{
- void *ptr;
+ void *ptr, *ptr2;
int flags;
-#ifdef CONFIG_DEBUG_STACK_USAGE
- void *ptr2;
-#endif
size_t pagesz = qemu_real_host_page_size();
#ifdef _SC_THREAD_STACK_MIN
/* avoid stacks smaller than _SC_THREAD_STACK_MIN */
@@ -619,7 +616,12 @@ void *qemu_alloc_stack(size_t *sz)
}
/* Stack grows down -- guard page at the bottom. */
- if (mprotect(ptr, pagesz, PROT_NONE) != 0) {
+ ptr2 = ptr;
+#if defined(__hppa__)
Is it worth make this generic by declaring some TARGET_STACK_GROWS_UP
definition in target/foo/cpu-param.h?
+ /* but on hppa the stack grows up, so guard the top page instead */
+ ptr2 = ptr + *sz - pagesz;
+#endif
+ if (mprotect(ptr2, pagesz, PROT_NONE) != 0) {
perror("failed to set up stack guard page");
abort();
}