linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, glommer@gmail.com, tglx@linutronix.de,
	mingo@elte.hu, ehabkost@redhat.com, jeremy@goop.org,
	avi@qumranet.com, anthony@codemonkey.ws,
	virtualization@lists.linux-foundation.org, rusty@rustcorp.com.au,
	ak@suse.de, chrisw@sous-sol.org, rostedt@goodmis.org,
	hpa@zytor.com, zach@vmware.com, roland@redhat.com,
	Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: [PATCH 19/19] unify set_tss_desc
Date: Wed, 12 Dec 2007 10:54:04 -0200	[thread overview]
Message-ID: <11974641631993-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11974641572562-git-send-email-gcosta@redhat.com>

This patch unifies the set_tss_desc between i386 and x86_64,
which can now have a common implementation. After the old
functions are removed from desc_{32,64}.h, nothing important is
left, and the files can be removed.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
 include/asm-x86/desc.h    |   40 +++++++++++++++++++++++++++++++++-------
 include/asm-x86/desc_32.h |   27 ---------------------------
 include/asm-x86/desc_64.h |   34 ----------------------------------
 3 files changed, 33 insertions(+), 68 deletions(-)
 delete mode 100644 include/asm-x86/desc_32.h
 delete mode 100644 include/asm-x86/desc_64.h

Index: linux-2.6-x86/include/asm-x86/desc.h
===================================================================
--- linux-2.6-x86.orig/include/asm-x86/desc.h
+++ linux-2.6-x86/include/asm-x86/desc.h
@@ -147,6 +147,39 @@ static inline void pack_ldt(ldt_desc *ld
 #endif
 }
 
