From: Willy Tarreau <w@1wt.eu>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: linux-kernel@vger.kernel.org, Sven Schnelle <svens@linux.ibm.com>,
Willy Tarreau <w@1wt.eu>
Subject: [PATCH 19/22] tools/nolibc: add auxiliary vector retrieval for s390
Date: Mon, 9 Jan 2023 09:42:05 +0100 [thread overview]
Message-ID: <20230109084208.27355-20-w@1wt.eu> (raw)
In-Reply-To: <20230109084208.27355-1-w@1wt.eu>
From: Sven Schnelle <svens@linux.ibm.com>
In the _start block we now iterate over envp to find the auxiliary
vector after the NULL. The pointer is saved into an _auxv variable
that is marked as weak so that it's accessible from multiple units.
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
tools/include/nolibc/arch-s390.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h
index 039b454e79f0..6b0e54ed543d 100644
--- a/tools/include/nolibc/arch-s390.h
+++ b/tools/include/nolibc/arch-s390.h
@@ -160,6 +160,7 @@ struct sys_stat_struct {
})
char **environ __attribute__((weak));
+const unsigned long *_auxv __attribute__((weak));
/* startup code */
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
@@ -179,6 +180,15 @@ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
"larl %r1,environ\n"
"stg %r4,0(%r1)\n"
+ /* search for auxv */
+ "lgr %r5,%r4\n" /* start at envp */
+ "1:\n"
+ "clg %r0,0(%r5)\n" /* entry zero? */
+ "la %r5,8(%r5)\n" /* advance pointer */
+ "jnz 1b\n" /* no -> test next pointer */
+ "larl %r1,_auxv\n" /* yes -> store value in _auxv */
+ "stg %r5,0(%r1)\n"
+
"aghi %r15,-160\n" /* allocate new stackframe */
"xc 0(8,%r15),0(%r15)\n" /* clear backchain */
"brasl %r14,main\n" /* ret value of main is arg to exit */
--
2.17.5
next prev parent reply other threads:[~2023-01-09 8:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 8:41 [PATCH 00/22] nolibc: usability improvements (errno, environ, auxv) Willy Tarreau
2023-01-09 8:41 ` [PATCH 01/22] tools/nolibc: make compiler and assembler agree on the section around _start Willy Tarreau
2023-01-09 8:41 ` [PATCH 02/22] tools/nolibc: enable support for thumb1 mode for ARM Willy Tarreau
2023-01-09 8:41 ` [PATCH 03/22] tools/nolibc: support thumb mode with frame pointers on ARM Willy Tarreau
2023-01-09 8:41 ` [PATCH 04/22] tools/nolibc: remove local definitions of O_* flags for open/fcntl Willy Tarreau
2023-01-09 8:41 ` [PATCH 05/22] tools/nolibc: make errno a weak symbol instead of a static one Willy Tarreau
2023-01-09 8:41 ` [PATCH 06/22] tools/nolibc: export environ as a weak symbol on x86_64 Willy Tarreau
2023-01-09 8:41 ` [PATCH 07/22] tools/nolibc: export environ as a weak symbol on i386 Willy Tarreau
2023-01-09 8:41 ` [PATCH 08/22] tools/nolibc: export environ as a weak symbol on arm64 Willy Tarreau
2023-01-09 8:41 ` [PATCH 09/22] tools/nolibc: export environ as a weak symbol on arm Willy Tarreau
2023-01-09 8:41 ` [PATCH 10/22] tools/nolibc: export environ as a weak symbol on mips Willy Tarreau
2023-01-09 8:41 ` [PATCH 11/22] tools/nolibc: export environ as a weak symbol on riscv Willy Tarreau
2023-01-09 8:41 ` [PATCH 12/22] tools/nolibc: export environ as a weak symbol on s390 Willy Tarreau
2023-01-09 8:41 ` [PATCH 13/22] tools/nolibc: add auxiliary vector retrieval for i386 Willy Tarreau
2023-01-09 8:42 ` [PATCH 14/22] tools/nolibc: add auxiliary vector retrieval for x86_64 Willy Tarreau
2023-01-09 8:42 ` [PATCH 15/22] tools/nolibc: add auxiliary vector retrieval for arm64 Willy Tarreau
2023-01-09 8:42 ` [PATCH 16/22] tools/nolibc: add auxiliary vector retrieval for arm Willy Tarreau
2023-01-09 8:42 ` [PATCH 17/22] tools/nolibc: add auxiliary vector retrieval for riscv Willy Tarreau
2023-01-09 8:42 ` [PATCH 18/22] tools/nolibc: add auxiliary vector retrieval for mips Willy Tarreau
2023-01-09 8:42 ` Willy Tarreau [this message]
2023-01-09 8:42 ` [PATCH 20/22] nolibc/stdlib: Implement `getauxval(3)` function Willy Tarreau
2023-01-09 8:42 ` [PATCH 21/22] nolibc/sys: Implement `getpagesize(2)` function Willy Tarreau
2023-01-09 8:42 ` [PATCH 22/22] selftests/nolibc: Add `getpagesize(2)` selftest Willy Tarreau
2023-01-09 9:15 ` [PATCH 00/22] nolibc: usability improvements (errno, environ, auxv) Ammar Faizi
2023-01-09 9:17 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230109084208.27355-20-w@1wt.eu \
--to=w@1wt.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®