diff options
author | 2025-02-06 08:10:27 +0100 | |
---|---|---|
committer | 2025-02-20 22:06:32 +0100 | |
commit | 9c812b01f13d37410ea103e00bc47e5e0f6d2bad (patch) | |
tree | ae8f975e2ee7d6d2e82dee1e0f38dc18b909b090 /tools/include/nolibc | |
parent | selftests/nolibc: rename s390 to s390x (diff) | |
download | wireguard-linux-9c812b01f13d37410ea103e00bc47e5e0f6d2bad.tar.xz wireguard-linux-9c812b01f13d37410ea103e00bc47e5e0f6d2bad.zip |
tools/nolibc: add support for 32-bit s390
32-bit s390 is very close to the existing 64-bit implementation.
Some special handling is necessary as there is neither LLVM nor
QEMU support. Also the kernel itself can not build natively for 32-bit
s390, so instead the test program is executed with a 64-bit kernel.
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250206-nolibc-s390-v2-2-991ad97e3d58@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Diffstat (limited to 'tools/include/nolibc')
-rw-r--r-- | tools/include/nolibc/arch-s390.h | 5 | ||||
-rw-r--r-- | tools/include/nolibc/arch.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h index f9ab83a219b8..acfee7e9d5e2 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -143,8 +143,13 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void) { __asm__ volatile ( +#ifdef __s390x__ "lgr %r2, %r15\n" /* save stack pointer to %r2, as arg1 of _start_c */ "aghi %r15, -160\n" /* allocate new stackframe */ +#else + "lr %r2, %r15\n" + "ahi %r15, -96\n" +#endif "xc 0(8,%r15), 0(%r15)\n" /* clear backchain */ "brasl %r14, _start_c\n" /* transfer to c runtime */ ); diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h index c8f4e5d3add9..8a2c143c0fba 100644 --- a/tools/include/nolibc/arch.h +++ b/tools/include/nolibc/arch.h @@ -29,7 +29,7 @@ #include "arch-powerpc.h" #elif defined(__riscv) #include "arch-riscv.h" -#elif defined(__s390x__) +#elif defined(__s390x__) || defined(__s390__) #include "arch-s390.h" #elif defined(__loongarch__) #include "arch-loongarch.h" |