[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] mini-os: cleanup x86_64.S



On 26/08/16 15:35, Juergen Gross wrote:
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@xxxxxxxx>
---
  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 */iwt

I know this is just moving code, but I would recommend switching to a pop %rcx; pop %r11, which is shorter and more efficient.

It also plays better in the stack engine with the adjacent pushes/pops.

~Andrew

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.