All of lore.kernel.org
 help / color / mirror / Atom feed
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 5/6] x86/suspend: Expand macros in wakeup_prot.S
Date: Fri, 13 Dec 2019 19:04:35 +0000	[thread overview]
Message-ID: <20191213190436.24475-6-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com>

Most users have been dropped, and they do nothing but obfuscate the assembly.

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>
---
 xen/arch/x86/acpi/wakeup_prot.S | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index a81849fd2b..0ce96e26a9 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -2,14 +2,6 @@
         .text
         .code64
 
-#define GREG(x)         %r##x
-#define SAVED_GREG(x)   saved_r##x(%rip)
-#define DECLARE_GREG(x) saved_r##x:     .quad   0
-#define SAVE_GREG(x)    movq GREG(x), SAVED_GREG(x)
-#define LOAD_GREG(x)    movq SAVED_GREG(x), GREG(x)
-
-#define REF(x)          x(%rip)
-
 ENTRY(do_suspend_lowlevel)
         push    %rbp
         push    %rbx
@@ -18,10 +10,10 @@ ENTRY(do_suspend_lowlevel)
         push    %r14
         push    %r15
 
-        SAVE_GREG(sp)
+        mov     %rsp, saved_rsp(%rip)
 
-        mov     %cr0, GREG(ax)
-        mov     GREG(ax), REF(saved_cr0)
+        mov     %cr0, %rax
+        mov     %rax, saved_cr0(%rip)
 
         call    save_rest_processor_state
 
@@ -45,12 +37,12 @@ ENTRY(do_suspend_lowlevel)
 ENTRY(s3_resume)
         lgdt    boot_gdtr(%rip)
 
-        mov     REF(saved_cr0), GREG(ax)
-        mov     GREG(ax), %cr0
+        mov     saved_cr0(%rip), %rax
+        mov     %rax, %cr0
 
         mov     $__HYPERVISOR_DS64, %eax
         mov     %eax, %ss
-        LOAD_GREG(sp)
+        mov     saved_rsp(%rip), %rsp
 
         /* Reload code selector */
         pushq   $__HYPERVISOR_CS
@@ -73,10 +65,8 @@ ENTRY(s3_resume)
 .data
         .align 16
 
+saved_rsp:      .quad   0
+saved_cr0:      .quad   0
+
 GLOBAL(saved_magic)
         .long   0x9abcdef0
-
-        .align 8
-DECLARE_GREG(sp)
-
-saved_cr0:      .quad   0
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-12-13 21:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 19:04 [Xen-devel] [PATCH 0/6] x86/suspend: State cleanup Andrew Cooper
2019-12-13 19:04 ` [Xen-devel] [PATCH 1/6] x86/suspend: Clarify and improve the behaviour of do_suspend_lowlevel() Andrew Cooper
2019-12-16 17:24   ` Roger Pau Monné
2019-12-13 19:04 ` [Xen-devel] [PATCH 2/6] x86/suspend: Don't bother saving %cr3, %ss or flags Andrew Cooper
2019-12-17 11:52   ` Roger Pau Monné
2019-12-17 12:06     ` Andrew Cooper
2019-12-17 12:18       ` Roger Pau Monné
2019-12-17 12:26         ` Andrew Cooper
2019-12-17 15:10           ` Roger Pau Monné
2019-12-13 19:04 ` [Xen-devel] [PATCH 3/6] x86/suspend: Don't save unnecessary GPRs Andrew Cooper
2019-12-17 12:04   ` Roger Pau Monné
2019-12-17 12:10     ` Andrew Cooper
2019-12-17 12:13       ` Roger Pau Monné
2019-12-13 19:04 ` [Xen-devel] [PATCH 4/6] x86/suspend: Restore cr4 later during resume Andrew Cooper
2019-12-17 12:12   ` Roger Pau Monné
2019-12-13 19:04 ` Andrew Cooper [this message]
2019-12-17 12:32   ` [Xen-devel] [PATCH 5/6] x86/suspend: Expand macros in wakeup_prot.S Roger Pau Monné
2019-12-13 19:04 ` [Xen-devel] [PATCH 6/6] x86/suspend: Drop save_rest_processor_state() completely Andrew Cooper
2019-12-17 12:38   ` Roger Pau Monné
2019-12-17 20:37     ` Andrew Cooper
2019-12-17 16:17 ` [Xen-devel] [PATCH 0/6] x86/suspend: State cleanup Jan Beulich
2019-12-17 16:33   ` Andrew Cooper
2019-12-17 16:39     ` Jan Beulich
2019-12-18 11:39       ` Andrew Cooper
2019-12-18 11:52         ` 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=20191213190436.24475-6-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.