Skip to content

Commit

Permalink
x86/asm: Replace access to desc_struct:a/b fields
Browse files Browse the repository at this point in the history
The union inside of desc_struct which allows access to the raw u32 parts of
the descriptors. This raw access part is about to go away.

Replace the few code parts which access those fields.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170828064958.120214366@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Aug 29, 2017
1 parent 718f5d0 commit 9a98e77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions arch/x86/include/asm/xen/hypercall.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,17 @@ static inline void
MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
struct desc_struct desc)
{
u32 *p = (u32 *) &desc;

mcl->op = __HYPERVISOR_update_descriptor;
if (sizeof(maddr) == sizeof(long)) {
mcl->args[0] = maddr;
mcl->args[1] = *(unsigned long *)&desc;
} else {
mcl->args[0] = maddr;
mcl->args[1] = maddr >> 32;
mcl->args[2] = desc.a;
mcl->args[3] = desc.b;
mcl->args[2] = *p++;
mcl->args[3] = *p;
}

trace_xen_mc_entry(mcl, sizeof(maddr) == sizeof(long) ? 2 : 4);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void set_tls_desc(struct task_struct *p, int idx,

while (n-- > 0) {
if (LDT_empty(info) || LDT_zero(info)) {
desc->a = desc->b = 0;
memset(desc, 0, sizeof(*desc));
} else {
fill_ldt(desc, info);

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/xen/enlighten_pv.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
static inline bool desc_equal(const struct desc_struct *d1,
const struct desc_struct *d2)
{
return d1->a == d2->a && d1->b == d2->b;
return !memcmp(d1, d2, sizeof(*d1));
}

static void load_TLS_descriptor(struct thread_struct *t,
Expand Down

0 comments on commit 9a98e77

Please sign in to comment.