From: Alexey Dobriyan <adobriyan@gmail.com>
To: "Willy Tarreau" <w@1wt.eu>, "Thomas Weißschuh" <linux@weissschuh.net>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] nolibc: optimise _start() on x86_64
Date: Sat, 2 Dec 2023 15:45:13 +0300 [thread overview]
Message-ID: <38183c29-9b7f-4960-8702-d71ce816cf80@p183> (raw)
Just jump into _start_c, it is not going to return anyway.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
Also, kernel clears all registers before starting process,
I'm not sure why
xor ebp, ebp
was added.
tools/include/nolibc/arch-x86_64.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/tools/include/nolibc/arch-x86_64.h
+++ b/tools/include/nolibc/arch-x86_64.h
@@ -167,8 +167,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
"xor %ebp, %ebp\n" /* zero the stack frame */
"mov %rsp, %rdi\n" /* save stack pointer to %rdi, as arg1 of _start_c */
"and $-16, %rsp\n" /* %rsp must be 16-byte aligned before call */
- "call _start_c\n" /* transfer to c runtime */
- "hlt\n" /* ensure it does not return */
+ "jmp _start_c\n" /* transfer to c runtime */
);
__builtin_unreachable();
}
next reply other threads:[~2023-12-02 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-02 12:45 Alexey Dobriyan [this message]
2023-12-02 13:23 ` Willy Tarreau
2023-12-03 12:00 ` Alexey Dobriyan
2023-12-03 21:37 ` 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=38183c29-9b7f-4960-8702-d71ce816cf80@p183 \
--to=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=w@1wt.eu \
/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®