virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: ehabkost@redhat.com, ak@suse.de,
	virtualization@lists.linux-foundation.org, chrisw@sous-sol.org,
	tglx@linutronix.de, anthony@codemonkey.ws, hpa@zytor.com,
	akpm@linux-foundation.org,
	Glauber de Oliveira Costa <gcosta@redhat.com>,
	mingo@elte.hu, roland@redhat.com
Subject: [PATCH 05/19] introduce gate_desc type.
Date: Wed, 12 Dec 2007 10:53:50 -0200	[thread overview]
Message-ID: <11974640752137-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <1197464070228-git-send-email-gcosta@redhat.com>

To account for the differences in gate descriptor in i386 and x86_64
a gate_desc type is introduced.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
 arch/x86/kernel/traps_32.c  |    3 ++-
 include/asm-x86/desc_32.h   |   15 ++++++++-------
 include/asm-x86/desc_64.h   |    4 ++--
 include/asm-x86/desc_defs.h |    8 +++++++-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 94c5aea..6b03d88 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -76,8 +76,8 @@ char ignore_fpu_irq = 0;
  * F0 0F bug workaround.. We have a special link segment
  * for this.
  */
-struct desc_struct idt_table[256]
-	__attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, };
+gate_desc idt_table[256]
+	__attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, };
 
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h
index bc5ca34..77f1e5a 100644
--- a/include/asm-x86/desc_32.h
+++ b/include/asm-x86/desc_32.h
@@ -3,6 +3,7 @@
 
 #include <asm/ldt.h>
 #include <asm/segment.h>
+#include <asm/desc_defs.h>
 
 #ifndef __ASSEMBLY__
 
@@ -24,7 +25,7 @@ static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
 }
 
 extern struct desc_ptr idt_descr;
-extern struct desc_struct idt_table[];
+extern gate_desc idt_table[];
 extern void set_intr_gate(unsigned int irq, void * addr);
 
 static inline void pack_descriptor(__u32 *a, __u32 *b,
@@ -35,11 +36,11 @@ static inline void pack_descriptor(__u32 *a, __u32 *b,
 		(limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20);
 }
 
-static inline void pack_gate(__u32 *a, __u32 *b,
+static inline void pack_gate(gate_desc *gate,
 	unsigned long base, unsigned short seg, unsigned char type, unsigned char flags)
 {
-	*a = (seg << 16) | (base & 0xffff);
-	*b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff);
+	gate->a = (seg << 16) | (base & 0xffff);
+	gate->b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff);
 }
 
 #define DESCTYPE_LDT 	0x82	/* present, system, DPL-0, LDT */
@@ -139,9 +140,9 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
 
 static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
 {
-	__u32 a, b;
-	pack_gate(&a, &b, (unsigned long)addr, seg, type, 0);
-	write_idt_entry(idt_table, gate, a, b);
+	gate_desc g;
+	pack_gate(&g, (unsigned long)addr, seg, type, 0);
+	write_idt_entry(idt_table, gate, g.a, g.b);
 }
 
 static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index 660cc84..ffc6c06 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -30,7 +30,7 @@ static inline unsigned long __store_tr(void)
 
 #define store_tr(tr) (tr) = __store_tr()
 
