[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86: Switch "struct desc_struct" to being seg_desc_t
commit 95efc483ed1368b5c65c7b8486a18f5b7757d25a Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Dec 6 14:05:29 2018 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Dec 10 15:43:25 2018 +0000 x86: Switch "struct desc_struct" to being seg_desc_t The struct suffix is redundant in the name, and a future change will want to turn it into a union, rather than a structure. As this represents a segment descriptor, give it an appropriate typedef. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/cpu/common.c | 4 ++-- xen/arch/x86/domain.c | 2 +- xen/arch/x86/hvm/hvm.c | 4 ++-- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/mm.c | 2 +- xen/arch/x86/pv/descriptor-tables.c | 6 +++--- xen/arch/x86/pv/emul-gate-op.c | 4 ++-- xen/arch/x86/pv/emulate.c | 2 +- xen/arch/x86/pv/emulate.h | 4 ++-- xen/arch/x86/smpboot.c | 2 +- xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/mm.c | 2 +- xen/include/asm-x86/desc.h | 14 +++++++------- xen/include/asm-x86/ldt.h | 2 +- xen/include/asm-x86/mm.h | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 90f4a9b0b6..de6c5c903f 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -724,9 +724,9 @@ void load_system_tables(void) stack_top = stack_bottom & ~(STACK_SIZE - 1); struct tss_struct *tss = &this_cpu(init_tss); - struct desc_struct *gdt = + seg_desc_t *gdt = this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY; - struct desc_struct *compat_gdt = + seg_desc_t *compat_gdt = this_cpu(compat_gdt_table) - FIRST_RESERVED_GDT_ENTRY; const struct desc_ptr gdtr = { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index b4d59487ad..f0e0cdbb0e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1665,7 +1665,7 @@ static void __context_switch(void) struct vcpu *p = per_cpu(curr_vcpu, cpu); struct vcpu *n = current; struct domain *pd = p->domain, *nd = n->domain; - struct desc_struct *gdt; + seg_desc_t *gdt; struct desc_ptr gdt_desc; ASSERT(p != n); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 0039e8cf38..d64b6b6c20 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2695,7 +2695,7 @@ static int task_switch_load_seg( enum x86_segment seg, uint16_t sel, unsigned int cpl, unsigned int eflags) { struct segment_register desctab, segr; - struct desc_struct *pdesc = NULL, desc; + seg_desc_t *pdesc = NULL, desc; u8 dpl, rpl; bool_t writable; int fault_type = TRAP_invalid_tss; @@ -2876,7 +2876,7 @@ void hvm_task_switch( struct vcpu *v = current; struct cpu_user_regs *regs = guest_cpu_user_regs(); struct segment_register gdt, tr, prev_tr, segr; - struct desc_struct *optss_desc = NULL, *nptss_desc = NULL, tss_desc; + seg_desc_t *optss_desc = NULL, *nptss_desc = NULL, tss_desc; bool_t otd_writable, ntd_writable; unsigned int eflags, new_cpl; pagefault_info_t pfinfo; diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index b9a8900ced..40937bfa47 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1636,8 +1636,8 @@ bool svm_load_segs(unsigned int ldt_ents, unsigned long ldt_base, else { /* Keep GDT in sync. */ - struct desc_struct *desc = this_cpu(gdt_table) + LDT_ENTRY - - FIRST_RESERVED_GDT_ENTRY; + seg_desc_t *desc = + this_cpu(gdt_table) + LDT_ENTRY - FIRST_RESERVED_GDT_ENTRY; _set_tssldt_desc(desc, ldt_base, ldt_ents * 8 - 1, SYS_DESC_ldt); diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index b3350eee35..1431f347f3 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -626,7 +626,7 @@ const char __section(".bss.page_aligned.const") __aligned(PAGE_SIZE) static int alloc_segdesc_page(struct page_info *page) { const struct domain *owner = page_get_owner(page); - struct desc_struct *descs = __map_domain_page(page); + seg_desc_t *descs = __map_domain_page(page); unsigned i; for ( i = 0; i < 512; i++ ) diff --git a/xen/arch/x86/pv/descriptor-tables.c b/xen/arch/x86/pv/descriptor-tables.c index 8b2d55fc2e..caa62eb88d 100644 --- a/xen/arch/x86/pv/descriptor-tables.c +++ b/xen/arch/x86/pv/descriptor-tables.c @@ -212,16 +212,16 @@ long do_update_descriptor(uint64_t pa, uint64_t desc) unsigned long gmfn = pa >> PAGE_SHIFT; unsigned long mfn; unsigned int offset; - struct desc_struct *gdt_pent, d; + seg_desc_t *gdt_pent, d; struct page_info *page; long ret = -EINVAL; - offset = ((unsigned int)pa & ~PAGE_MASK) / sizeof(struct desc_struct); + offset = ((unsigned int)pa & ~PAGE_MASK) / sizeof(seg_desc_t); *(uint64_t *)&d = desc; page = get_page_from_gfn(currd, gmfn, NULL, P2M_ALLOC); - if ( (((unsigned int)pa % sizeof(struct desc_struct)) != 0) || + if ( (((unsigned int)pa % sizeof(seg_desc_t)) != 0) || !page || !check_descriptor(currd, &d) ) { diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c index d1c8aa6f7b..6dbf3c12a0 100644 --- a/xen/arch/x86/pv/emul-gate-op.c +++ b/xen/arch/x86/pv/emul-gate-op.c @@ -47,8 +47,8 @@ static int read_gate_descriptor(unsigned int gate_sel, unsigned long *off, unsigned int *ar) { - struct desc_struct desc; - const struct desc_struct *pdesc = gdt_ldt_desc_ptr(gate_sel); + seg_desc_t desc; + const seg_desc_t *pdesc = gdt_ldt_desc_ptr(gate_sel); if ( (gate_sel < 4) || ((gate_sel >= FIRST_RESERVED_GDT_BYTE) && !(gate_sel & 4)) || diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c index 757ffd159c..877dfda75e 100644 --- a/xen/arch/x86/pv/emulate.c +++ b/xen/arch/x86/pv/emulate.c @@ -29,7 +29,7 @@ int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v, unsigned long *base, unsigned long *limit, unsigned int *ar, bool insn_fetch) { - struct desc_struct desc; + seg_desc_t desc; if ( sel < 4) desc.b = desc.a = 0; diff --git a/xen/arch/x86/pv/emulate.h b/xen/arch/x86/pv/emulate.h index 9d587947f5..fd2aa0a484 100644 --- a/xen/arch/x86/pv/emulate.h +++ b/xen/arch/x86/pv/emulate.h @@ -18,10 +18,10 @@ static inline int pv_emul_is_mem_write(const struct x86_emulate_state *state, } /* Return a pointer to the GDT/LDT descriptor referenced by sel. */ -static inline const struct desc_struct *gdt_ldt_desc_ptr(unsigned int sel) +static inline const seg_desc_t *gdt_ldt_desc_ptr(unsigned int sel) { const struct vcpu *curr = current; - const struct desc_struct *tbl = (void *) + const seg_desc_t *tbl = (void *) ((sel & X86_XEC_TI) ? LDT_VIRT_START(curr) : GDT_VIRT_START(curr)); return &tbl[sel >> 3]; diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 567cece748..7d1226d7bc 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -972,7 +972,7 @@ static int cpu_smpboot_alloc(unsigned int cpu) { unsigned int i, order, memflags = 0; nodeid_t node = cpu_to_node(cpu); - struct desc_struct *gdt; + seg_desc_t *gdt; unsigned long stub_page; int rc = -ENOMEM; diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 9471d89022..05ddc39bfe 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -96,8 +96,8 @@ string_param("nmi", opt_nmi); DEFINE_PER_CPU(uint64_t, efer); static DEFINE_PER_CPU(unsigned long, last_extable_addr); -DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, gdt_table); -DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, compat_gdt_table); +DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, gdt_table); +DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt_table); /* Master table, used by CPU0. */ idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 11977f2671..126a486d2e 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -1075,7 +1075,7 @@ long do_set_segment_base(unsigned int which, unsigned long base) /* Returns TRUE if given descriptor is valid for GDT or LDT. */ -int check_descriptor(const struct domain *dom, struct desc_struct *d) +int check_descriptor(const struct domain *dom, seg_desc_t *d) { u32 a = d->a, b = d->b; u16 cs; diff --git a/xen/include/asm-x86/desc.h b/xen/include/asm-x86/desc.h index 58efc1d896..5a8afb6eb2 100644 --- a/xen/include/asm-x86/desc.h +++ b/xen/include/asm-x86/desc.h @@ -102,9 +102,9 @@ #define SYS_DESC_irq_gate 14 #define SYS_DESC_trap_gate 15 -struct desc_struct { - u32 a, b; -}; +typedef struct { + uint32_t a, b; +} seg_desc_t; typedef union { struct { @@ -201,10 +201,10 @@ struct __packed desc_ptr { unsigned long base; }; -extern struct desc_struct boot_cpu_gdt_table[]; -DECLARE_PER_CPU(struct desc_struct *, gdt_table); -extern struct desc_struct boot_cpu_compat_gdt_table[]; -DECLARE_PER_CPU(struct desc_struct *, compat_gdt_table); +extern seg_desc_t boot_cpu_gdt_table[]; +DECLARE_PER_CPU(seg_desc_t *, gdt_table); +extern seg_desc_t boot_cpu_compat_gdt_table[]; +DECLARE_PER_CPU(seg_desc_t *, compat_gdt_table); extern void load_TR(void); diff --git a/xen/include/asm-x86/ldt.h b/xen/include/asm-x86/ldt.h index a6236b21aa..da502329fb 100644 --- a/xen/include/asm-x86/ldt.h +++ b/xen/include/asm-x86/ldt.h @@ -6,7 +6,7 @@ static inline void load_LDT(struct vcpu *v) { - struct desc_struct *desc; + seg_desc_t *desc; unsigned long ents; if ( (ents = v->arch.pv.ldt_ents) == 0 ) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 1ea173c555..6faa563167 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -438,7 +438,7 @@ static inline int get_page_and_type(struct page_info *page, ASSERT(((_p)->count_info & PGC_count_mask) != 0); \ ASSERT(page_get_owner(_p) == (_d)) -int check_descriptor(const struct domain *, struct desc_struct *d); +int check_descriptor(const struct domain *d, seg_desc_t *desc); extern paddr_t mem_hotplug; -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |