This patch adds SAVE_BIOSREGS and RESTORE_BIOSREGS macros in preparation for
using struct biosregs in E820 code.

Cc: Cyrill Gorcunov <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
---
 tools/kvm/bios/bios.S |   51 ++++++++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/tools/kvm/bios/bios.S b/tools/kvm/bios/bios.S
index 4f82126..75d31fd 100644
--- a/tools/kvm/bios/bios.S
+++ b/tools/kvm/bios/bios.S
@@ -8,9 +8,36 @@
        .org 0
        .code16gcc
 
+#define EFLAGS_CF      (1 << 0)
+
 #include "macro.S"
 
-#define EFLAGS_CF      (1 << 0)
+/* If you change these macros, remember to update 'struct biosregs' */
+.macro SAVE_BIOSREGS
+       pushw   %fs
+       pushl   %es
+       pushl   %edi
+       pushl   %esi
+       pushl   %ebp
+       pushl   %esp
+       pushl   %edx
+       pushl   %ecx
+       pushl   %ebx
+       pushl   %eax
+.endm
+
+.macro RESTORE_BIOSREGS
+       popl    %eax
+       popl    %ebx
+       popl    %ecx
+       popl    %edx
+       popl    %esp
+       popl    %ebp
+       popl    %esi
+       popl    %edi
+       popl    %es
+       popw    %fs
+.endm
 
 /*
  * fake interrupt handler, nothing can be faster ever
@@ -30,32 +57,14 @@ ENTRY_END(bios_intfake)
  * int 10 - video - service
  */
 ENTRY(bios_int10)
-       pushw   %fs
-       pushl   %es
-       pushl   %edi
-       pushl   %esi
-       pushl   %ebp
-       pushl   %esp
-       pushl   %edx
-       pushl   %ecx
-       pushl   %ebx
-       pushl   %eax
+       SAVE_BIOSREGS
 
        movl            %esp, %eax
        /* this is way easier than doing it in assembly */
        /* just push all the regs and jump to a C handler */
        call    int10_handler
 
-       popl    %eax
-       popl    %ebx
-       popl    %ecx
-       popl    %edx
-       popl    %esp
-       popl    %ebp
-       popl    %esi
-       popl    %edi
-       popl    %es
-       popw    %fs
+       RESTORE_BIOSREGS
 
        /* Clear CF to indicate success.  */
        andl    $~EFLAGS_CF, 0x4(%esp)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to