ia64/xen-unstable

changeset 3180:4580e96f30e1

bitkeeper revision 1.1159.187.27 (41a99261iejadhs-BVt7TOiimzafww)

Fix IOPL handling.
1. Both Linux 2.4 and 2.6 were not correctly setting IOPL during context
switch (they sent a bogus dom0_op with a bad version number).
2. The switch_vm86 hypercall was corrupting EFLAGS and setting IOPL==0.
author kaf24@scramble.cl.cam.ac.uk
date Sun Nov 28 08:54:57 2004 +0000 (2004-11-28)
parents 0581754a3e58
children ee14738f68ba d24f12a92284 80c006c5f568
files linux-2.4.28-xen-sparse/arch/xen/kernel/process.c linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c xen/arch/x86/x86_32/entry.S
line diff
     1.1 --- a/linux-2.4.28-xen-sparse/arch/xen/kernel/process.c	Sat Nov 27 18:16:32 2004 +0000
     1.2 +++ b/linux-2.4.28-xen-sparse/arch/xen/kernel/process.c	Sun Nov 28 08:54:57 2004 +0000
     1.3 @@ -344,6 +344,7 @@ void fastcall __switch_to(struct task_st
     1.4          op.cmd           = DOM0_IOPL;
     1.5          op.u.iopl.domain = DOMID_SELF;
     1.6          op.u.iopl.iopl   = next->io_pl;
     1.7 +        op.interface_version = DOM0_INTERFACE_VERSION;
     1.8          queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
     1.9      }
    1.10  
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c	Sat Nov 27 18:16:32 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c	Sun Nov 28 08:54:57 2004 +0000
     2.3 @@ -534,6 +534,7 @@ struct task_struct fastcall * __switch_t
     2.4  		op.cmd           = DOM0_IOPL;
     2.5  		op.u.iopl.domain = DOMID_SELF;
     2.6  		op.u.iopl.iopl   = next->io_pl;
     2.7 +		op.interface_version = DOM0_INTERFACE_VERSION;
     2.8  		queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
     2.9  	}
    2.10  
     3.1 --- a/xen/arch/x86/x86_32/entry.S	Sat Nov 27 18:16:32 2004 +0000
     3.2 +++ b/xen/arch/x86/x86_32/entry.S	Sun Nov 28 08:54:57 2004 +0000
     3.3 @@ -585,8 +585,8 @@ do_switch_vm86:
     3.4          # Discard the return address
     3.5          addl $4,%esp
     3.6  
     3.7 -        movl XREGS_eflags(%esp),%ecx
     3.8 -                
     3.9 +        movl XREGS_eflags(%esp),%edx
    3.10 +
    3.11          # GS:ESI == Ring-1 stack activation
    3.12          movl XREGS_esp(%esp),%esi
    3.13  VFLT1:  movl XREGS_ss(%esp),%gs
    3.14 @@ -608,11 +608,11 @@ VFLT3:  movl %gs:(%esi),%eax
    3.15  
    3.16          # Fix up EFLAGS
    3.17          andl $~X86_EFLAGS_IOPL,XREGS_eflags(%esp)
    3.18 -        andl $X86_EFLAGS_IOPL,%ecx # Ignore attempts to change EFLAGS.IOPL
    3.19 +        andl $X86_EFLAGS_IOPL,%edx # Ignore attempts to change EFLAGS.IOPL
    3.20          jnz  1f
    3.21 -        orl  $X86_EFLAGS_IF,%ecx   # EFLAGS.IOPL=0 => no messing with EFLAGS.IF
    3.22 -1:      orl  $X86_EFLAGS_VM,%ecx   # Force EFLAGS.VM
    3.23 -        orl  %ecx,XREGS_eflags(%esp)
    3.24 +        orl  $X86_EFLAGS_IF,%edx   # EFLAGS.IOPL=0 => no messing with EFLAGS.IF
    3.25 +1:      orl  $X86_EFLAGS_VM,%edx   # Force EFLAGS.VM
    3.26 +        orl  %edx,XREGS_eflags(%esp)
    3.27          
    3.28          jmp test_all_events
    3.29