Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79972
b: refs/heads/master
c: 80fbb69
h: refs/heads/master
v: v3
  • Loading branch information
Glauber de Oliveira Costa authored and Ingo Molnar committed Jan 30, 2008
1 parent 23ffb2c commit d92c989
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 41 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: 5af725026fe902bf81f1b90b1b9d9ee4b9e1eb6a
refs/heads/master: 80fbb69a8d1268ef48dfe21da80e68cb01922f31
3 changes: 1 addition & 2 deletions trunk/arch/x86/kernel/ldt.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
}
}

ldt.a = LDT_entry_a(&ldt_info);
ldt.b = LDT_entry_b(&ldt_info);
fill_ldt(&ldt, &ldt_info);
if (oldmode)
ldt.avl = 0;

Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,7 @@ static inline void set_32bit_tls(struct task_struct *t, int tls, u32 addr)
};
struct desc_struct *desc = (void *)t->thread.tls_array;
desc += tls;
desc->a = LDT_entry_a(&ud);
desc->b = LDT_entry_b(&ud);
fill_ldt(desc, &ud);
}

static inline u32 read_32bit_tls(struct task_struct *t, int tls)
Expand Down
7 changes: 3 additions & 4 deletions trunk/arch/x86/kernel/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
if (LDT_empty(&info)) {
desc[0] = 0;
desc[1] = 0;
} else {
desc[0] = LDT_entry_a(&info);
desc[1] = LDT_entry_b(&info);
}
} else
fill_ldt((struct desc_struct *)desc, &info);

if (t == &current->thread)
load_TLS(t, cpu);

Expand Down
29 changes: 29 additions & 0 deletions trunk/include/asm-x86/desc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
#ifndef _ASM_DESC_H_
#define _ASM_DESC_H_

#ifndef __ASSEMBLY__
#include <asm/desc_defs.h>
#include <asm/ldt.h>

static inline void fill_ldt(struct desc_struct *desc, struct user_desc *info)
{
desc->limit0 = info->limit & 0x0ffff;
desc->base0 = info->base_addr & 0x0000ffff;

desc->base1 = (info->base_addr & 0x00ff0000) >> 16;
desc->type = (info->read_exec_only ^ 1) << 1;
desc->type |= info->contents << 2;
desc->s = 1;
desc->dpl = 0x3;
desc->p = info->seg_not_present ^ 1;
desc->limit = (info->limit & 0xf0000) >> 16;
desc->avl = info->useable;
desc->d = info->seg_32bit;
desc->g = info->limit_in_pages;
desc->base2 = (info->base_addr & 0xff000000) >> 24;
}

#endif

#ifdef CONFIG_X86_32
# include "desc_32.h"
#else
# include "desc_64.h"
#endif

#endif
15 changes: 0 additions & 15 deletions trunk/include/asm-x86/desc_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,6 @@ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const vo

#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)

#define LDT_entry_a(info) \
((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))

#define LDT_entry_b(info) \
(((info)->base_addr & 0xff000000) | \
(((info)->base_addr & 0x00ff0000) >> 16) | \
((info)->limit & 0xf0000) | \
(((info)->read_exec_only ^ 1) << 9) | \
((info)->contents << 10) | \
(((info)->seg_not_present ^ 1) << 15) | \
((info)->seg_32bit << 22) | \
((info)->limit_in_pages << 23) | \
((info)->useable << 20) | \
0x7000)

#define LDT_empty(info) (\
(info)->base_addr == 0 && \
(info)->limit == 0 && \
Expand Down
17 changes: 0 additions & 17 deletions trunk/include/asm-x86/desc_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,6 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
(unsigned long)addr, DESC_LDT, size * 8 - 1);
}

#define LDT_entry_a(info) \
((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
/* Don't allow setting of the lm bit. It is useless anyways because
64bit system calls require __USER_CS. */
#define LDT_entry_b(info) \
(((info)->base_addr & 0xff000000) | \
(((info)->base_addr & 0x00ff0000) >> 16) | \
((info)->limit & 0xf0000) | \
(((info)->read_exec_only ^ 1) << 9) | \
((info)->contents << 10) | \
(((info)->seg_not_present ^ 1) << 15) | \
((info)->seg_32bit << 22) | \
((info)->limit_in_pages << 23) | \
((info)->useable << 20) | \
/* ((info)->lm << 21) | */ \
0x7000)

#define LDT_empty(info) (\
(info)->base_addr == 0 && \
(info)->limit == 0 && \
Expand Down

0 comments on commit d92c989

Please sign in to comment.