From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86/boot: Simplify BSS zeroing
Date: Wed, 8 Jan 2020 13:22:41 +0000 [thread overview]
Message-ID: <20200108132241.8564-1-andrew.cooper3@citrix.com> (raw)
There is no need to load a non-flat %es to zero the BSS. Use sym_esi()
instead, which is easier to follow, faster (avoids two segment loads) and
doesn't require use of the stack.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
Looking through the code, almost everything that uses sym_fs() would be better
using sym_esi(). It is unnecessary extra instruction stream bytes, and AGU
hit for every memory operand.
Most importantly however, the code is far more simple to reason about when it
is consitent about being flat, rather than mixing and matching between flat
and non-flat views of the same memory.
---
xen/arch/x86/boot/head.S | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 82395e91dd..1b729c37f8 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -617,16 +617,12 @@ trampoline_setup:
jnz 1f
/* Initialize BSS (no nasty surprises!). */
- mov $sym_offs(__bss_start),%edi
- mov $sym_offs(__bss_end),%ecx
- push %fs
- pop %es
+ lea sym_esi(__bss_start), %edi
+ lea sym_esi(__bss_end), %ecx
sub %edi,%ecx
xor %eax,%eax
shr $2,%ecx
rep stosl
- push %ds
- pop %es
1:
/* Interrogate CPU extended features via CPUID. */
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2020-01-08 13:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 13:22 Andrew Cooper [this message]
2020-01-08 13:29 ` [Xen-devel] [PATCH] x86/boot: Simplify BSS zeroing Jan Beulich
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=20200108132241.8564-1-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.