Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71024
b: refs/heads/master
c: de8aacb
h: refs/heads/master
v: v3
  • Loading branch information
Luiz Fernando N. Capitulino authored and Thomas Gleixner committed Oct 17, 2007
1 parent f3b3798 commit 8f38621
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 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: 32c464f5d9701db45bc1673288594e664065388e
refs/heads/master: de8aacbe6a3f3dd7104da09a5535232cd385fdd6
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/i386_ksyms_32.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <linux/module.h>
#include <asm/semaphore.h>
#include <asm/checksum.h>
#include <asm/desc.h>

Expand Down
14 changes: 7 additions & 7 deletions trunk/arch/x86/kernel/ldt_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
struct mm_struct * old_mm;
int retval = 0;

init_MUTEX(&mm->context.sem);
mutex_init(&mm->context.lock);
mm->context.size = 0;
old_mm = current->mm;
if (old_mm && old_mm->context.size > 0) {
down(&old_mm->context.sem);
mutex_lock(&old_mm->context.lock);
retval = copy_ldt(&mm->context, &old_mm->context);
up(&old_mm->context.sem);
mutex_unlock(&old_mm->context.lock);
}
return retval;
}
Expand Down Expand Up @@ -130,15 +130,15 @@ static int read_ldt(void __user * ptr, unsigned long bytecount)
if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES)
bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES;

down(&mm->context.sem);
mutex_lock(&mm->context.lock);
size = mm->context.size*LDT_ENTRY_SIZE;
if (size > bytecount)
size = bytecount;

err = 0;
if (copy_to_user(ptr, mm->context.ldt, size))
err = -EFAULT;
up(&mm->context.sem);
mutex_unlock(&mm->context.lock);
if (err < 0)
goto error_return;
if (size != bytecount) {
Expand Down Expand Up @@ -194,7 +194,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
goto out;
}

down(&mm->context.sem);
mutex_lock(&mm->context.lock);
if (ldt_info.entry_number >= mm->context.size) {
error = alloc_ldt(&current->mm->context, ldt_info.entry_number+1, 1);
if (error < 0)
Expand All @@ -221,7 +221,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
error = 0;

out_unlock:
up(&mm->context.sem);
mutex_unlock(&mm->context.lock);
out:
return error;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/x86/kernel/ptrace_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_

seg &= ~7UL;

down(&child->mm->context.sem);
mutex_lock(&child->mm->context.lock);
if (unlikely((seg >> 3) >= child->mm->context.size))
addr = -1L; /* bogus selector, access would fault */
else {
Expand All @@ -179,7 +179,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_
addr &= 0xffff;
addr += base;
}
up(&child->mm->context.sem);
mutex_unlock(&child->mm->context.lock);
}
return addr;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/x86/mm/fault_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
LDT and other horrors are only used in user space. */
if (seg & (1<<2)) {
/* Must lock the LDT while reading it. */
down(&current->mm->context.sem);
mutex_lock(&current->mm->context.lock);
desc = current->mm->context.ldt;
desc = (void *)desc + (seg & ~7);
} else {
Expand All @@ -118,7 +118,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
base = get_desc_base((unsigned long *)desc);

if (seg & (1<<2)) {
up(&current->mm->context.sem);
mutex_unlock(&current->mm->context.lock);
} else
put_cpu();

Expand Down
4 changes: 2 additions & 2 deletions trunk/include/asm-x86/mmu_32.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __i386_MMU_H
#define __i386_MMU_H

#include <asm/semaphore.h>
#include <linux/mutex.h>
/*
* The i386 doesn't have a mmu context, but
* we put the segment information here.
Expand All @@ -10,7 +10,7 @@
*/
typedef struct {
int size;
struct semaphore sem;
struct mutex lock;
void *ldt;
void *vdso;
} mm_context_t;
Expand Down

0 comments on commit 8f38621

Please sign in to comment.