From: Willy Tarreau <w@1wt.eu>
To: "Paul E . McKenney" <paulmck@kernel.org>
Cc: Ammar Faizi <ammar.faizi@students.amikom.ac.id>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] tools/nolibc: x86-64: Use `mov $60,%eax` instead of `mov $60,%rax`
Date: Sun, 24 Oct 2021 19:43:22 +0200 [thread overview]
Message-ID: <20211024174323.18338-3-w@1wt.eu> (raw)
In-Reply-To: <20211024174323.18338-1-w@1wt.eu>
From: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
Note that mov to 32-bit register will zero extend to 64-bit register.
Thus `mov $60,%eax` has the same effect with `mov $60,%rax`. Use the
shorter opcode to achieve the same thing.
```
b8 3c 00 00 00 mov $60,%eax (5 bytes) [1]
48 c7 c0 3c 00 00 00 mov $60,%rax (7 bytes) [2]
```
Currently, we use [2]. Change it to [1] for shorter code.
Signed-off-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
tools/include/nolibc/nolibc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index f9afe89ec6f2..4988866af0b5 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -420,7 +420,7 @@ asm(".section .text\n"
"and $-16, %rsp\n" // x86 ABI : esp must be 16-byte aligned before call
"call main\n" // main() returns the status code, we'll exit with it.
"mov %eax, %edi\n" // retrieve exit code (32 bit)
- "mov $60, %rax\n" // NR_exit == 60
+ "mov $60, %eax\n" // NR_exit == 60
"syscall\n" // really exit
"hlt\n" // ensure it does not return
"");
--
2.17.5
next prev parent reply other threads:[~2021-10-24 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 17:43 [PATCH 0/3] nolibc updates and cleanups Willy Tarreau
2021-10-24 17:43 ` [PATCH 1/3] tools/nolibc: x86: Remove `r8`, `r9` and `r10` from the clobber list Willy Tarreau
2021-10-24 17:43 ` Willy Tarreau [this message]
2021-10-24 17:43 ` [PATCH 3/3] tools/nolibc: Implement gettid() 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=20211024174323.18338-3-w@1wt.eu \
--to=w@1wt.eu \
--cc=ammar.faizi@students.amikom.ac.id \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
/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®