Commit 5679732a authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/linux-2.5

into samba.org:/scratch/anton/sfr
parents d2429752 36f06199
...@@ -40,6 +40,7 @@ void enable_sep_cpu(void *info) ...@@ -40,6 +40,7 @@ void enable_sep_cpu(void *info)
int cpu = get_cpu(); int cpu = get_cpu();
struct tss_struct *tss = init_tss + cpu; struct tss_struct *tss = init_tss + cpu;
tss->ss1 = __KERNEL_CS;
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp0, 0); wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp0, 0);
wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0); wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
......
...@@ -291,7 +291,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk ...@@ -291,7 +291,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
tss = init_tss + smp_processor_id(); tss = init_tss + smp_processor_id();
tss->esp0 = tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; tss->esp0 = tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
disable_sysenter(); disable_sysenter(tss);
tsk->thread.screen_bitmap = info->screen_bitmap; tsk->thread.screen_bitmap = info->screen_bitmap;
if (info->flags & VM86_SCREEN_BITMAP) if (info->flags & VM86_SCREEN_BITMAP)
......
...@@ -347,7 +347,7 @@ struct tss_struct { ...@@ -347,7 +347,7 @@ struct tss_struct {
unsigned long esp0; unsigned long esp0;
unsigned short ss0,__ss0h; unsigned short ss0,__ss0h;
unsigned long esp1; unsigned long esp1;
unsigned short ss1,__ss1h; unsigned short ss1,__ss1h; /* ss1 is used to cache MSR_IA32_SYSENTER_CS */
unsigned long esp2; unsigned long esp2;
unsigned short ss2,__ss2h; unsigned short ss2,__ss2h;
unsigned long __cr3; unsigned long __cr3;
...@@ -413,15 +413,20 @@ static inline void load_esp0(struct tss_struct *tss, unsigned long esp0) ...@@ -413,15 +413,20 @@ static inline void load_esp0(struct tss_struct *tss, unsigned long esp0)
{ {
tss->esp0 = esp0; tss->esp0 = esp0;
if (cpu_has_sep) { if (cpu_has_sep) {
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); if (tss->ss1 != __KERNEL_CS) {
tss->ss1 = __KERNEL_CS;
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
}
wrmsr(MSR_IA32_SYSENTER_ESP, esp0, 0); wrmsr(MSR_IA32_SYSENTER_ESP, esp0, 0);
} }
} }
static inline void disable_sysenter(void) static inline void disable_sysenter(struct tss_struct *tss)
{ {
if (cpu_has_sep) if (cpu_has_sep) {
tss->ss1 = 0;
wrmsr(MSR_IA32_SYSENTER_CS, 0, 0); wrmsr(MSR_IA32_SYSENTER_CS, 0, 0);
}
} }
#define start_thread(regs, new_eip, new_esp) do { \ #define start_thread(regs, new_eip, new_esp) do { \
......
...@@ -1273,7 +1273,7 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave) ...@@ -1273,7 +1273,7 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
spin_unlock_irq(&nanosleep_abs_list_lock); spin_unlock_irq(&nanosleep_abs_list_lock);
} }
if (active) { if (active) {
unsigned long jiffies_f = jiffies; long jiffies_left;
/* /*
* Always restart abs calls from scratch to pick up any * Always restart abs calls from scratch to pick up any
...@@ -1282,7 +1282,12 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave) ...@@ -1282,7 +1282,12 @@ do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
if (abs) if (abs)
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
jiffies_to_timespec(new_timer.expires - jiffies_f, tsave); jiffies_left = new_timer.expires - jiffies;
if (jiffies_left < 0)
return 0;
jiffies_to_timespec(jiffies_left, tsave);
while (tsave->tv_nsec < 0) { while (tsave->tv_nsec < 0) {
tsave->tv_nsec += NSEC_PER_SEC; tsave->tv_nsec += NSEC_PER_SEC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment