[PATCH 5/8] kvm tools, bios: Use struct biosregs in E820 code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch converts the E820 code to use 'struct biosregs' and
{SAVE,RESTORE}_BIOSREGS macros.

Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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

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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux