1 
2 #ifndef __ARCH_LDT_H
3 #define __ARCH_LDT_H
4 
5 #ifndef __ASSEMBLY__
6 
load_LDT(struct vcpu * v)7 static inline void load_LDT(struct vcpu *v)
8 {
9     struct desc_struct *desc;
10     unsigned long ents;
11 
12     if ( (ents = v->arch.pv_vcpu.ldt_ents) == 0 )
13     {
14         __asm__ __volatile__ ( "lldt %%ax" : : "a" (0) );
15     }
16     else
17     {
18         desc = (!is_pv_32bit_vcpu(v)
19                 ? this_cpu(gdt_table) : this_cpu(compat_gdt_table))
20                + LDT_ENTRY - FIRST_RESERVED_GDT_ENTRY;
21         _set_tssldt_desc(desc, LDT_VIRT_START(v), ents*8-1, SYS_DESC_ldt);
22         __asm__ __volatile__ ( "lldt %%ax" : : "a" (LDT_ENTRY << 3) );
23     }
24 }
25 
26 #endif /* !__ASSEMBLY__ */
27 
28 #endif
29 
30 /*
31  * Local variables:
32  * mode: C
33  * c-file-style: "BSD"
34  * c-basic-offset: 4
35  * tab-width: 4
36  * indent-tabs-mode: nil
37  * End:
38  */
39