public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nolibc: optimise _start() on x86_64
@ 2023-12-02 12:45 Alexey Dobriyan
  2023-12-02 13:23 ` Willy Tarreau
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2023-12-02 12:45 UTC (permalink / raw)
  To: Willy Tarreau, Thomas Weißschuh; +Cc: linux-kernel

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();
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-03 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-02 12:45 [PATCH] nolibc: optimise _start() on x86_64 Alexey Dobriyan
2023-12-02 13:23 ` Willy Tarreau
2023-12-03 12:00   ` Alexey Dobriyan
2023-12-03 21:37     ` Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox