From: Pekka Enberg 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> 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]: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 In-Reply-To: <1313147226-12400-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org List-ID: 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 */ -- 1.7.0.4