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,
Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: [PATCH 10/19] change write_gdt_entry signature.
Date: Thu, 6 Dec 2007 14:16:31 -0200 [thread overview]
Message-ID: <11969578534185-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11969578483552-git-send-email-gcosta@redhat.com>
This patch changes the write_gdt_entry function signature.
Instead of the old "a" and "b" parameters, it now receives
a pointer to a desc_struct, and the size of the entry being
handled. This is because x86_64 can have some 16-byte entries
as well as 8-byte ones.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
arch/x86/kernel/paravirt_32.c | 4 ++--
arch/x86/kernel/smpcommon_32.c | 7 ++++---
arch/x86/xen/enlighten.c | 5 ++---
include/asm-x86/desc_32.h | 29 +++++++++++++++--------------
include/asm-x86/paravirt.h | 9 ++++++---
5 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 9ed46da..edff853 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -379,8 +379,8 @@ struct pv_cpu_ops pv_cpu_ops = {
.store_idt = native_store_idt,
.store_tr = native_store_tr,
.load_tls = native_load_tls,
- .write_ldt_entry = write_dt_entry,
- .write_gdt_entry = write_dt_entry,
+ .write_ldt_entry = write_ldt_entry,
+ .write_gdt_entry = write_gdt_entry,
.write_idt_entry = write_idt_entry,
.load_sp0 = native_load_sp0,
diff --git a/arch/x86/kernel/smpcommon_32.c b/arch/x86/kernel/smpcommon_32.c
index bbfe85a..a6f9b41 100644
--- a/arch/x86/kernel/smpcommon_32.c
+++ b/arch/x86/kernel/smpcommon_32.c
@@ -14,10 +14,11 @@ __cpuinit void init_gdt(int cpu)
{
struct desc_struct *gdt = get_cpu_gdt_table(cpu);
- pack_descriptor((u32 *)&gdt[GDT_ENTRY_PERCPU].a,
- (u32 *)&gdt[GDT_ENTRY_PERCPU].b,
+ pack_descriptor(&gdt[GDT_ENTRY_PERCPU],
__per_cpu_offset[cpu], 0xFFFFF,
- 0x80 | DESCTYPE_S | 0x2, 0x8);
+ 0x80 | 0x2, 0x8);
+
+ gdt[GDT_ENTRY_PERCPU].s = 1;
per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
per_cpu(cpu_number, cpu) = cpu;
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 829a450..a552103 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -474,7 +474,7 @@ static void xen_load_idt(const struct desc_ptr *desc)
/* Write a GDT descriptor entry. Ignore LDT descriptors, since
they're handled differently. */
static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
- u32 low, u32 high)
+ void *desc, int size)
{
preempt_disable();
@@ -486,10 +486,9 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
default: {
xmaddr_t maddr = virt_to_machine(&dt[entry]);
- u64 desc = (u64)high << 32 | low;
xen_mc_flush();
- if (HYPERVISOR_update_descriptor(maddr.maddr, desc))
+ if (HYPERVISOR_update_descriptor(maddr.maddr, *(u64 *)desc))
BUG();
}
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h
index 3653c9f..622b0e7 100644
--- a/include/asm-x86/desc_32.h
+++ b/include/asm-x86/desc_32.h
@@ -28,11 +28,11 @@ extern struct desc_ptr idt_descr;
extern gate_desc idt_table[];
extern void set_intr_gate(unsigned int irq, void * addr);
-static inline void pack_descriptor(__u32 *a, __u32 *b,
+static inline void pack_descriptor(struct desc_struct *desc,
unsigned long base, unsigned long limit, unsigned char type, unsigned char flags)
{
- *a = ((base & 0xffff) << 16) | (limit & 0xffff);
- *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) |
+ desc->a = ((base & 0xffff) << 16) | (limit & 0xffff);
+ desc->b = (base & 0xff000000) | ((base & 0xff0000) >> 16) |
(limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20);
}
@@ -69,7 +69,8 @@ static inline void pack_gate(gate_desc *gate,
#define set_ldt native_set_ldt
#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
-#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
+#define write_gdt_entry(dt, entry, desc, size) \
+ native_write_gdt_entry(dt, entry, desc, size)
#define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g)
#endif
@@ -78,11 +79,10 @@ static inline void native_write_idt_entry(gate_desc *idt, int entry, gate_desc *
memcpy(&idt[entry], gate, sizeof(*gate));
}
-static inline void write_dt_entry(struct desc_struct *dt,
- int entry, u32 entry_low, u32 entry_high)
+static inline void native_write_gdt_entry(struct desc_struct *gdt, int entry,
+ void *desc, int size)
{
- dt[entry].a = entry_low;
- dt[entry].b = entry_high;
+ memcpy(&gdt[entry], desc, size);
}
static inline void native_set_ldt(const void *addr, unsigned int entries)
@@ -91,12 +91,13 @@ static inline void native_set_ldt(const void *addr, unsigned int entries)
__asm__ __volatile__("lldt %w0"::"q" (0));
else {
unsigned cpu = smp_processor_id();
- __u32 a, b;
+ ldt_desc ldt;
- pack_descriptor(&a, &b, (unsigned long)addr,
+ pack_descriptor(&ldt, (unsigned long)addr,
entries * sizeof(struct desc_struct) - 1,
DESCTYPE_LDT, 0);
- write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
+ write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT,
+ &ldt, sizeof(ldt));
__asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8));
}
}
@@ -152,11 +153,11 @@ static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned s
static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
{
- __u32 a, b;
- pack_descriptor(&a, &b, (unsigned long)addr,
+ tss_desc tss;
+ pack_descriptor(&tss, (unsigned long)addr,
offsetof(struct tss_struct, __cacheline_filler) - 1,
DESCTYPE_TSS, 0);
- write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
+ write_gdt_entry(get_cpu_gdt_table(cpu), entry, &tss, sizeof(tss));
}
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index d369b85..a3e22b7 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -99,7 +99,7 @@ struct pv_cpu_ops {
void (*write_ldt_entry)(struct desc_struct *,
int entrynum, u32 low, u32 high);
void (*write_gdt_entry)(struct desc_struct *,
- int entrynum, u32 low, u32 high);
+ int entrynum, void *desc, int size);
void (*write_idt_entry)(gate_desc *,
int entrynum, gate_desc *gate);
void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t);
@@ -664,10 +664,13 @@ static inline void write_ldt_entry(void *dt, int entry, u32 low, u32 high)
{
PVOP_VCALL4(pv_cpu_ops.write_ldt_entry, dt, entry, low, high);
}
-static inline void write_gdt_entry(void *dt, int entry, u32 low, u32 high)
+
+static inline void write_gdt_entry(struct desc_struct *dt, int entry,
+ void *desc, int size)
{
- PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high);
+ PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, desc, size);
}
+
static inline void write_idt_entry(gate_desc *dt, int entry, gate_desc *g)
{
PVOP_VCALL4(pv_cpu_ops.write_idt_entry, dt, entry, g);
--
1.4.4.2
next prev parent reply other threads:[~2007-12-06 19:04 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 ` Glauber de Oliveira Costa [this message]
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 ` [PATCH 19/19] unify set_tss_desc Glauber de Oliveira Costa
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=11969578534185-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=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).