+static inline void pack_tss(tss_desc *tss, unsigned long addr,
+			   unsigned size, unsigned entry)
+{
+#ifdef CONFIG_X86_64
+		set_tssldt_descriptor(tss,
+			     addr, entry, size);
+#else
+		pack_descriptor(tss, (unsigned long)addr,
+				size,
+				0x80 | entry, 0);
+#endif
+}
+
+static inline void __set_tss_desc(unsigned cpu, unsigned int entry, void *addr)
+{
+	struct desc_struct *d = get_cpu_gdt_table(cpu);
+	tss_desc tss;
+
+	/*
+	 * sizeof(unsigned long) coming from an extra "long" at the end
+	 * of the iobitmap. See tss_struct definition in processor.h
+	 *
+	 * -1? seg base+limit should be pointing to the address of the
+	 * last valid byte
+	 */
+	pack_tss(&tss, (unsigned long)addr,
+		IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1,
+		DESC_TSS);
+	write_gdt_entry(d, entry, &tss, sizeof(tss));
+}
+
+#define set_tss_desc(cpu, addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
+
 static inline void native_set_ldt(const void *addr, unsigned int entries)
 {
 	if (likely(entries == 0))
@@ -205,13 +238,6 @@ static inline void native_load_tls(struc
 }
 #endif /* __ASSEMBLY__ */
 
-
-#ifdef CONFIG_X86_32
-# include "desc_32.h"
-#else
-# include "desc_64.h"
-#endif
-
 #ifndef __ASSEMBLY__
 
 #define _LDT_empty(info) (\
Index: linux-2.6-x86/include/asm-x86/desc_32.h
===================================================================
--- linux-2.6-x86.orig/include/asm-x86/desc_32.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __ARCH_DESC_H
-#define __ARCH_DESC_H
-
-#include <asm/ldt.h>
-#include <asm/segment.h>
-#include <asm/desc_defs.h>
-
-#ifndef __ASSEMBLY__
-
-#include <linux/preempt.h>
-#include <linux/percpu.h>
-
-static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
-{
-	tss_desc tss;
-	pack_descriptor(&tss, (unsigned long)addr,
-			offsetof(struct tss_struct, __cacheline_filler) - 1,
-			DESC_TSS, 0);
-	write_gdt_entry(get_cpu_gdt_table(cpu), entry, &tss, DESC_TSS);
-}
-
-
-#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
-
-#endif /* !__ASSEMBLY__ */
-
-#endif
Index: linux-2.6-x86/include/asm-x86/desc_64.h
===================================================================
--- linux-2.6-x86.orig/include/asm-x86/desc_64.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Written 2000 by Andi Kleen */
-#ifndef __ARCH_DESC_H
-#define __ARCH_DESC_H
-
-#include <linux/threads.h>
-#include <asm/ldt.h>
-
-#ifndef __ASSEMBLY__
-
-#include <linux/string.h>
-
-#include <asm/segment.h>
-
-static inline void set_tss_desc(unsigned cpu, void *addr)
-{
-	struct desc_struct *d = get_cpu_gdt_table(cpu);
-	tss_desc tss;
-
-	/*
-	 * sizeof(unsigned long) coming from an extra "long" at the end
-	 * of the iobitmap. See tss_struct definition in processor.h
-	 *
-	 * -1? seg base+limit should be pointing to the address of the
-	 * last valid byte
-	 */
-	set_tssldt_descriptor(&tss,
-		(unsigned long)addr, DESC_TSS,
-		IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
-	write_gdt_entry(d, GDT_ENTRY_TSS, &tss, sizeof(tss_desc));
-}
-
-#endif /* !__ASSEMBLY__ */
-
-#endif

  reply	other threads:[~2007-12-12 15:44 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-06 16:16 [PATCH 0/19] desc_struct integration Glauber de Oliveira Costa
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
2007-12-06 16:16     ` [PATCH 3/19] change gdt acessor macro name Glauber de Oliveira Costa
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
2007-12-06 16:16           ` [PATCH 6/19] change write_idt_entry signature Glauber de Oliveira Costa
2007-12-06 16:16             ` [PATCH 7/19] introduce ldt_desc type Glauber de Oliveira Costa
2007-12-06 16:16               ` [PATCH 8/19] modify write_ldt function Glauber de Oliveira Costa
2007-12-06 16:16                 ` [PATCH 9/19] introduce fill_ldt Glauber de Oliveira Costa
2007-12-06 16:16                   ` [PATCH 10/19] change write_gdt_entry signature Glauber de Oliveira Costa
2007-12-06 16:16                     ` [PATCH 11/19] change write_ldt_entry signature Glauber de Oliveira Costa
2007-12-06 16:16                       ` [PATCH 12/19] move constants to desc_defs.h Glauber de Oliveira Costa
2007-12-06 16:16                         ` [PATCH 13/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
2007-12-06 16:16                           ` [PATCH 14/19] use the same data type for tls_array Glauber de Oliveira Costa
2007-12-06 16:16                             ` [PATCH 15/19] modify get_desc_base Glauber de Oliveira Costa
2007-12-06 16:16                               ` [PATCH 16/19] provide tss_desc Glauber de Oliveira Costa
2007-12-06 16:16                                 ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
2007-12-06 16:16                                   ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
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
2007-12-06 19:37     ` Glauber de Oliveira Costa
2007-12-06 20:54   ` Andi Kleen
2007-12-06 21:20     ` Glauber de Oliveira Costa
2007-12-06 22:03       ` Jeremy Fitzhardinge
2007-12-12 12:53 ` [PATCH 0/19] desc_struct integration Glauber de Oliveira Costa
2007-12-12 12:53   ` [PATCH 01/19] unify desc_struct Glauber de Oliveira Costa
2007-12-12 12:53     ` [PATCH 02/19] unify struct desc_ptr Glauber de Oliveira Costa
2007-12-12 12:53       ` [PATCH 03/19] change gdt acessor macro name Glauber de Oliveira Costa
2007-12-12 12:53         ` [PATCH 04/19] removed unused variable Glauber de Oliveira Costa
2007-12-12 12:53           ` [PATCH 05/19] introduce gate_desc type Glauber de Oliveira Costa
2007-12-12 12:53             ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
2007-12-12 12:53               ` [PATCH 07/19] introduce ldt_desc type Glauber de Oliveira Costa
2007-12-12 12:53                 ` [PATCH 08/19] modify write_ldt function Glauber de Oliveira Costa
2007-12-12 12:53                   ` [PATCH 09/19] introduce fill_ldt Glauber de Oliveira Costa
2007-12-12 12:53                     ` [PATCH 10/19] provide tss_desc Glauber de Oliveira Costa
2007-12-12 12:53                       ` [PATCH 11/19] change write_gdt_entry signature Glauber de Oliveira Costa
2007-12-12 12:53                         ` [PATCH 12/19] change write_ldt_entry signature Glauber de Oliveira Costa
2007-12-12 12:53                           ` [PATCH 13/19] move constants to desc_defs.h Glauber de Oliveira Costa
2007-12-12 12:53                             ` [PATCH 14/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
2007-12-12 12:54                               ` [PATCH 15/19] use the same data type for tls_array Glauber de Oliveira Costa
2007-12-12 12:54                                 ` [PATCH 16/19] modify get_desc_base Glauber de Oliveira Costa
2007-12-12 12:54                                   ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
2007-12-12 12:54                                     ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
2007-12-12 12:54                                       ` Glauber de Oliveira Costa [this message]
2007-12-12 17:56                     ` [PATCH 09/19] introduce fill_ldt Ingo Molnar
2007-12-12 17:20   ` [PATCH 0/19] desc_struct integration Ingo Molnar
2007-12-12 18:11     ` Ingo Molnar
2007-12-12 18:20       ` Ingo Molnar
2007-12-12 18:27         ` Glauber de Oliveira Costa
2007-12-12 18:33           ` Ingo Molnar
2007-12-12 19:05             ` Glauber de Oliveira Costa
2007-12-12 18:34           ` Ingo Molnar
2007-12-12 23:39   ` H. Peter Anvin
2007-12-13  2:01 ` [PATCH 0/19 - v3] " Glauber de Oliveira Costa
2007-12-13  2:01   ` [PATCH 01/19] unify desc_struct Glauber de Oliveira Costa
2007-12-13  2:01     ` [PATCH 02/19] unify struct desc_ptr Glauber de Oliveira Costa
2007-12-13  2:01       ` [PATCH 03/19] change gdt acessor macro name Glauber de Oliveira Costa
2007-12-13  2:01         ` [PATCH 04/19] removed unused variable Glauber de Oliveira Costa
2007-12-13  2:01           ` [PATCH 05/19] introduce gate_desc type Glauber de Oliveira Costa
2007-12-13  2:01             ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
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
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
2007-12-13  2:01                                 ` [PATCH 16/19] modify get_desc_base Glauber de Oliveira Costa
2007-12-13  2:01                                   ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
2007-12-13  2:01                                     ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
2007-12-13  2:01                                       ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
2007-12-13 12:46                                         ` Andi Kleen
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
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
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
2007-12-13 13:57             ` [PATCH 05/19] introduce gate_desc type Glauber de Oliveira Costa
2007-12-13 13:57               ` [PATCH 06/19] change write_idt_entry signature Glauber de Oliveira Costa
2007-12-13 13:57                 ` [PATCH 07/19] introduce ldt_desc type Glauber de Oliveira Costa
2007-12-13 13:57                   ` [PATCH 08/19] modify write_ldt function Glauber de Oliveira Costa
2007-12-13 13:57                     ` [PATCH 09/19] introduce fill_ldt Glauber de Oliveira Costa
2007-12-13 13:57                       ` [PATCH 10/19] provide tss_desc Glauber de Oliveira Costa
2007-12-13 13:57                         ` [PATCH 11/19] change write_gdt_entry signature Glauber de Oliveira Costa
2007-12-13 13:58                           ` [PATCH 12/19] change write_ldt_entry signature Glauber de Oliveira Costa
2007-12-13 13:58                             ` [PATCH 13/19] move constants to desc_defs.h Glauber de Oliveira Costa
2007-12-13 13:58                               ` [PATCH 14/19] unify non-paravirt parts of desc.h Glauber de Oliveira Costa
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
2007-12-13 13:58                                     ` [PATCH 17/19] unify paravirt pieces of descriptor handling Glauber de Oliveira Costa
2007-12-13 13:58                                       ` [PATCH 18/19] move _set_gate and its users to a common location Glauber de Oliveira Costa
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
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=11974641631993-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anthony@codemonkey.ws \
    --cc=avi@qumranet.com \
    --cc=chrisw@sous-sol.org \
    --cc=ehabkost@redhat.com \
    --cc=glommer@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zach@vmware.com \
    /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).