All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 6/7] x86/asm: Fold LOAD_C_CLOBBERED into RESTORE_ALL
Date: Tue, 2 May 2017 19:05:25 +0100	[thread overview]
Message-ID: <1493748326-9582-7-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1493748326-9582-1-git-send-email-andrew.cooper3@citrix.com>

With its sole other user removed, fold LOAD_C_CLOBBERED into RESTORE_ALL to
reduce the cognitive load of trying to work out which registers get modified.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
 xen/include/asm-x86/asm_defns.h | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index f1c6fa1..11306d1 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -321,40 +321,25 @@ static always_inline void stac(void)
 .endif
 
 /*
- * Reload registers not preserved by C code from frame.
- *
- * @compat: R8-R11 don't need reloading
+ * Restore all previously saved registers.
  *
- * For the way it is used in RESTORE_ALL, this macro must preserve EFLAGS.ZF.
+ * @adj: extra stack pointer adjustment to be folded into the adjustment done
+ *       anyway at the end of the macro
+ * @compat: R8-R15 don't need reloading
  */
-.macro LOAD_C_CLOBBERED compat=0 ax=1
+.macro RESTORE_ALL adj=0 compat=0
 .if !\compat
+        testl $TRAP_regs_dirty,UREGS_entry_vector(%rsp)
         movq  UREGS_r11(%rsp),%r11
         movq  UREGS_r10(%rsp),%r10
         movq  UREGS_r9(%rsp),%r9
         movq  UREGS_r8(%rsp),%r8
 .endif
-.if \ax
         LOAD_ONE_REG(ax, \compat)
-.endif
         LOAD_ONE_REG(cx, \compat)
         LOAD_ONE_REG(dx, \compat)
         LOAD_ONE_REG(si, \compat)
         LOAD_ONE_REG(di, \compat)
-.endm
-
-/*
- * Restore all previously saved registers.
- *
- * @adj: extra stack pointer adjustment to be folded into the adjustment done
- *       anyway at the end of the macro
- * @compat: R8-R15 don't need reloading
- */
-.macro RESTORE_ALL adj=0 compat=0
-.if !\compat
-        testl $TRAP_regs_dirty,UREGS_entry_vector(%rsp)
-.endif
-        LOAD_C_CLOBBERED \compat
 .if !\compat
         jz    987f
         movq  UREGS_r15(%rsp),%r15
-- 
2.1.4


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

  parent reply	other threads:[~2017-05-02 18:05 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 18:05 [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-02 18:05 ` [PATCH 1/7] x86/traps: Drop 32bit fields out of tss_struct Andrew Cooper
2017-05-03  8:10   ` Jan Beulich
2017-05-03 12:33     ` Andrew Cooper
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 2/7] x86/traps: Poison unused stack pointers in the TSS Andrew Cooper
2017-05-03  8:14   ` Jan Beulich
2017-05-03 12:47     ` Andrew Cooper
2017-05-03 13:29   ` [PATCH v2 " Andrew Cooper
2017-05-03 13:45     ` Jan Beulich
2017-05-02 18:05 ` [PATCH 3/7] x86/mm: Further restrict permissions on some virtual mappings Andrew Cooper
2017-05-03  8:49   ` Jan Beulich
2017-05-03 13:38     ` Andrew Cooper
2017-05-03 13:48       ` Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-03 10:11   ` Tim Deegan
2017-05-03 11:13   ` George Dunlap
2017-05-02 18:05 ` [PATCH 4/7] x86/traps: Rename compat_hypercall() to entry_int82() Andrew Cooper
2017-05-03  8:55   ` Jan Beulich
2017-05-03 13:41     ` Andrew Cooper
2017-05-02 18:05 ` [PATCH 5/7] x86/traps: Lift all non-entrypoint logic in entry_int82() up into C Andrew Cooper
2017-05-03  9:02   ` Jan Beulich
2017-05-03 11:26     ` Wei Liu
2017-05-03 11:38       ` Andrew Cooper
2017-05-03 11:43         ` Wei Liu
2017-05-03 12:02         ` Jan Beulich
2017-05-03 12:18           ` Andrew Cooper
2017-05-03 12:37             ` Jan Beulich
2017-05-03 18:29               ` Andrew Cooper
2017-05-04  7:27                 ` Jan Beulich
2017-05-04  9:27                   ` Andrew Cooper
2017-05-04  9:36                     ` Jan Beulich
2017-05-04  9:57                       ` Andrew Cooper
2017-05-03 12:00       ` Jan Beulich
2017-05-04 10:01     ` [PATCH v2 " Andrew Cooper
2017-05-04 10:16       ` Andrew Cooper
2017-05-04 10:28         ` Jan Beulich
2017-05-04 11:09           ` Andrew Cooper
2017-05-04 10:22       ` Jan Beulich
2017-05-02 18:05 ` Andrew Cooper [this message]
2017-05-03  9:08   ` [PATCH 6/7] x86/asm: Fold LOAD_C_CLOBBERED into RESTORE_ALL Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 7/7] x86/asm: Clobber %r{8..15} on exit to 32bit PV guests Andrew Cooper
2017-05-03  9:13   ` Jan Beulich
2017-05-03 17:51     ` [PATCH v2 " Andrew Cooper
2017-05-04  8:50       ` Jan Beulich
2017-05-04 11:11 ` [RFC for 4.9] [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-04 12:52   ` Julien Grall

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=1493748326-9582-7-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.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.