]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Factor low level difference between PV and HVM into macros
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 24 Dec 2015 23:14:23 +0000 (23:14 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Jan 2016 18:59:25 +0000 (18:59 +0000)
to reduce code duplication when further entry/exit paths are added.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/entry_32.S
arch/x86/entry_64.S

index 7d3a1ad4538add9d0e6417e4aaaf4123579887a6..a22bce2d026df9d6b9144075b5435b4ed0952e9b 100644 (file)
@@ -22,6 +22,16 @@ containing the entry vector.
 
 */
 
+.macro env_IRET                 /* Environment specific version of `iret`. */
+#if defined(CONFIG_ENV_pv)
+
+        jmp HYPERCALL_iret      /* PV guests use the 'iret' hypercall. */
+
+#else
+        iret                    /* HVM guests use a real 'iret' instruction. */
+#endif
+.endm
+
 .macro exception_entry sym vec
 
 ENTRY(entry_\sym)
@@ -69,10 +79,4 @@ handle_exception:
         RESTORE_ALL
         add $8, %esp            /* Pop error_code/entry_vector. */
 
-#if defined(CONFIG_ENV_pv)
-
-        jmp HYPERCALL_iret      /* PV guests use the 'iret' hypercall. */
-
-#else
-        iret                    /* HVM guests use a real 'iret' instruction. */
-#endif
+        env_IRET
index dbfbb96b8d5f108f165f05ef9b6210880d90cff0..a0fb05879b22d5b087a5e6778c8448644e4253d6 100644 (file)
@@ -27,15 +27,29 @@ metadata.  Currently just the entry vector.
 
 */
 
-.macro exception_entry sym vec
-
-ENTRY(entry_\sym)
-
+.macro env_ADJUST_FRAME         /* Environment specific exception entry. */
 #if defined(CONFIG_ENV_pv64)
-        /* Restore results of Xen SYSRET'ing to this point. */
+                                /* Restore results of Xen SYSRET'ing to this point. */
         pop   %rcx
         pop   %r11
 #endif
+.endm
+
+.macro env_IRETQ                /* Environment specific version of `iretq`. */
+#if defined(CONFIG_ENV_pv64)
+
+        push $0                 /* Indicate that this isn't a SYSRET'able   */
+        jmp HYPERCALL_iret      /* situation, and use the 'iret' hypercall. */
+
+#else
+        iretq                   /* HVM guests use a real 'iretq' instruction. */
+#endif
+.endm
+
+.macro exception_entry sym vec
+
+ENTRY(entry_\sym)
+        env_ADJUST_FRAME
 
         .if !((1 << \vec) & X86_EXC_HAVE_EC)
         /* Push dummy error code (if needed) to align stack. */
@@ -79,11 +93,4 @@ handle_exception:
         RESTORE_ALL
         add $8, %rsp            /* Pop error_code/entry_vector. */
 
-#if defined(CONFIG_ENV_pv)
-
-        push $0                 /* Indicate that this isn't a SYSRET'able   */
-        jmp HYPERCALL_iret      /* situation, and use the 'iret' hypercall. */
-
-#else
-        iretq                   /* HVM guests use a real 'iret' instruction. */
-#endif
+        env_IRETQ