* [PATCH v2] tools/nolibc: add support for Alpha
@ 2026-07-21 22:07 Thomas Weißschuh
2026-08-01 19:20 ` Willy Tarreau
2026-08-02 7:06 ` Magnus Lindholm
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2026-07-21 22:07 UTC (permalink / raw)
To: Willy Tarreau, Shuah Khan, Richard Henderson, Matt Turner
Cc: linux-kernel, linux-kselftest, linux-alpha, Arnd Bergmann,
John Paul Adrian Glaubitz, Thomas Weißschuh
A straightforward new architecture.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Only tested on QEMU so far.
Testing on real hardware would be very welcome.
Test instructions:
$ cd tools/testings/selftests/nolibc/
$ make -f Makefile.nolibc ARCH=alpha CROSS_COMPILE=alpha-linux- nolibc-test
$ file nolibc-test
nolibc-test: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), statically linked, not stripped
$ ./nolibc-test
Running test 'startup'
0 argc = 1 [OK]
...
Total number of errors: 0
Exiting with status 0
---
Changes in v2:
- Add clobbers to system call arguments
- Adapt to new system call wrapper names
- Avoid multiple register variables with same register
- Expand comment about special brk handling
- Rebase on latest nolibc/for-next
- Link to v1: https://lore.kernel.org/r/20250713-nolibc-alpha-v1-1-10216333d308@weissschuh.net
---
tools/include/nolibc/Makefile | 2 +-
tools/include/nolibc/arch-alpha.h | 162 +++++++++++++++++++++++++
tools/include/nolibc/arch.h | 2 +
tools/testing/selftests/nolibc/Makefile.nolibc | 2 +
tools/testing/selftests/nolibc/nolibc-test.c | 4 +
tools/testing/selftests/nolibc/run-tests.sh | 3 +-
6 files changed, 173 insertions(+), 2 deletions(-)
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 00fd2e566d75..6d213d372bf8 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -17,7 +17,7 @@ endif
# it defaults to this nolibc directory.
OUTPUT ?= $(CURDIR)/
-architectures := arm arm64 loongarch m68k mips openrisc parisc powerpc riscv s390 sh sparc x86
+architectures := alpha arm arm64 loongarch m68k mips openrisc parisc powerpc riscv s390 sh sparc x86
arch_files := arch.h $(addsuffix .h, $(addprefix arch-, $(architectures)))
all_files := \
alloca.h \
diff --git a/tools/include/nolibc/arch-alpha.h b/tools/include/nolibc/arch-alpha.h
new file mode 100644
index 000000000000..f6c0b905f594
--- /dev/null
+++ b/tools/include/nolibc/arch-alpha.h
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * Alpha specific definitions for NOLIBC
+ * Copyright (C) 2025 Thomas Weißschuh <linux@weissschuh.net>
+ */
+
+#ifndef _NOLIBC_ARCH_ALPHA_H
+#define _NOLIBC_ARCH_ALPHA_H
+
+#include "compiler.h"
+#include "crt.h"
+
+/*
+ * Syscalls for Alpha:
+ * - registers are 64-bit
+ * - syscall number is passed in $0/v0
+ * - the system call is performed by calling callsys
+ * - syscall return comes in $0/v0, error flag in $19/a4
+ * - arguments are passed in $16/a0 to $21/a5
+ * - GCC does not support symbol register names
+ */
+
+#define _NOLIBC_SYSCALL_CLOBBERLIST \
+ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
+ "$22", "$23", "$24", "$25", "$27", "$28", "memory", "cc"
+
+#define __nolibc_syscall0(num) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, \
+ "$16", "$17", "$18", "$20", "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall1(num, arg1) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, "$17", "$18", "$20", "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall2(num, arg1, arg2) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ register long _arg2 __asm__ ("$17") = (long)(arg2); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1), "r"(_arg2) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, "$18", "$20", "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall3(num, arg1, arg2, arg3) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ register long _arg2 __asm__ ("$17") = (long)(arg2); \
+ register long _arg3 __asm__ ("$18") = (long)(arg3); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, "$20", "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall4(num, arg1, arg2, arg3, arg4) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ register long _arg2 __asm__ ("$17") = (long)(arg2); \
+ register long _arg3 __asm__ ("$18") = (long)(arg3); \
+ register long _arg4 __asm__ ("$19") = (long)(arg4); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, "$20", "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ register long _arg2 __asm__ ("$17") = (long)(arg2); \
+ register long _arg3 __asm__ ("$18") = (long)(arg3); \
+ register long _arg4 __asm__ ("$19") = (long)(arg4); \
+ register long _arg5 __asm__ ("$20") = (long)(arg5); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST, "$21" \
+ ); \
+ _err ? -_num : _num; \
+})
+
+#define __nolibc_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
+ register long _num __asm__ ("$0") = (num); \
+ register long _err __asm__ ("$19"); \
+ register long _arg1 __asm__ ("$16") = (long)(arg1); \
+ register long _arg2 __asm__ ("$17") = (long)(arg2); \
+ register long _arg3 __asm__ ("$18") = (long)(arg3); \
+ register long _arg4 __asm__ ("$19") = (long)(arg4); \
+ register long _arg5 __asm__ ("$20") = (long)(arg5); \
+ register long _arg6 __asm__ ("$21") = (long)(arg6); \
+ \
+ __asm__ volatile ( \
+ "callsys" \
+ : "+r"(_num), "=r"(_err) \
+ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
+ "r"(_arg6) \
+ : _NOLIBC_SYSCALL_CLOBBERLIST \
+ ); \
+ _err ? -_num : _num; \
+})
+
+/* startup code */
+void __attribute__((weak, noreturn)) __nolibc_entrypoint __nolibc_no_stack_protector
+_start(void)
+{
+ __asm__ volatile (
+ "br $gp, 0f\n" /* setup $gp, so that 'lda' works */
+ "0: ldgp $gp, 0($gp)\n"
+ "lda $27, _start_c\n" /* setup current function address for _start_c */
+ "mov $sp, $16\n" /* save argc pointer to $16, as arg1 of _start_c */
+ "br _start_c\n" /* transfer to c runtime */
+ );
+ __nolibc_entrypoint_epilogue();
+}
+
+#endif /* _NOLIBC_ARCH_ALPHA_H */
diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h
index b69d9c5ec5c6..06cc2dbe7a33 100644
--- a/tools/include/nolibc/arch.h
+++ b/tools/include/nolibc/arch.h
@@ -32,6 +32,8 @@
#include "arch-openrisc.h"
#elif defined(__hppa__)
#include "arch-parisc.h"
+#elif defined(__alpha__)
+#include "arch-alpha.h"
#else
#error Unsupported Architecture
#endif
diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
index 06f881e2e90c..f70c8dfca018 100644
--- a/tools/testing/selftests/nolibc/Makefile.nolibc
+++ b/tools/testing/selftests/nolibc/Makefile.nolibc
@@ -112,6 +112,7 @@ EXTRACONFIG_armthumb = -e CONFIG_NAMESPACES
EXTRACONFIG_sparc32 = -e CONFIG_TMPFS
EXTRACONFIG_m68k = -e CONFIG_BLK_DEV_INITRD
EXTRACONFIG_sh4 = -e CONFIG_BLK_DEV_INITRD -e CONFIG_CMDLINE_FROM_BOOTLOADER
+EXTRACONFIG_alpha = -e CONFIG_BLK_DEV_INITRD
EXTRACONFIG = $(EXTRACONFIG_$(XARCH))
# optional tests to run (default = all)
@@ -174,6 +175,7 @@ QEMU_ARGS_m68k = -M virt -append "console=ttyGF0,115200 panic=-1 $(TEST:%=
QEMU_ARGS_sh4 = -M r2d -serial file:/dev/stdout -append "console=ttySC1,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)"
QEMU_ARGS_openrisc = -M virt -m 512M -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)"
QEMU_ARGS_parisc32 = -M B160L -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)"
+QEMU_ARGS_alpha = -M clipper -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)"
QEMU_ARGS = -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_ARGS_EXTRA)
# OUTPUT is only set when run from the main makefile, otherwise
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 996e8d13508e..66accf99f560 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -756,6 +756,10 @@ int run_startup(int min, int max)
/* checking NULL for argv/argv0, environ and _auxv is not enough, let's compare with sbrk(0) or &end */
extern char end;
char *brk = sbrk(0) != (void *)-1 ? sbrk(0) : &end;
+#if defined(__alpha__)
+ /* the ordering above does not work on an alpha kernel due to STACK_TOP != TASK_SIZEi */
+ brk = NULL;
+#endif
/* differ from nolibc, both glibc and musl have no global _auxv */
const unsigned long *test_auxv = (void *)-1;
#ifdef NOLIBC
diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/selftests/nolibc/run-tests.sh
index 6460e25001de..dc0b1649c641 100755
--- a/tools/testing/selftests/nolibc/run-tests.sh
+++ b/tools/testing/selftests/nolibc/run-tests.sh
@@ -30,6 +30,7 @@ all_archs=(
m68k
sh4
parisc32
+ alpha
)
archs="${all_archs[@]}"
@@ -193,7 +194,7 @@ test_arch() {
exit 1
esac
printf '%-15s' "$arch:"
- if [ "$arch" = "m68k" -o "$arch" = "sh4" -o "$arch" = "openrisc" -o "$arch" = "parisc32" ] && [ "$llvm" = "1" ]; then
+ if [ "$arch" = "m68k" -o "$arch" = "sh4" -o "$arch" = "openrisc" -o "$arch" = "parisc32" -o "$arch" = "alpha" ] && [ "$llvm" = "1" ]; then
echo "Unsupported configuration"
return
fi
---
base-commit: 070cf03f5ec454eec9c42827ee9f3c0b3fad09f1
change-id: 20250609-nolibc-alpha-33e79644544c
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2] tools/nolibc: add support for Alpha
2026-07-21 22:07 [PATCH v2] tools/nolibc: add support for Alpha Thomas Weißschuh
@ 2026-08-01 19:20 ` Willy Tarreau
2026-08-01 20:14 ` John Paul Adrian Glaubitz
2026-08-02 7:06 ` Magnus Lindholm
1 sibling, 1 reply; 6+ messages in thread
From: Willy Tarreau @ 2026-08-01 19:20 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Shuah Khan, Richard Henderson, Matt Turner, linux-kernel,
linux-kselftest, linux-alpha, Arnd Bergmann,
John Paul Adrian Glaubitz
Hi Thomas,
On Wed, Jul 22, 2026 at 12:07:05AM +0200, Thomas Weißschuh wrote:
> A straightforward new architecture.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Only tested on QEMU so far.
> Testing on real hardware would be very welcome.
I'd love to, but last year I could fix my serial port (replaced the chip
on the motherboard) and the new one died a few minutes later :-( I'm
starting to seriously suspect a flaky PSU that doesn't regulate its 12V
output well and that is progressively killing the mobo.
(...)
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index 996e8d13508e..66accf99f560 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -756,6 +756,10 @@ int run_startup(int min, int max)
> /* checking NULL for argv/argv0, environ and _auxv is not enough, let's compare with sbrk(0) or &end */
> extern char end;
> char *brk = sbrk(0) != (void *)-1 ? sbrk(0) : &end;
> +#if defined(__alpha__)
> + /* the ordering above does not work on an alpha kernel due to STACK_TOP != TASK_SIZEi */
^^^^^^^^^^
I suspect this trailing "i" is a leftover from an attempt to switch vi to
insertion mode :-)
Otherwise, while I'm not competent on the alpha side, it looks clean from
the nolibc perspective, thank you!
Acked-by: Willy Tarreau <w@1wt.eu>
Willy
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] tools/nolibc: add support for Alpha
2026-08-01 19:20 ` Willy Tarreau
@ 2026-08-01 20:14 ` John Paul Adrian Glaubitz
2026-08-01 20:40 ` Michael Cree
0 siblings, 1 reply; 6+ messages in thread
From: John Paul Adrian Glaubitz @ 2026-08-01 20:14 UTC (permalink / raw)
To: Willy Tarreau, Thomas Weißschuh, Magnus Lindholm
Cc: Shuah Khan, Richard Henderson, Matt Turner, linux-kernel,
linux-kselftest, linux-alpha, Arnd Bergmann
Hi,
On Sat, 2026-08-01 at 21:20 +0200, Willy Tarreau wrote:
> On Wed, Jul 22, 2026 at 12:07:05AM +0200, Thomas Weißschuh wrote:
> > A straightforward new architecture.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > Only tested on QEMU so far.
> > Testing on real hardware would be very welcome.
>
> I'd love to, but last year I could fix my serial port (replaced the chip
> on the motherboard) and the new one died a few minutes later :-( I'm
> starting to seriously suspect a flaky PSU that doesn't regulate its 12V
> output well and that is progressively killing the mobo.
Magnus (CC'ed) should be able to test the patch on real hardware.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] tools/nolibc: add support for Alpha
2026-08-01 20:14 ` John Paul Adrian Glaubitz
@ 2026-08-01 20:40 ` Michael Cree
0 siblings, 0 replies; 6+ messages in thread
From: Michael Cree @ 2026-08-01 20:40 UTC (permalink / raw)
To: John Paul Adrian Glaubitz
Cc: Willy Tarreau, Thomas Weißschuh, Magnus Lindholm, Shuah Khan,
Richard Henderson, Matt Turner, linux-kernel, linux-kselftest,
linux-alpha, Arnd Bergmann
On Sat, Aug 01, 2026 at 10:14:38PM +0200, John Paul Adrian Glaubitz wrote:
> On Sat, 2026-08-01 at 21:20 +0200, Willy Tarreau wrote:
> > On Wed, Jul 22, 2026 at 12:07:05AM +0200, Thomas Weißschuh wrote:
> > > A straightforward new architecture.
> > >
> > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > > ---
> > > Only tested on QEMU so far.
> > > Testing on real hardware would be very welcome.
> >
> > I'd love to, but last year I could fix my serial port (replaced the chip
> > on the motherboard) and the new one died a few minutes later :-( I'm
> > starting to seriously suspect a flaky PSU that doesn't regulate its 12V
> > output well and that is progressively killing the mobo.
>
> Magnus (CC'ed) should be able to test the patch on real hardware.
I had tested it on XP1000 and ES45 with no test suite failures shown,
but hadn't got around to reporting that fact.
Tested-by: Michael Cree <mcree@orcon.net.nz>
Cheers,
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] tools/nolibc: add support for Alpha
2026-07-21 22:07 [PATCH v2] tools/nolibc: add support for Alpha Thomas Weißschuh
2026-08-01 19:20 ` Willy Tarreau
@ 2026-08-02 7:06 ` Magnus Lindholm
2026-08-02 7:35 ` Thomas Weißschuh
1 sibling, 1 reply; 6+ messages in thread
From: Magnus Lindholm @ 2026-08-02 7:06 UTC (permalink / raw)
To: linux
Cc: Willy Tarreau, Shuah Khan, Richard Henderson, Matt Turner,
linux-kernel, linux-kselftest, linux-alpha, Arnd Bergmann,
John Paul Adrian Glaubitz
Hi Thomas,
On Wed, Jul 22, 2026 at 3:28 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
> + * Syscalls for Alpha:
> + * - registers are 64-bit
> + * - syscall number is passed in $0/v0
> + * - the system call is performed by calling callsys
> + * - syscall return comes in $0/v0, error flag in $19/a4
typo in comment ? should be:
syscall return comes in $0/v0, error flag in $19/a3
> + * - arguments are passed in $16/a0 to $21/a5
> + * - GCC does not support symbol register names
> + */
> +#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
> +({ \
> + register long _num __asm__ ("$0") = (num); \
> + register long _err __asm__ ("$19"); \
> + register long _arg1 __asm__ ("$16") = (long)(arg1); \
> + register long _arg2 __asm__ ("$17") = (long)(arg2); \
> + register long _arg3 __asm__ ("$18") = (long)(arg3); \
> + register long _arg4 __asm__ ("$19") = (long)(arg4); \
> + register long _arg5 __asm__ ("$20") = (long)(arg5); \
> + \
> + __asm__ volatile ( \
> + "callsys" \
> + : "+r"(_num), "=r"(_err) \
> + : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5) \
> + : _NOLIBC_SYSCALL_CLOBBERLIST, "$21" \
> + ); \
> + _err ? -_num : _num; \
> +})
One observation, although I am not an expert on GCC inline-assembly constraints:
in the four- through six-argument wrappers, $19/a3 contains the fourth
argument on
entry and the error indicator on return. Would using a single read/write operand
for $19, similar to the handling of $0, make that transition clearer?
Michael’s successful testing on both XP1000 and ES45 also shows that the current
implementation works correctly on real hardware, so I do not consider
changing the
operand representation a requirement for v3. From my side, addressing the $19/a4
comment typo, together with the "TASK_SIZEi" typo already noted by Willy,
would be sufficient.
Michael’s testing should be sufficient, but I also have access to Alpha hardware
and would be happy to assist with any additional testing if useful.
Thanks alot for taking the time to do this.
Regards,
Magnus
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] tools/nolibc: add support for Alpha
2026-08-02 7:06 ` Magnus Lindholm
@ 2026-08-02 7:35 ` Thomas Weißschuh
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2026-08-02 7:35 UTC (permalink / raw)
To: Magnus Lindholm
Cc: Willy Tarreau, Shuah Khan, Richard Henderson, Matt Turner,
linux-kernel, linux-kselftest, linux-alpha, Arnd Bergmann,
John Paul Adrian Glaubitz
On 2026-08-02 09:06:59+0200, Magnus Lindholm wrote:
> On Wed, Jul 22, 2026 at 3:28 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
>
> > + * Syscalls for Alpha:
> > + * - registers are 64-bit
> > + * - syscall number is passed in $0/v0
> > + * - the system call is performed by calling callsys
> > + * - syscall return comes in $0/v0, error flag in $19/a4
>
> typo in comment ? should be:
> syscall return comes in $0/v0, error flag in $19/a3
Ack.
> > + * - arguments are passed in $16/a0 to $21/a5
> > + * - GCC does not support symbol register names
> > + */
>
> > +#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
> > +({ \
> > + register long _num __asm__ ("$0") = (num); \
> > + register long _err __asm__ ("$19"); \
> > + register long _arg1 __asm__ ("$16") = (long)(arg1); \
> > + register long _arg2 __asm__ ("$17") = (long)(arg2); \
> > + register long _arg3 __asm__ ("$18") = (long)(arg3); \
> > + register long _arg4 __asm__ ("$19") = (long)(arg4); \
> > + register long _arg5 __asm__ ("$20") = (long)(arg5); \
> > + \
> > + __asm__ volatile ( \
> > + "callsys" \
> > + : "+r"(_num), "=r"(_err) \
> > + : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5) \
> > + : _NOLIBC_SYSCALL_CLOBBERLIST, "$21" \
> > + ); \
> > + _err ? -_num : _num; \
> > +})
>
> One observation, although I am not an expert on GCC inline-assembly constraints:
> in the four- through six-argument wrappers, $19/a3 contains the fourth
> argument on
> entry and the error indicator on return. Would using a single read/write operand
> for $19, similar to the handling of $0, make that transition clearer?
Good catch. We had miscompilations from clang in this case before.
So I'll fix this up to be on the safe side.
> Michael’s successful testing on both XP1000 and ES45 also shows that the current
> implementation works correctly on real hardware, so I do not consider
> changing the
> operand representation a requirement for v3. From my side, addressing the $19/a4
> comment typo, together with the "TASK_SIZEi" typo already noted by Willy,
> would be sufficient.
>
> Michael’s testing should be sufficient, but I also have access to Alpha hardware
> and would be happy to assist with any additional testing if useful.
Thanks for the offer. For me Michael's Tested-by would be sufficient.
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-02 7:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 22:07 [PATCH v2] tools/nolibc: add support for Alpha Thomas Weißschuh
2026-08-01 19:20 ` Willy Tarreau
2026-08-01 20:14 ` John Paul Adrian Glaubitz
2026-08-01 20:40 ` Michael Cree
2026-08-02 7:06 ` Magnus Lindholm
2026-08-02 7:35 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox