From nobody Mon Jun 15 03:06:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37A5D389444; Tue, 7 Apr 2026 16:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579874; cv=none; b=sWuWvSlGVgjpIErcxxn6J3tir1jd87+1Ircx9TQah4P/Hc44eunEFGrlPAzw1U8awNMXxECXpasIXjnMsRMSlsPNmcqL1FS3W1I95nQzhML/pbOtJ6w2TiwpZTu54+cWPrUwNsQQVLTWX8j5/x1NjCTyRul1tS5f3ZGn79AA8v4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579874; c=relaxed/simple; bh=rdx5yAm5WgRcvOV/xO2ZOgDn8Fsg7c8dxU+ndBRjzZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FN5k/+1XvUfFOxd2SMu9XOv7Z4A0V66DLo5kG4eOHoU3phy+A6aQkvmY70Idcixdn/zOeXR1v7EqqKcVoN2Yzeq+qNTygigbpZFdC8Phi/2P+SVYWWYY5iEP2syVKK3y9eHj5yR5Ho9SQnY/eIe94JupF24CgoIzFdb3byv1F7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=MSllPerI; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="MSllPerI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775579865; bh=rdx5yAm5WgRcvOV/xO2ZOgDn8Fsg7c8dxU+ndBRjzZE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MSllPerIpo4wEd6X7SmqMFwmi6QiFJkl/7wEiWsNWtysaR3LkFwz2lfTXwkmDXRVE RbcxmAAiHqDypeU0zjrw0V6/vou1WJeNk/qGtxaTmxRwxMwiZ4bycNpcxjlghXjTRx /FgsMjoQUjynwNjxOMEzF/OC5iOXgT6L2U/DzeVs= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 07 Apr 2026 18:37:43 +0200 Subject: [PATCH 1/3] parisc: Makefile: use the regular compiler to build a native 32-bit vDSO Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-nolibc-hppa-v1-1-f70b4509c44a@weissschuh.net> References: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> In-Reply-To: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775579864; l=1056; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=rdx5yAm5WgRcvOV/xO2ZOgDn8Fsg7c8dxU+ndBRjzZE=; b=3Ht5Skl0HbWmSNcUAMFpLqol5T8MByqT8ysCLFh0nekNXJ8NRXgnPPx4Z0R62aZDPvPJGIghZ 1m5sfTMAAgUDRPS0+YJzfd2eYwjpybEGo41lF5AY9r9X8iZEtRFyrQ6 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= When building a native 32-bit kernel $(CC) the compiler is obviously able to compile 32-bit code. There is no need to force the user to configure a dedicated 32-bit compiler. Use the regular compiler for the 32-bit vDSO when it is sufficient. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/parisc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 48ae3c79557a..57320e1d8396 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -39,6 +39,7 @@ endif =20 export LD_BFD =20 +ifdef CONFIG_64BIT # Set default 32 bits cross compilers for vdso. # This means that for 64BIT, both the 64-bit tools and the 32-bit tools # need to be in the path. @@ -48,6 +49,9 @@ CROSS32_COMPILE :=3D $(call cc-cross-prefix, \ $(foreach a,$(CC_ARCHES_32), \ $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) CROSS32CC :=3D $(CROSS32_COMPILE)gcc +else +CROSS32CC :=3D $(CC) +endif export CROSS32CC =20 # Set default cross compiler for kernel build --=20 2.53.0 From nobody Mon Jun 15 03:06:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37B233A4517; Tue, 7 Apr 2026 16:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579875; cv=none; b=hmipvjeMBunpW8PyjtrSRQf5hpeM+aL6AdhMf5YdpnFXYh0YI+BKqYZEN3PBseVVOdr+8KSV4aoZ0w1bltpPwsJT7hKfryK3gAFQP0O5kgtvfBaaPUUcNuK/tlM3Q4wCLDWGI30EYSTuSXfCGioeqvyPoCI1zfb/odoaZBHmdzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579875; c=relaxed/simple; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gSrwULrFVRda3Fl8rsWFxiSOGeKe8ElvA8PoHzx/i2hXVrkrdSmUbuJm6M5deKq02TPd9cIH/kgf85dJdmBAIaWfMuFLhaJFkSSKEMjakxDo3Au0AG4fSj+j6KpqqNGzmQ7P/P63vAchBdK6FQLh2B4CaZlKj0J3S5xFnVklK/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=akRGZl9N; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="akRGZl9N" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775579865; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=akRGZl9NT3AyyOQPE6E9QRJ8y/Fl3ZOyNAmzRr8+HOu1sUk2909XCG+BAUYCpi04D JnHQzgc41dUhGaSM6z/UA5v3dGThaurcu1ImYl6REqrz8HxjhtsOJHXVzyDhrTp2gI ZP6+8DLSLW/qXF/phnJqT8JBYqBAACUvQ80dErvM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 07 Apr 2026 18:37:44 +0200 Subject: [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-nolibc-hppa-v1-2-f70b4509c44a@weissschuh.net> References: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> In-Reply-To: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775579864; l=1867; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Yfc5QKR8flQStWiZaylgCaabEIAAzzgZUAWfYl+Co6A=; b=yGnk9ysO7hzVazWPGsnS25mHlnZQb1H5C5byng/AqJOAKkn73+XFYqRVfpqgunIiLYmuLavEF 2POKZ7NfI9fDqJyH0Tg5J8JDmBqGvnlFb0PehIYaiZmgvU6z1QOcvNo X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The upcoming parisc support would require libgcc to implement function pointer comparisons. As we try to avoid the libgcc dependency rework the logic to work without such comparisons. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/s= elftests/nolibc/nolibc-test.c index d3c4facb54c0..de4e87586d75 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -647,20 +647,25 @@ int expect_str_buf_eq(size_t expr, const char *buf, s= ize_t val, int llen, const return 0; } =20 +enum strtox_func { + strtox_func_strtol, + strtox_func_strtoul, +}; + #define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_e= rrno) \ - do { if (!(cond)) result(llen, SKIPPED); else ret +=3D expect_strtox(llen= , func, input, base, expected, chars, expected_errno); } while (0) + do { if (!(cond)) result(llen, SKIPPED); else ret +=3D expect_strtox(llen= , strtox_func_ ## func, input, base, expected, chars, expected_errno); } wh= ile (0) =20 static __attribute__((unused)) -int expect_strtox(int llen, void *func, const char *input, int base, intma= x_t expected, int expected_chars, int expected_errno) +int expect_strtox(int llen, enum strtox_func func, const char *input, int = base, intmax_t expected, int expected_chars, int expected_errno) { char *endptr; int actual_errno, actual_chars; intmax_t r; =20 errno =3D 0; - if (func =3D=3D strtol) { + if (func =3D=3D strtox_func_strtol) { r =3D strtol(input, &endptr, base); - } else if (func =3D=3D strtoul) { + } else if (func =3D=3D strtox_func_strtoul) { r =3D strtoul(input, &endptr, base); } else { result(llen, FAIL); --=20 2.53.0 From nobody Mon Jun 15 03:06:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37BB03AB269; Tue, 7 Apr 2026 16:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579875; cv=none; b=EqAfat6k4TzTtWsJNyecRj6LHeFZs6bnsJ6epZEi0wlOnKato1Ht6pyYSuIicO4TC9flpDNPVh+qlsjtR84/ii9EiGlBCk6BvKcI3L8kKZndGMMTLL+skh57jQXDY1POb2Hm0mTwEltvVcVuA8c1/S6mOcNNWdfN8Fq/0+EElsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775579875; c=relaxed/simple; bh=4BNTkwFqkf6q/DUpTmTdVDZsFQo3MXbxBMek5n63sN0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D28HYC9x1XuFJeoaRNK2WUOYGgBjb47U3g5CmruOA6GuougYq3px8Z7i18Bz6urSsjKaJCO+9lM5mfD9Oj2enz1JAZsZFxCDLmc7dTCrRLxMBRtDAIcrzKdV952KHHBUgy0YcxBbCgfkT9cGFi1nOvWpA3XWqUVzntT6fhUumHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=iX62xteT; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="iX62xteT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775579865; bh=4BNTkwFqkf6q/DUpTmTdVDZsFQo3MXbxBMek5n63sN0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iX62xteTvlvsLe4fbF2dbZ7miPevs7ihB87wtHmgPy1+ESEgi2L4EbwyBCXNu2Fp3 +TnOWsZgVL4MFTmRkuc2/N5cT7LzeVHyFt47WAVULcEA2klu9BiFsUmyARIA9yk7uS LDy5LTK0RwMAOC8O6dazWeik15Kg28nyzdex9f4Q= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 07 Apr 2026 18:37:45 +0200 Subject: [PATCH 3/3] tools/nolibc: add support for 32-bit parisc Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-nolibc-hppa-v1-3-f70b4509c44a@weissschuh.net> References: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> In-Reply-To: <20260407-nolibc-hppa-v1-0-f70b4509c44a@weissschuh.net> To: "James E.J. Bottomley" , Helge Deller , Willy Tarreau Cc: linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775579864; l=14310; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=4BNTkwFqkf6q/DUpTmTdVDZsFQo3MXbxBMek5n63sN0=; b=kdbRSRSUidxqxx4m4nSKZYOCDiyLnGRlHOiqYVgRcYbjL2HMoOO872ewEDHfiR4niVXVs0+n+ 1PRWfgPP0bEDA5Znj+fjZ72Wv5hOz/CXeXfE22/TRnBC4rsXKIRKIBq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Extend nolibc to target the 32-bit parisc architecture. 64-bit is not yet supported. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/Makefile | 2 +- tools/include/nolibc/arch-parisc.h | 178 +++++++++++++++++++++= ++++ tools/include/nolibc/arch.h | 2 + tools/testing/selftests/nolibc/Makefile.nolibc | 6 + tools/testing/selftests/nolibc/run-tests.sh | 4 +- 5 files changed, 190 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile index 7455097cff69..81187126bf93 100644 --- a/tools/include/nolibc/Makefile +++ b/tools/include/nolibc/Makefile @@ -17,7 +17,7 @@ endif # it defaults to this nolibc directory. OUTPUT ?=3D $(CURDIR)/ =20 -architectures :=3D arm arm64 loongarch m68k mips powerpc riscv s390 sh spa= rc x86 +architectures :=3D arm arm64 loongarch m68k mips parisc powerpc riscv s390= sh sparc x86 arch_files :=3D arch.h $(addsuffix .h, $(addprefix arch-, $(architectures)= )) all_files :=3D \ byteswap.h \ diff --git a/tools/include/nolibc/arch-parisc.h b/tools/include/nolibc/arch= -parisc.h new file mode 100644 index 000000000000..5918f45132bb --- /dev/null +++ b/tools/include/nolibc/arch-parisc.h @@ -0,0 +1,178 @@ +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ +/* + * parisc/hppa (32 and 64) specific definitions for NOLIBC + * Copyright (C) 2026 Thomas Wei=C3=9Fschuh + */ + +#ifndef _NOLIBC_ARCH_PARISC_H +#define _NOLIBC_ARCH_PARISC_H + +#if defined(__LP64__) +#error 64-bit not supported +#endif + +#include "compiler.h" +#include "crt.h" + +/* Syscalls for parisc : + * - syscall number is passed in r20 + * - arguments are in r26 to r21 + * - the system call is performed by calling "ble 0x100(%sr2, %r0)", + * the instruction after that is executed first, use it to load the nu= mber + * - syscall return comes in r28 + * - the arguments are cast to long and assigned into the target + * registers which are then simply passed as registers to the asm code, + * so that we don't have to experience issues with register constraint= s. + */ + +#define _NOLIBC_SYSCALL_CLOBBERLIST \ + "memory", "%r1", "%r2", "%r4", "%r20", "%r29", "%r31" + +#define __nolibc_syscall0(num) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %1, %%r20\n\t" \ + : "=3Dr"(_ret) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall1(num, arg1) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %2, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall2(num, arg1, arg2) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %3, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1), "+r"(_arg2) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall3(num, arg1, arg2, arg3) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %4, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall4(num, arg1, arg2, arg3, arg4) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %5, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall5(num, arg1, arg2, arg3, arg4, arg5) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r22") =3D (long)(arg5); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %6, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ + "+r"(_arg5) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#define __nolibc_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) = \ +({ = \ + register long _ret __asm__ ("r28"); \ + register long _arg1 __asm__ ("r26") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r25") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r24") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r23") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r22") =3D (long)(arg5); \ + register long _arg6 __asm__ ("r21") =3D (long)(arg6); \ + \ + __asm__ volatile ( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + "ldi %7, %%r20\n\t" \ + : "=3Dr"(_ret), \ + "+r"(_arg1), "+r"(_arg2), "+r"(_arg3), "+r"(_arg4), \ + "+r"(_arg5), "+r"(_arg6) \ + : "i"(num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _ret; \ +}) + +#ifndef NOLIBC_NO_RUNTIME +/* startup code */ +void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protec= tor _start(void) +{ + __asm__ volatile ( + ".import $global$\n" /* Set up the dp register */ + "ldil L%$global$, %dp\n" + "ldo R%$global$(%r27), %dp\n" + + "ldo -4(%r24), %r26\n" /* The sp register is special on parisc. + * r24 points to argv. Subtract 4 to get &argc. + * Pass that as first argument to _start_c. + */ + + "b,n _start_c\n" + ); + __nolibc_entrypoint_epilogue(); +} +#endif /* NOLIBC_NO_RUNTIME */ + +#endif /* _NOLIBC_ARCH_PARISC_H */ diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h index a3adaf433f2c..6dc45a78e972 100644 --- a/tools/include/nolibc/arch.h +++ b/tools/include/nolibc/arch.h @@ -28,6 +28,8 @@ #include "arch-m68k.h" #elif defined(__sh__) #include "arch-sh.h" +#elif defined(__hppa__) +#include "arch-parisc.h" #else #error Unsupported Architecture #endif diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing= /selftests/nolibc/Makefile.nolibc index f30bc68470cc..e9494f3cbc03 100644 --- a/tools/testing/selftests/nolibc/Makefile.nolibc +++ b/tools/testing/selftests/nolibc/Makefile.nolibc @@ -64,6 +64,7 @@ ARCH_s390x =3D s390 ARCH_sparc32 =3D sparc ARCH_sparc64 =3D sparc ARCH_sh4 =3D sh +ARCH_parisc32 =3D parisc ARCH :=3D $(or $(ARCH_$(XARCH)),$(XARCH)) =20 # kernel image names by architecture @@ -92,6 +93,7 @@ IMAGE_sparc32 =3D arch/sparc/boot/image IMAGE_sparc64 =3D arch/sparc/boot/image IMAGE_m68k =3D vmlinux IMAGE_sh4 =3D arch/sh/boot/zImage +IMAGE_parisc32 =3D vmlinux IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) =20 @@ -121,6 +123,7 @@ DEFCONFIG_sparc32 =3D sparc32_defconfig DEFCONFIG_sparc64 =3D sparc64_defconfig DEFCONFIG_m68k =3D virt_defconfig DEFCONFIG_sh4 =3D rts7751r2dplus_defconfig +DEFCONFIG_parisc32 =3D defconfig DEFCONFIG =3D $(DEFCONFIG_$(XARCH)) =20 EXTRACONFIG_x32 =3D -e CONFIG_X86_X32_ABI @@ -159,6 +162,7 @@ QEMU_ARCH_sparc32 =3D sparc QEMU_ARCH_sparc64 =3D sparc64 QEMU_ARCH_m68k =3D m68k QEMU_ARCH_sh4 =3D sh4 +QEMU_ARCH_parisc32 =3D hppa QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 QEMU_ARCH_USER_ppc64le =3D ppc64le @@ -199,6 +203,7 @@ QEMU_ARGS_sparc32 =3D -M SS-5 -m 256M -append "conso= le=3DttyS0,115200 panic=3D-1 $( QEMU_ARGS_sparc64 =3D -M sun4u -append "console=3DttyS0,115200 panic=3D= -1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_m68k =3D -M virt -append "console=3DttyGF0,115200 panic=3D= -1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_sh4 =3D -M r2d -serial file:/dev/stdout -append "console= =3DttySC1,115200 panic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_parisc32 =3D -append "console=3DttyS0 panic=3D-1 $(TEST:%=3DNO= LIBC_TEST=3D%)" QEMU_ARGS =3D -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(Q= EMU_ARGS_EXTRA) =20 # OUTPUT is only set when run from the main makefile, otherwise @@ -215,6 +220,7 @@ CFLAGS_i386 =3D $(call cc-option,-m32) CFLAGS_x32 =3D -mx32 CFLAGS_arm =3D -marm CFLAGS_armthumb =3D -mthumb -march=3Darmv6t2 +CFLAGS_parisc32 =3D -mfast-indirect-calls CFLAGS_ppc =3D -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 =3D -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le =3D -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=3D= elfv2) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/se= lftests/nolibc/run-tests.sh index 3917cfb8fdc4..981a680cebfb 100755 --- a/tools/testing/selftests/nolibc/run-tests.sh +++ b/tools/testing/selftests/nolibc/run-tests.sh @@ -28,6 +28,7 @@ all_archs=3D( sparc32 sparc64 m68k sh4 + parisc32 ) archs=3D"${all_archs[@]}" =20 @@ -116,6 +117,7 @@ crosstool_arch() { s390*) echo s390;; sparc*) echo sparc64;; x32*) echo x86_64;; + parisc32) echo hppa;; *) echo "$1";; esac } @@ -185,7 +187,7 @@ test_arch() { exit 1 esac printf '%-15s' "$arch:" - if [ "$arch" =3D "m68k" -o "$arch" =3D "sh4" ] && [ "$llvm" =3D "1" ]; th= en + if [ "$arch" =3D "m68k" -o "$arch" =3D "sh4" -o "$arch" =3D "parisc32" ] = && [ "$llvm" =3D "1" ]; then echo "Unsupported configuration" return fi --=20 2.53.0