From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
samuel.thibault@ens-lyon.org, wei.liu2@citrix.com
Subject: [PATCH 2/3] mini-os: cleanup x86_64.S
Date: Fri, 26 Aug 2016 16:35:35 +0200 [thread overview]
Message-ID: <1472222136-1177-3-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1472222136-1177-1-git-send-email-jgross@suse.com>
arch/x86/x86_64.S contains some unnecessary macros. Remove them.
Add a SAVE_PARAVIRT macro for saving %rcx and %r11 on the stack in
case of CONFIG_PARAVIRT defined.
Remove the parameter from HYPERVISOR_IRET macro as it is used with
0 only.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/x86_64.S | 44 ++++++++++++++++----------------------------
1 file changed, 16 insertions(+), 28 deletions(-)
diff --git a/arch/x86/x86_64.S b/arch/x86/x86_64.S
index 2046187..3a7116f 100644
--- a/arch/x86/x86_64.S
+++ b/arch/x86/x86_64.S
@@ -45,21 +45,10 @@ hypercall_page:
#define XEN_GET_VCPU_INFO(reg) movq HYPERVISOR_shared_info,reg
-#define XEN_PUT_VCPU_INFO(reg)
-#define XEN_PUT_VCPU_INFO_fixup
#define XEN_LOCKED_BLOCK_EVENTS(reg) movb $1,evtchn_upcall_mask(reg)
#define XEN_LOCKED_UNBLOCK_EVENTS(reg) movb $0,evtchn_upcall_mask(reg)
#define XEN_TEST_PENDING(reg) testb $0xFF,evtchn_upcall_pending(reg)
-#define XEN_BLOCK_EVENTS(reg) XEN_GET_VCPU_INFO(reg) ; \
- XEN_LOCKED_BLOCK_EVENTS(reg) ; \
- XEN_PUT_VCPU_INFO(reg)
-
-#define XEN_UNBLOCK_EVENTS(reg) XEN_GET_VCPU_INFO(reg) ; \
- XEN_LOCKED_UNBLOCK_EVENTS(reg) ; \
- XEN_PUT_VCPU_INFO(reg)
-
-
/* Offsets into shared_info_t. */
#define evtchn_upcall_pending /* 0 */
#define evtchn_upcall_mask 1
@@ -77,12 +66,16 @@ KERNEL_CS_MASK = 0xfc
/* Macros */
+.macro SAVE_PARAVIRT
+#ifdef CONFIG_PARAVIRT
+ movq (%rsp),%rcx
+ movq 8(%rsp),%r11
+ addq $0x10,%rsp /* rsp points to the error code */
+#endif
+.endm
+
.macro zeroentry sym
-#ifdef CONFIG_PARAVIRT
- movq (%rsp),%rcx
- movq 8(%rsp),%r11
- addq $0x10,%rsp /* skip rcx and r11 */
-#endif
+ SAVE_PARAVIRT
pushq $0 /* push error code/oldrax */
pushq %rax /* push real oldrax to the rdi slot */
leaq \sym(%rip),%rax
@@ -90,11 +83,7 @@ KERNEL_CS_MASK = 0xfc
.endm
.macro errorentry sym
-#ifdef CONFIG_PARAVIRT
- movq (%rsp),%rcx
- movq 8(%rsp),%r11
- addq $0x10,%rsp /* rsp points to the error code */
-#endif
+ SAVE_PARAVIRT
pushq %rax
leaq \sym(%rip),%rax
jmp error_entry
@@ -141,7 +130,7 @@ KERNEL_CS_MASK = 0xfc
movq %rdi, RDI(%rsp) /* put rdi into the slot */
.endm
-.macro HYPERVISOR_IRET flag
+.macro HYPERVISOR_IRET
#ifdef CONFIG_PARAVIRT
testl $NMI_MASK,2*8(%rsp)
jnz 2f
@@ -155,7 +144,7 @@ KERNEL_CS_MASK = 0xfc
#ifdef CONFIG_PARAVIRT
2: /* Slow iret via hypervisor. */
andl $~NMI_MASK, 16(%rsp)
- pushq $\flag
+ pushq $0
jmp hypercall_page + (__HYPERVISOR_iret * 32)
#endif
.endm
@@ -207,17 +196,16 @@ error_exit:
andb evtchn_upcall_mask(%rsi),%al
andb $1,%al # EAX[0] == IRET_RFLAGS.IF & event_mask
jnz restore_all_enable_events # != 0 => enable event delivery
- XEN_PUT_VCPU_INFO(%rsi)
RESTORE_ALL
- HYPERVISOR_IRET 0
+ HYPERVISOR_IRET
restore_all_enable_events:
RESTORE_ALL
pushq %rax # save rax for it will be clobbered later
RSP_OFFSET=8 # record the stack frame layout changes
XEN_GET_VCPU_INFO(%rax) # safe to use rax since it is saved
- XEN_UNBLOCK_EVENTS(%rax)
+ XEN_LOCKED_UNBLOCK_EVENTS(%rax)
scrit: /**** START OF CRITICAL REGION ****/
XEN_TEST_PENDING(%rax)
@@ -229,7 +217,7 @@ scrit: /**** START OF CRITICAL REGION ****/
restore_end:
jnz hypervisor_prologue # safe to jump out of critical region
# because events are masked if ZF = 0
- HYPERVISOR_IRET 0
+ HYPERVISOR_IRET
ecrit: /**** END OF CRITICAL REGION ****/
# Set up the stack as Xen does before calling event callback
@@ -278,7 +266,7 @@ critical_region_fixup:
#else
error_exit:
RESTORE_ALL
- HYPERVISOR_IRET 0
+ HYPERVISOR_IRET
/*
* Xen event (virtual interrupt) entry point.
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-26 14:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 14:35 [PATCH 0/3] mini-os: some cleanups Juergen Gross
2016-08-26 14:35 ` [PATCH 1/3] mini-os: cleanup x86_32.S Juergen Gross
2016-08-26 17:33 ` Samuel Thibault
2016-08-26 14:35 ` Juergen Gross [this message]
2016-08-26 14:46 ` [PATCH 2/3] mini-os: cleanup x86_64.S Andrew Cooper
2016-08-26 14:54 ` Juergen Gross
2016-08-26 14:35 ` [PATCH 3/3] mini-os: remove unused functions from sched.c Juergen Gross
2016-08-26 17:34 ` Samuel Thibault
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=1472222136-1177-3-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=minios-devel@lists.xenproject.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=wei.liu2@citrix.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).