Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24872
b: refs/heads/master
c: 54d8d3b
h: refs/heads/master
v: v3
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Mar 31, 2006
1 parent dcc381c commit 4f6f21c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 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: dd77aec07aec5cb81aed3b4ef79c1ff8bd0e2a68
refs/heads/master: 54d8d3b5a0ce1cdbad1d3154c9ea9732d394e9c7
7 changes: 7 additions & 0 deletions trunk/arch/um/kernel/skas/process_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,17 @@ void fork_handler(int sig)
panic("blech");

schedule_tail(current->thread.prev_sched);

/* XXX: if interrupt_end() calls schedule, this call to
* arch_switch_to_skas isn't needed. We could want to apply this to
* improve performance. -bb */
arch_switch_to_skas(current->thread.prev_sched, current);

current->thread.prev_sched = NULL;

/* Handle any immediate reschedules or signals */
interrupt_end();

userspace(&current->thread.regs.regs);
}

Expand Down
9 changes: 8 additions & 1 deletion trunk/arch/um/sys-i386/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ void arch_switch_to_tt(struct task_struct *from, struct task_struct *to)

void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
{
arch_switch_tls_skas(from, to);
int err = arch_switch_tls_skas(from, to);
if (!err)
return;

if (err != -EINVAL)
printk(KERN_WARNING "arch_switch_tls_skas failed, errno %d, not EINVAL\n", -err);
else
printk(KERN_WARNING "arch_switch_tls_skas failed, errno = EINVAL\n");
}

int is_syscall(unsigned long addr)
Expand Down
13 changes: 10 additions & 3 deletions trunk/arch/um/sys-i386/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ static int get_free_idx(struct task_struct* task)
return -ESRCH;
}

#define O_FORCE 1

static inline void clear_user_desc(struct user_desc* info)
{
/* Postcondition: LDT_empty(info) returns true. */
Expand All @@ -84,6 +82,8 @@ static inline void clear_user_desc(struct user_desc* info)
info->seg_not_present = 1;
}

#define O_FORCE 1

static int load_TLS(int flags, struct task_struct *to)
{
int ret = 0;
Expand Down Expand Up @@ -162,7 +162,13 @@ void clear_flushed_tls(struct task_struct *task)
* SKAS patch. */
int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to)
{
return load_TLS(O_FORCE, to);
/* We have no need whatsoever to switch TLS for kernel threads; beyond
* that, that would also result in us calling os_set_thread_area with
* userspace_pid[cpu] == 0, which gives an error. */
if (likely(to->mm))
return load_TLS(O_FORCE, to);

return 0;
}

int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to)
Expand Down Expand Up @@ -324,3 +330,4 @@ int ptrace_get_thread_area(struct task_struct *child, int idx,
out:
return ret;
}

0 comments on commit 4f6f21c

Please sign in to comment.