From patchwork Fri Aug 12 11:07:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 1060722 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7CB7NaQ026201 for ; Fri, 12 Aug 2011 11:07:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194Ab1HLLHJ (ORCPT ); Fri, 12 Aug 2011 07:07:09 -0400 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 Received: from localhost (localhost [127.0.0.1]) by filtteri2.pp.htv.fi (Postfix) with ESMTP id A32431DF121; Fri, 12 Aug 2011 14:07:07 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp5.welho.com ([213.243.153.39]) by localhost (filtteri2.pp.htv.fi [213.243.153.185]) (amavisd-new, port 10024) with ESMTP id S6vTj5OzUOJF; Fri, 12 Aug 2011 14:07:07 +0300 (EEST) Received: from localhost.localdomain (cs181136138.pp.htv.fi [82.181.136.138]) by smtp5.welho.com (Postfix) with ESMTP id 52AA75BC008; Fri, 12 Aug 2011 14:07:07 +0300 (EEST) From: Pekka Enberg To: kvm@vger.kernel.org Cc: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar , Sasha Levin 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> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1313147226-12400-1-git-send-email-penberg@kernel.org> References: <1313147226-12400-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 12 Aug 2011 11:07:23 +0000 (UTC) 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)