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(¤t->thread.regs.regs);
}
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)
return -ESRCH;
}
-#define O_FORCE 1
-
static inline void clear_user_desc(struct user_desc* info)
{
/* Postcondition: LDT_empty(info) returns true. */
info->seg_not_present = 1;
}
+#define O_FORCE 1
+
static int load_TLS(int flags, struct task_struct *to)
{
int ret = 0;
* 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)
out:
return ret;
}
+