From patchwork Fri Aug 12 11:07:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 1060772 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7CB7u8N032766 for ; Fri, 12 Aug 2011 11:07:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753432Ab1HLLHL (ORCPT ); Fri, 12 Aug 2011 07:07:11 -0400 Received: from filtteri2.pp.htv.fi ([213.243.153.185]:54578 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751471Ab1HLLHI (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 C44151DF124; 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 xbb4N5cbasxE; 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 84F775BC007; 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 5/8] kvm tools, bios: Use struct biosregs in E820 code Date: Fri, 12 Aug 2011 14:07:03 +0300 Message-Id: <1313147226-12400-5-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 (demeter2.kernel.org [140.211.167.43]); Fri, 12 Aug 2011 11:07:56 +0000 (UTC) This patch converts the E820 code to use 'struct biosregs' and {SAVE,RESTORE}_BIOSREGS macros. Cc: Cyrill Gorcunov Cc: Ingo Molnar Cc: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/bios/bios.S | 16 ++-------------- tools/kvm/bios/e820.c | 14 +++++++------- tools/kvm/include/kvm/e820.h | 10 ++-------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/tools/kvm/bios/bios.S b/tools/kvm/bios/bios.S index f3c6592..eed97a9 100644 --- a/tools/kvm/bios/bios.S +++ b/tools/kvm/bios/bios.S @@ -76,24 +76,12 @@ ENTRY(bios_int15) cmp $0xE820, %eax jne 1f - pushw %fs - - pushl %edx - pushl %ecx - pushl %edi - pushl %ebx - pushl %eax + SAVE_BIOSREGS movl %esp, %eax # it's bioscall case call e820_query_map - popl %eax - popl %ebx - popl %edi - popl %ecx - popl %edx - - popw %fs + RESTORE_BIOSREGS /* Clear CF to indicate success. */ andl $~EFLAGS_CF, 0x4(%esp) diff --git a/tools/kvm/bios/e820.c b/tools/kvm/bios/e820.c index b7fa4c1..b5e2188 100644 --- a/tools/kvm/bios/e820.c +++ b/tools/kvm/bios/e820.c @@ -29,7 +29,7 @@ static inline u32 rdfs32(unsigned long addr) return v; } -bioscall void e820_query_map(struct e820_query *query) +bioscall void e820_query_map(struct biosregs *regs) { struct e820map *e820; u32 map_size; @@ -40,7 +40,7 @@ bioscall void e820_query_map(struct e820_query *query) fs_seg = flat_to_seg16(E820_MAP_START); set_fs(fs_seg); - ndx = query->ebx; + ndx = regs->ebx; map_size = rdfs32(flat_to_off16((u32)&e820->nr_map, fs_seg)); @@ -54,16 +54,16 @@ bioscall void e820_query_map(struct e820_query *query) start = (u32)&e820->map[ndx]; - p = (void *) query->edi; + p = (void *) regs->edi; for (i = 0; i < sizeof(struct e820entry); i++) *p++ = rdfs8(flat_to_off16(start + i, fs_seg)); } - query->eax = SMAP; - query->ecx = sizeof(struct e820entry); - query->ebx = ++ndx; + regs->eax = SMAP; + regs->ecx = sizeof(struct e820entry); + regs->ebx = ++ndx; if (ndx >= map_size) - query->ebx = 0; /* end of map */ + regs->ebx = 0; /* end of map */ } diff --git a/tools/kvm/include/kvm/e820.h b/tools/kvm/include/kvm/e820.h index 9b339ed..d23c177 100644 --- a/tools/kvm/include/kvm/e820.h +++ b/tools/kvm/include/kvm/e820.h @@ -5,14 +5,8 @@ #define SMAP 0x534d4150 /* ASCII "SMAP" */ -struct e820_query { - u32 eax; - u32 ebx; - u32 edi; - u32 ecx; - u32 edx; -}; +struct biosregs; -void e820_query_map(struct e820_query *query); +void e820_query_map(struct biosregs *regs); #endif /* KVM_E820_H */