@@ -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)
@@ -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 */
}
@@ -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 */
This patch converts the E820 code to use 'struct biosregs' and {SAVE,RESTORE}_BIOSREGS macros. Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org> --- 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(-)