-extern struct gate_struct idt_table[];
+extern gate_desc idt_table[];
 extern struct desc_ptr cpu_gdt_descr[];
 
 static inline void write_ldt_entry(struct desc_struct *ldt,
@@ -58,7 +58,7 @@ static inline void store_gdt(struct desc_ptr *ptr)
 static inline void _set_gate(void *adr, unsigned type, unsigned long func,
 			     unsigned dpl, unsigned ist)
 {
-	struct gate_struct s;
+	gate_desc s;
 
 	s.offset_low = PTR_LOW(func);
 	s.segment = __KERNEL_CS;
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h
index f37b44c..05eff93 100644
--- a/include/asm-x86/desc_defs.h
+++ b/include/asm-x86/desc_defs.h
@@ -39,7 +39,7 @@ enum {
 };
 
 // 16byte gate
-struct gate_struct {
+struct gate_struct64 {
 	u16 offset_low;
 	u16 segment;
 	unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
@@ -67,6 +67,12 @@ struct ldttss_desc {
 	u32 zero1;
 } __attribute__((packed));
 
+#ifdef CONFIG_X86_64
+typedef struct gate_struct64 gate_desc;
+#else
+typedef struct desc_struct gate_desc;
+#endif
+
 struct desc_ptr {
 	unsigned short size;
 	unsigned long address;
-- 
1.5.0.6

  parent reply	other threads:[~2007-12-12 12:53 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1196957800568-git-send-email-gcosta@redhat.com>
2007-12-06 16:16 ` [PATCH 1/19] unify desc_struct Glauber de Oliveira Costa
2007-12-06 16:16   ` [PATCH 2/19] unify struct desc_ptr Glauber de Oliveira Costa
     [not found]   ` <11969578142514-git-send-email-gcosta@redhat.com>
2007-12-06 16:16     ` [PATCH 3/19] change gdt acessor macro name Glauber de Oliveira Costa
     [not found]     ` <11969578193406-git-send-email-gcosta@redhat.com>
2007-12-06 16:16       ` [PATCH 4/19] removed unused variable Glauber de Oliveira Costa
2007-12-06 16:16         ` [PATCH 5/19] introduce gate_desc type Glauber de Oliveira Costa
     [not found]         ` <11969578292944-git-send-email-gcosta@redhat.com>
2007-12-06 16:16           ` [PATCH 6/19] change write_idt_entry signature Glauber de Oliveira Costa
     [not found]           ` <11969578343061-git-send-email-gcosta@redhat.com>
2007-12-06 16:16             ` [PATCH 7/19] introduce ldt_desc type Glauber de Oliveira Costa
     [not found]             ` <11969578383955-git-send-email-gcosta@redhat.com>
2007-12-06 16:16               ` [PATCH 8/19] modify write_ldt function Glauber de Oliveira Costa
     [not found]               ` <11969578431489-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                 ` [PATCH 9/19] introduce fill_ldt Glauber de Oliveira Costa
     [not found]                 ` <11969578483552-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                   ` [PATCH 10/19] change write_gdt_entry signature Glauber de Oliveira Costa
     [not found]                   ` <11969578534185-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                     ` [PATCH 11/19] change write_ldt_entry signature Glauber de Oliveira Costa
     [not found]                     ` <11969578581299-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                       ` [PATCH 12/19] move constants to desc_defs.h Glauber de Oliveira Costa
     [not found]                       ` <1196957863723-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                         ` [PATCH 13/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
     [not found]                         ` <11969578671479-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                           ` [PATCH 14/19] use the same data type for tls_array Glauber de Oliveira Costa
     [not found]                           ` <119695787262-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                             ` [PATCH 15/19] modify get_desc_base Glauber de Oliveira Costa
     [not found]                             ` <11969578773678-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                               ` [PATCH 16/19] provide tss_desc Glauber de Oliveira Costa
     [not found]                               ` <11969578811685-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                                 ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
     [not found]                                 ` <11969578862882-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                                   ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
     [not found]                                   ` <1196957892937-git-send-email-gcosta@redhat.com>
2007-12-06 16:16                                     ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
2007-12-06 19:24   ` [PATCH 1/19] unify desc_struct Jeremy Fitzhardinge
     [not found]   ` <47584C56.3070804@goop.org>
2007-12-06 19:37     ` Glauber de Oliveira Costa
2007-12-06 20:54   ` Andi Kleen
     [not found]   ` <200712062154.40075.ak@suse.de>
2007-12-06 21:20     ` Glauber de Oliveira Costa
     [not found]     ` <5d6222a80712061320w1224fa10r1d15f214c7e45862@mail.gmail.com>
2007-12-06 22:03       ` Jeremy Fitzhardinge
2007-12-12 12:53 ` [PATCH 0/19] desc_struct integration Glauber de Oliveira Costa
     [not found] ` <11974640441088-git-send-email-gcosta@redhat.com>
2007-12-12 12:53   ` [PATCH 01/19] unify desc_struct Glauber de Oliveira Costa
     [not found]   ` <11974640522688-git-send-email-gcosta@redhat.com>
2007-12-12 12:53     ` [PATCH 02/19] unify struct desc_ptr Glauber de Oliveira Costa
     [not found]     ` <1197464057242-git-send-email-gcosta@redhat.com>
2007-12-12 12:53       ` [PATCH 03/19] change gdt acessor macro name Glauber de Oliveira Costa
     [not found]       ` <11974640653022-git-send-email-gcosta@redhat.com>
2007-12-12 12:53         ` [PATCH 04/19] removed unused variable Glauber de Oliveira Costa
     [not found]         ` <1197464070228-git-send-email-gcosta@redhat.com>
2007-12-12 12:53           ` Glauber de Oliveira Costa [this message]
2007-12-12 12:53             ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
     [not found]             ` <11974640813511-git-send-email-gcosta@redhat.com>
2007-12-12 12:53               ` [PATCH 07/19] introduce ldt_desc type Glauber de Oliveira Costa
     [not found]               ` <11974640872474-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                 ` [PATCH 08/19] modify write_ldt function Glauber de Oliveira Costa
     [not found]                 ` <11974640932406-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                   ` [PATCH 09/19] introduce fill_ldt Glauber de Oliveira Costa
     [not found]                   ` <11974640983333-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                     ` [PATCH 10/19] provide tss_desc Glauber de Oliveira Costa
     [not found]                     ` <11974641042757-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                       ` [PATCH 11/19] change write_gdt_entry signature Glauber de Oliveira Costa
     [not found]                       ` <11974641102691-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                         ` [PATCH 12/19] change write_ldt_entry signature Glauber de Oliveira Costa
     [not found]                         ` <11974641172402-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                           ` [PATCH 13/19] move constants to desc_defs.h Glauber de Oliveira Costa
     [not found]                           ` <11974641243264-git-send-email-gcosta@redhat.com>
2007-12-12 12:53                             ` [PATCH 14/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
     [not found]                             ` <11974641314148-git-send-email-gcosta@redhat.com>
2007-12-12 12:54                               ` [PATCH 15/19] use the same data type for tls_array Glauber de Oliveira Costa
     [not found]                               ` <1197464139284-git-send-email-gcosta@redhat.com>
2007-12-12 12:54                                 ` [PATCH 16/19] modify get_desc_base Glauber de Oliveira Costa
     [not found]                                 ` <1197464145737-git-send-email-gcosta@redhat.com>
2007-12-12 12:54                                   ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
     [not found]                                   ` <11974641501854-git-send-email-gcosta@redhat.com>
2007-12-12 12:54                                     ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
     [not found]                                     ` <11974641572562-git-send-email-g! costa@redhat.com>
     [not found]                                       ` <11974641572562-git-send-email-gcosta@redhat.com>
2007-12-12 12:54                                         ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
2007-12-12 17:20   ` [PATCH 0/19] desc_struct integration Ingo Molnar
     [not found]   ` <20071212172019.GA11258@elte.hu>
     [not found]     ` <20071212181111.GA23306@elte.hu>
2007-12-12 18:20       ` Ingo Molnar
     [not found]       ` <20071212182057.GA26515@elte.hu>
2007-12-12 18:27         ` Glauber de Oliveira Costa
     [not found]         ` <476027F9.8020006@redhat.com>
2007-12-12 18:33           ` Ingo Molnar
2007-12-12 18:34           ` Ingo Molnar
     [not found]           ` <20071212183327.GA30636@elte.hu>
2007-12-12 19:05             ` Glauber de Oliveira Costa
2007-12-12 23:39   ` H. Peter Anvin
2007-12-13  2:01 ` [PATCH 0/19 - v3] " Glauber de Oliveira Costa
     [not found] ` <11975113122984-git-send-email-gcosta@redhat.com>
2007-12-13  2:01   ` [PATCH 01/19] unify desc_struct Glauber de Oliveira Costa
     [not found]   ` <11975113194101-git-send-email-gcosta@redhat.com>
2007-12-13  2:01     ` [PATCH 02/19] unify struct desc_ptr Glauber de Oliveira Costa
     [not found]     ` <11975113243875-git-send-email-gcosta@redhat.com>
2007-12-13  2:01       ` [PATCH 03/19] change gdt acessor macro name Glauber de Oliveira Costa
     [not found]       ` <11975113291722-git-send-email-gcosta@redhat.com>
2007-12-13  2:01         ` [PATCH 04/19] removed unused variable Glauber de Oliveira Costa
     [not found]         ` <1197511334416-git-send-email-gcosta@redhat.com>
2007-12-13  2:01           ` [PATCH 05/19] introduce gate_desc type Glauber de Oliveira Costa
     [not found]           ` <1197511338810-git-send-email-gcosta@redhat.com>
2007-12-13  2:01             ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
     [not found]             ` <1197511343355-git-send-email-gcosta@redhat.com>
2007-12-13  2:01               ` [PATCH 07/19] introduce ldt_desc type Glauber de Oliveira Costa
2007-12-13  2:01                 ` [PATCH 08/19] modify write_ldt function Glauber de Oliveira Costa
     [not found]                 ` <11975113532186-git-send-email-gcosta@redhat.com>
2007-12-13  2:01                   ` [PATCH 09/19] introduce fill_ldt Glauber de Oliveira Costa
2007-12-13  2:01                     ` [PATCH 10/19] provide tss_desc Glauber de Oliveira Costa
2007-12-13  2:01                       ` [PATCH 11/19] change write_gdt_entry signature Glauber de Oliveira Costa
2007-12-13  2:01                         ` [PATCH 12/19] change write_ldt_entry signature Glauber de Oliveira Costa
2007-12-13  2:01                           ` [PATCH 13/19] move constants to desc_defs.h Glauber de Oliveira Costa
2007-12-13  2:01                             ` [PATCH 14/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
2007-12-13  2:01                               ` [PATCH 15/19] use the same data type for tls_array Glauber de Oliveira Costa
     [not found]                               ` <11975113873364-git-send-email-gcosta@redhat.com>
2007-12-13  2:01                                 ` [PATCH 16/19] modify get_desc_base Glauber de Oliveira Costa
     [not found]                                 ` <11975113923422-git-send-email-gcosta@redhat.com>
2007-12-13  2:01                                   ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
     [not found]                                   ` <11975113961144-git-send-email-gcosta@redhat.com>
2007-12-13  2:01                                     ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
     [not found]                                     ` <1197511401733-git-send-email-gc! osta@redhat.com>
     [not found]                                       ` <1197511401733-git-send-email-gcosta@redhat.com>
2007-12-13  2:01                                         ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
2007-12-13 12:46                                           ` Andi Kleen
     [not found]                                           ` <20071213124633.GG31699@bingen.suse.de>
2007-12-13 14:50                                             ` Glauber de Oliveira Costa
2007-12-13 13:57   ` [PATCH 0/19 -v4] desc_struct integration Glauber de Oliveira Costa
     [not found]   ` <1197554287294-git-send-email-gcosta@redhat.com>
2007-12-13 13:57     ` [PATCH 01/19] unify desc_struct Glauber de Oliveira Costa
2007-12-13 13:57       ` [PATCH 02/19] unify struct desc_ptr Glauber de Oliveira Costa
     [not found]       ` <11975543001070-git-send-email-gcosta@redhat.com>
2007-12-13 13:57         ` [PATCH 03/19] change gdt acessor macro name Glauber de Oliveira Costa
2007-12-13 13:57           ` [PATCH 04/19] removed unused variable Glauber de Oliveira Costa
     [not found]           ` <11975543173017-git-send-email-gcosta@redhat.com>
2007-12-13 13:57             ` [PATCH 05/19] introduce gate_desc type Glauber de Oliveira Costa
     [not found]             ` <11975543382698-git-send-email-gcosta@redhat.com>
2007-12-13 13:57               ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
     [not found]               ` <11975543442801-git-send-email-gcosta@redhat.com>
2007-12-13 13:57                 ` [PATCH 07/19] introduce ldt_desc type Glauber de Oliveira Costa
     [not found]                 ` <11975543492215-git-send-email-gcosta@redhat.com>
2007-12-13 13:57                   ` [PATCH 08/19] modify write_ldt function Glauber de Oliveira Costa
     [not found]                   ` <11975543543850-git-send-email-gcosta@redhat.com>
2007-12-13 13:57                     ` [PATCH 09/19] introduce fill_ldt Glauber de Oliveira Costa
     [not found]                     ` <11975543592701-git-send-email-gcosta@redhat.com>
2007-12-13 13:57                       ` [PATCH 10/19] provide tss_desc Glauber de Oliveira Costa
     [not found]                       ` <11975543641360-git-send-email-gcosta@redhat.com>
2007-12-13 13:57                         ` [PATCH 11/19] change write_gdt_entry signature Glauber de Oliveira Costa
     [not found]                         ` <11975543691134-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                           ` [PATCH 12/19] change write_ldt_entry signature Glauber de Oliveira Costa
     [not found]                           ` <11975543742848-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                             ` [PATCH 13/19] move constants to desc_defs.h Glauber de Oliveira Costa
     [not found]                             ` <11975543792334-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                               ` [PATCH 14/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
     [not found]                               ` <11975543843977-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                                 ` [PATCH 15/19] use the same data type for tls_array Glauber de Oliveira Costa
2007-12-13 13:58                                   ` [PATCH 16/19] modify get_desc_base Glauber de Oliveira Costa
     [not found]                                   ` <11975543942657-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                                     ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
     [not found]                                     ` <1197554399402-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                                       ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
     [not found]                                       ` <1197554404337-git-send-email-! gcosta@redhat.com>
     [not found]                                         ` <1197554404337-git-send-email-gcosta@redhat.com>
2007-12-13 13:58                                           ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
2007-12-22  2:07                                           ` [PATCH 18/19] move _set_gate and its users to a common location Ingo Molnar
2007-12-13 16:47     ` [PATCH 0/19 -v4] desc_struct integration Ingo Molnar
     [not found]     ` <20071213164701.GB4865@elte.hu>
2007-12-13 17:06       ` Glauber de Oliveira Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11974640752137-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anthony@codemonkey.ws \
    --cc=chrisw@sous-sol.org \
    --cc=ehabkost@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).