From: Pekka Enberg Subject: [PATCH 3/8] kvm tools, bios: Add macros for BIOS registers Date: Fri, 12 Aug 2011 14:07:01 +0300 Message-ID: <1313147226-12400-3-git-send-email-penberg@kernel.org> References: <1313147226-12400-1-git-send-email-penberg@kernel.org> Cc: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar , Sasha Levin To: kvm@vger.kernel.org Return-path: Received: from filtteri2.pp.htv.fi ([213.243.153.185]:54575 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987Ab1HLLHI (ORCPT ); Fri, 12 Aug 2011 07:07:08 -0400 In-Reply-To: <1313147226-12400-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org List-ID: This patch adds SAVE_BIOSREGS and RESTORE_BIOSREGS macros in preparation for using struct biosregs in E820 code. Cc: Cyrill Gorcunov Cc: Ingo Molnar Cc: Sasha Levin Signed-off-by: Pekka Enberg --- 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