x86: modify write_ldt function

This patch modifies the write_ldt() function to make use
of the new struct desc_struct instead of entry_1 and entry_2
entries

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Glauber de Oliveira Costa 2008-01-30 13:31:13 +01:00 committed by Ingo Molnar
parent 25deca53e9
commit 5af725026f
1 changed files with 7 additions and 8 deletions

View File

@ -186,7 +186,7 @@ static int read_default_ldt(void __user *ptr, unsigned long bytecount)
static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
{ {
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
__u32 entry_1, entry_2; struct desc_struct ldt;
int error; int error;
struct user_desc ldt_info; struct user_desc ldt_info;
@ -218,21 +218,20 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
/* Allow LDTs to be cleared by the user. */ /* Allow LDTs to be cleared by the user. */
if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
if (oldmode || LDT_empty(&ldt_info)) { if (oldmode || LDT_empty(&ldt_info)) {
entry_1 = 0; memset(&ldt, 0, sizeof(ldt));
entry_2 = 0;
goto install; goto install;
} }
} }
entry_1 = LDT_entry_a(&ldt_info); ldt.a = LDT_entry_a(&ldt_info);
entry_2 = LDT_entry_b(&ldt_info); ldt.b = LDT_entry_b(&ldt_info);
if (oldmode) if (oldmode)
entry_2 &= ~(1 << 20); ldt.avl = 0;
/* Install the new entry ... */ /* Install the new entry ... */
install: install:
write_ldt_entry(mm->context.ldt, ldt_info.entry_number, entry_1, write_ldt_entry(mm->context.ldt, ldt_info.entry_number,
entry_2); ldt.a, ldt.b);
error = 0; error = 0;
out_unlock: out_unlock: