@@ -273,15 +273,15 @@ static void lguest_load_idt(const struct desc_ptr *desc)
273273 * controls the entire thing and the Guest asks it to make changes using the
274274 * LOAD_GDT hypercall.
275275 *
276- * This is the opposite of the IDT code where we have a LOAD_IDT_ENTRY
277- * hypercall and use that repeatedly to load a new IDT. I don't think it
278- * really matters, but wouldn't it be nice if they were the same? Wouldn't
279- * it be even better if you were the one to send the patch to fix it?
276+ * This is the exactly like the IDT code.
280277 */
281278static void lguest_load_gdt (const struct desc_ptr * desc )
282279{
283- BUG_ON ((desc -> size + 1 ) / 8 != GDT_ENTRIES );
284- kvm_hypercall2 (LHCALL_LOAD_GDT , __pa (desc -> address ), GDT_ENTRIES );
280+ unsigned int i ;
281+ struct desc_struct * gdt = (void * )desc -> address ;
282+
283+ for (i = 0 ; i < (desc -> size + 1 )/8 ; i ++ )
284+ kvm_hypercall3 (LHCALL_LOAD_GDT_ENTRY , i , gdt [i ].a , gdt [i ].b );
285285}
286286
287287/* For a single GDT entry which changes, we do the lazy thing: alter our GDT,
@@ -291,7 +291,9 @@ static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum,
291291 const void * desc , int type )
292292{
293293 native_write_gdt_entry (dt , entrynum , desc , type );
294- kvm_hypercall2 (LHCALL_LOAD_GDT , __pa (dt ), GDT_ENTRIES );
294+ /* Tell Host about this new entry. */
295+ kvm_hypercall3 (LHCALL_LOAD_GDT_ENTRY , entrynum ,
296+ dt [entrynum ].a , dt [entrynum ].b );
295297}
296298
297299/* OK, I lied. There are three "thread local storage" GDT entries which change
0 commit comments