3 #include "kvm/segment.h"
7 #include <asm/processor-flags.h>
10 static inline void set_fs(u16 seg
)
12 asm volatile("movw %0,%%fs" : : "rm" (seg
));
15 static inline u8
rdfs8(unsigned long addr
)
19 asm volatile("addr32 movb %%fs:%1,%0" : "=q" (v
) : "m" (*(u8
*)addr
));
24 static inline u32
rdfs32(unsigned long addr
)
28 asm volatile("addr32 movl %%fs:%1,%0" : "=q" (v
) : "m" (*(u32
*)addr
));
33 bioscall
void e820_query_map(struct biosregs
*regs
)
40 e820
= (struct e820map
*)E820_MAP_START
;
41 fs_seg
= flat_to_seg16(E820_MAP_START
);
46 map_size
= rdfs32(flat_to_off16((u32
)&e820
->nr_map
, fs_seg
));
53 fs_seg
= flat_to_seg16(E820_MAP_START
);
56 start
= (u32
)&e820
->map
[ndx
];
58 p
= (void *) regs
->edi
;
60 for (i
= 0; i
< sizeof(struct e820entry
); i
++)
61 *p
++ = rdfs8(flat_to_off16(start
+ i
, fs_seg
));
65 regs
->ecx
= sizeof(struct e820entry
);
68 /* Clear CF to indicate success. */
69 regs
->eflags
&= ~X86_EFLAGS_CF
;
72 regs
->ebx
= 0; /* end of map */