Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79734
b: refs/heads/master
c: fc2d625
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent 0622168 commit c2d91f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 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: 4edc8f5454814201d2fb222354284365b4f0537c
refs/heads/master: fc2d625c4fac18e672a3b7c61af5de22d7ab7d87
8 changes: 3 additions & 5 deletions trunk/arch/x86/kernel/ldt_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
{
struct task_struct *me = current;
struct mm_struct *mm = me->mm;
__u32 entry_1, entry_2, *lp;
__u32 entry_1, entry_2;
int error;
struct user_desc ldt_info;

Expand Down Expand Up @@ -202,8 +202,6 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
goto out_unlock;
}

lp = (__u32 *)((ldt_info.entry_number << 3) + (char *)mm->context.ldt);

/* Allow LDTs to be cleared by the user. */
if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
if (oldmode || LDT_empty(&ldt_info)) {
Expand All @@ -220,8 +218,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)

/* Install the new entry ... */
install:
*lp = entry_1;
*(lp+1) = entry_2;
write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1,
entry_2);
error = 0;

out_unlock:
Expand Down
9 changes: 9 additions & 0 deletions trunk/include/asm-x86/desc_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ extern struct desc_struct default_ldt[];
extern struct gate_struct idt_table[];
extern struct desc_ptr cpu_gdt_descr[];

static inline void write_ldt_entry(struct desc_struct *ldt,
int entry, u32 entry_low, u32 entry_high)
{
__u32 *lp = (__u32 *)((entry << 3) + (char *)ldt);

lp[0] = entry_low;
lp[1] = entry_high;
}

/* the cpu gdt accessor */
#define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address)

Expand Down

0 comments on commit c2d91f7

Please sign in to comment.