Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53823
b: refs/heads/master
c: 4fbb596
h: refs/heads/master
i:
  53821: 023b2d4
  53819: 827ce41
  53815: c47f505
  53807: 34b3927
  53791: a8b8a23
  53759: 0a2949e
v: v3
  • Loading branch information
Rusty Russell authored and Andi Kleen committed May 2, 2007
1 parent 960af86 commit e71bc54
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 141f9cfe0a948c8fe26e5669364ee62c03ea42e8
refs/heads/master: 4fbb5968810b237e81977f131986b9efd5245368
4 changes: 1 addition & 3 deletions trunk/arch/i386/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

#include "cpu.h"

DEFINE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr);

DEFINE_PER_CPU(struct desc_struct, cpu_gdt[GDT_ENTRIES]) = {
[GDT_ENTRY_KERNEL_CS] = { 0x0000ffff, 0x00cf9a00 },
[GDT_ENTRY_KERNEL_DS] = { 0x0000ffff, 0x00cf9200 },
Expand Down Expand Up @@ -52,6 +49,7 @@ DEFINE_PER_CPU(struct desc_struct, cpu_gdt[GDT_ENTRIES]) = {
[GDT_ENTRY_ESPFIX_SS] = { 0x00000000, 0x00c09200 },
[GDT_ENTRY_PDA] = { 0x00000000, 0x00c09200 }, /* set in setup_pda */
};
EXPORT_PER_CPU_SYMBOL_GPL(cpu_gdt);

DEFINE_PER_CPU(struct i386_pda, _cpu_pda);
EXPORT_PER_CPU_SYMBOL(_cpu_pda);
Expand Down
16 changes: 8 additions & 8 deletions trunk/arch/i386/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ static void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
{
unsigned long cr4;
unsigned long temp;
struct Xgt_desc_struct *cpu_gdt_descr;
struct Xgt_desc_struct gdt_descr;

spin_lock(&efi_rt_lock);
local_irq_save(efi_rt_eflags);

cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0);

/*
* If I don't have PSE, I should just duplicate two entries in page
* directory. If I have PSE, I just need to duplicate one entry in
Expand Down Expand Up @@ -105,17 +103,19 @@ static void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
*/
local_flush_tlb();

cpu_gdt_descr->address = __pa(cpu_gdt_descr->address);
load_gdt(cpu_gdt_descr);
gdt_descr.address = __pa(get_cpu_gdt_table(0));
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
}

static void efi_call_phys_epilog(void) __releases(efi_rt_lock)
{
unsigned long cr4;
struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0);
struct Xgt_desc_struct gdt_descr;

cpu_gdt_descr->address = (unsigned long)__va(cpu_gdt_descr->address);
load_gdt(cpu_gdt_descr);
gdt_descr.address = (unsigned long)get_cpu_gdt_table(0);
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);

cr4 = read_cr4();

Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/i386/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ END(syscall_badsys)
#define FIXUP_ESPFIX_STACK \
/* since we are on a wrong stack, we cant make it a C code :( */ \
movl %fs:PDA_cpu, %ebx; \
PER_CPU(cpu_gdt_descr, %ebx); \
movl GDS_address(%ebx), %ebx; \
PER_CPU(cpu_gdt, %ebx); \
GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
addl %esp, %eax; \
pushl $__KERNEL_DS; \
Expand Down
12 changes: 6 additions & 6 deletions trunk/arch/i386/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,13 +786,9 @@ static inline struct task_struct * alloc_idle_task(int cpu)
secondary which will soon come up. */
static __cpuinit void init_gdt(int cpu, struct task_struct *idle)
{
struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
struct desc_struct *gdt = per_cpu(cpu_gdt, cpu);
struct desc_struct *gdt = get_cpu_gdt_table(cpu);
struct i386_pda *pda = &per_cpu(_cpu_pda, cpu);

cpu_gdt_descr->address = (unsigned long)gdt;
cpu_gdt_descr->size = GDT_SIZE - 1;

pack_descriptor((u32 *)&gdt[GDT_ENTRY_PDA].a,
(u32 *)&gdt[GDT_ENTRY_PDA].b,
(unsigned long)pda, sizeof(*pda) - 1,
Expand Down Expand Up @@ -1187,7 +1183,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
* it's on the real one. */
static inline void switch_to_new_gdt(void)
{
load_gdt(&per_cpu(cpu_gdt_descr, smp_processor_id()));
struct Xgt_desc_struct gdt_descr;

gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_PDA) : "memory");
}

Expand Down
4 changes: 1 addition & 3 deletions trunk/arch/i386/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,9 +1030,7 @@ fastcall void do_spurious_interrupt_bug(struct pt_regs * regs,
fastcall unsigned long patch_espfix_desc(unsigned long uesp,
unsigned long kesp)
{
int cpu = smp_processor_id();
struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
struct desc_struct *gdt = (struct desc_struct *)cpu_gdt_descr->address;
struct desc_struct *gdt = __get_cpu_var(cpu_gdt);
unsigned long base = (kesp - uesp) & -THREAD_SIZE;
unsigned long new_kesp = kesp - base;
unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT;
Expand Down
7 changes: 2 additions & 5 deletions trunk/include/asm-i386/desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ struct Xgt_desc_struct {
unsigned short pad;
} __attribute__ ((packed));

extern struct Xgt_desc_struct idt_descr;
DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
DECLARE_PER_CPU(struct desc_struct, cpu_gdt[GDT_ENTRIES]);
extern struct Xgt_desc_struct early_gdt_descr;

static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
{
return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
return per_cpu(cpu_gdt, cpu);
}

extern struct Xgt_desc_struct idt_descr;
extern struct desc_struct idt_table[];
extern void set_intr_gate(unsigned int irq, void * addr);

Expand Down

0 comments on commit e71bc54

Please sign in to comment.