]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/asm-x86/desc_defs.h
KVM: MMU: ignore zapped root pagetables
[mirror_ubuntu-bionic-kernel.git] / include / asm-x86 / desc_defs.h
CommitLineData
249e83fe
AK
1/* Written 2000 by Andi Kleen */
2#ifndef __ARCH_DESC_DEFS_H
3#define __ARCH_DESC_DEFS_H
4
5/*
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
7 * archs.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
6842ef0e
GOC
14/*
15 * FIXME: Acessing the desc_struct through its fields is more elegant,
16 * and should be the one valid thing to do. However, a lot of open code
17 * still touches the a and b acessors, and doing this allow us to do it
18 * incrementally. We keep the signature as a struct, rather than an union,
19 * so we can get rid of it transparently in the future -- glommer
20 */
b7761900 21/* 8 byte segment descriptor */
249e83fe 22struct desc_struct {
6842ef0e 23 union {
b7761900
JP
24 struct {
25 unsigned int a;
26 unsigned int b;
27 };
6842ef0e
GOC
28 struct {
29 u16 limit0;
30 u16 base0;
31 unsigned base1: 8, type: 4, s: 1, dpl: 2, p: 1;
32 unsigned limit: 4, avl: 1, l: 1, d: 1, g: 1, base2: 8;
33 };
6842ef0e
GOC
34 };
35} __attribute__((packed));
249e83fe
AK
36
37enum {
38 GATE_INTERRUPT = 0xE,
39 GATE_TRAP = 0xF,
40 GATE_CALL = 0xC,
507f90c9 41 GATE_TASK = 0x5,
249e83fe
AK
42};
43
b7761900 44/* 16byte gate */
010d4f82 45struct gate_struct64 {
249e83fe
AK
46 u16 offset_low;
47 u16 segment;
48 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
49 u16 offset_middle;
50 u32 offset_high;
51 u32 zero1;
52} __attribute__((packed));
53
54cd0eac
GOC
54#define PTR_LOW(x) ((unsigned long long)(x) & 0xFFFF)
55#define PTR_MIDDLE(x) (((unsigned long long)(x) >> 16) & 0xFFFF)
56#define PTR_HIGH(x) ((unsigned long long)(x) >> 32)
249e83fe
AK
57
58enum {
59 DESC_TSS = 0x9,
60 DESC_LDT = 0x2,
b7761900 61 DESCTYPE_S = 0x10, /* !system */
249e83fe
AK
62};
63
b7761900 64/* LDT or TSS descriptor in the GDT. 16 bytes. */
25deca53 65struct ldttss_desc64 {
249e83fe
AK
66 u16 limit0;
67 u16 base0;
68 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
69 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
70 u32 base3;
71 u32 zero1;
72} __attribute__((packed));
73
010d4f82
GOC
74#ifdef CONFIG_X86_64
75typedef struct gate_struct64 gate_desc;
25deca53 76typedef struct ldttss_desc64 ldt_desc;
18245d5b 77typedef struct ldttss_desc64 tss_desc;
010d4f82
GOC
78#else
79typedef struct desc_struct gate_desc;
25deca53 80typedef struct desc_struct ldt_desc;
18245d5b 81typedef struct desc_struct tss_desc;
010d4f82
GOC
82#endif
83
249e83fe
AK
84struct desc_ptr {
85 unsigned short size;
86 unsigned long address;
87} __attribute__((packed)) ;
88
249e83fe
AK
89#endif /* !__ASSEMBLY__ */
90
91#endif