ia64/xen-unstable

changeset 9616:8970d080f719

Fix long-standing save/restore bug on x86-64.

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Thu Apr 06 16:15:28 2006 +0100 (2006-04-06)
parents 71f74f569b26
children be0a1f376223 71f938468929
files linux-2.6-xen-sparse/drivers/xen/core/reboot.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c	Thu Apr 06 15:55:37 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c	Thu Apr 06 16:15:28 2006 +0100
     1.3 @@ -85,6 +85,23 @@ void smp_resume(void);
     1.4  #define smp_resume()	((void)0)
     1.5  #endif
     1.6  
     1.7 +/* Ensure we run on the idle task page tables so that we will
     1.8 +   switch page tables before running user space. This is needed
     1.9 +   on architectures with separate kernel and user page tables
    1.10 +   because the user page table pointer is not saved/restored. */
    1.11 +static void switch_idle_mm(void)
    1.12 +{
    1.13 +	struct mm_struct *mm = current->active_mm;
    1.14 +
    1.15 +	if (mm == &init_mm)
    1.16 +		return;
    1.17 +
    1.18 +	atomic_inc(&init_mm.mm_count);
    1.19 +	switch_mm(mm, &init_mm, current);
    1.20 +	current->active_mm = &init_mm;
    1.21 +	mmdrop(mm);
    1.22 +}
    1.23 +
    1.24  static int __do_suspend(void *ignore)
    1.25  {
    1.26  	int i, j, k, fpp, err;
    1.27 @@ -164,6 +181,8 @@ static int __do_suspend(void *ignore)
    1.28  
    1.29  	time_resume();
    1.30  
    1.31 +	switch_idle_mm();
    1.32 +
    1.33  	__sti();
    1.34  
    1.35  	xencons_resume();