summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/desc.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-08-28 08:47:42 +0200
committerIngo Molnar <mingo@kernel.org>2017-08-29 12:07:25 +0200
commit87cc037674342cbf6213829b2cc59bb71be60777 (patch)
treee66f2e790f39b9c87d7b18c10d93a8e3b3a6d81f /arch/x86/include/asm/desc.h
parent38e9e81f4c81c75799b002d5811de7241b307676 (diff)
downloadlwn-87cc037674342cbf6213829b2cc59bb71be60777.tar.gz
lwn-87cc037674342cbf6213829b2cc59bb71be60777.zip
x86/ldttss: Clean up 32-bit descriptors
Like the IDT descriptors, the LDT/TSS descriptors are pointlessly different on 32 and 64 bit kernels. Unify them and get rid of the duplicated code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> 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: 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.289634692@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/desc.h')
-rw-r--r--arch/x86/include/asm/desc.h26
1 files changed, 3 insertions, 23 deletions
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 2090cd223505..108a9e894019 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -166,42 +166,22 @@ native_write_gdt_entry(struct desc_struct *gdt, int entry, const void *desc, int
memcpy(&gdt[entry], desc, size);
}
-static inline void pack_descriptor(struct desc_struct *desc, unsigned long base,
- unsigned long limit, unsigned char type,
- unsigned char flags)
-{
- desc->limit0 = (u16) limit;
- desc->base0 = (u16) base;
- desc->base1 = (base >> 16) & 0xFF;
- desc->type = type & 0x0F;
- desc->s = 0;
- desc->dpl = 0;
- desc->p = 1;
- desc->limit1 = (limit >> 16) & 0xF;
- desc->avl = (flags >> 0) & 0x01;
- desc->l = (flags >> 1) & 0x01;
- desc->d = (flags >> 2) & 0x01;
- desc->g = (flags >> 3) & 0x01;
-}
-
static inline void set_tssldt_descriptor(void *d, unsigned long addr,
unsigned type, unsigned size)
{
-#ifdef CONFIG_X86_64
- struct ldttss_desc64 *desc = d;
+ struct ldttss_desc *desc = d;
memset(desc, 0, sizeof(*desc));
- desc->limit0 = size & 0xFFFF;
+ desc->limit0 = (u16) size;
desc->base0 = (u16) addr;
desc->base1 = (addr >> 16) & 0xFF;
desc->type = type;
desc->p = 1;
desc->limit1 = (size >> 16) & 0xF;
desc->base2 = (addr >> 24) & 0xFF;
+#ifdef CONFIG_X86_64
desc->base3 = (u32) (addr >> 32);
-#else
- pack_descriptor((struct desc_struct *)d, addr, size, type, 0);
#endif
}