kvm tools, bios: Use struct biosregs in E820 code

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>
This commit is contained in:
Pekka Enberg
2015-06-01 16:39:47 +01:00
committed by Will Deacon
parent 193d20307f
commit 8f8e05485a
3 changed files with 11 additions and 29 deletions
+2 -14
View File
@@ -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)
+7 -7
View File
@@ -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 */
}
+2 -8
View File
@@ -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 */