[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] When creating exception/interrupt stack frames for a guest,
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID d916497135acf19d48c39e08eedefff621210996 # Parent c405c0d1b49b755585b615241389fd5350623dbf When creating exception/interrupt stack frames for a guest, set saved eflags.IF to !saved_upcall_mask. This allows the guest to test interrupts-enabled in the interrupted context in the same way as when running natively. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r c405c0d1b49b -r d916497135ac linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c Thu Nov 10 11:12:00 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c Thu Nov 10 14:03:33 2005 @@ -650,7 +650,7 @@ static inline void conditional_sti(struct pt_regs *regs) { - if ((uint8_t)(regs->xcs >> 16) == 0) + if (regs->eflags & (X86_EFLAGS_IF|VM_MASK)) local_irq_enable(); } diff -r c405c0d1b49b -r d916497135ac linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c Thu Nov 10 11:12:00 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c Thu Nov 10 14:03:33 2005 @@ -300,9 +300,8 @@ if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, SIGSEGV) == NOTIFY_STOP) return; - /* It's safe to allow irq's after cr2 has been saved */ - if ((uint8_t)(regs->xcs >> 16) == 0) + if (regs->eflags & (X86_EFLAGS_IF|VM_MASK)) local_irq_enable(); tsk = current; diff -r c405c0d1b49b -r d916497135ac linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c Thu Nov 10 11:12:00 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c Thu Nov 10 14:03:33 2005 @@ -89,7 +89,7 @@ static inline void conditional_sti(struct pt_regs *regs) { - if ((uint8_t)(regs->cs >> 32) == 0) + if (regs->eflags & X86_EFLAGS_IF) local_irq_enable(); } diff -r c405c0d1b49b -r d916497135ac linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c Thu Nov 10 11:12:00 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c Thu Nov 10 14:03:33 2005 @@ -351,7 +351,7 @@ SIGSEGV) == NOTIFY_STOP) return; - if (likely((uint8_t)(regs->cs >> 32) == 0)) + if (likely(regs->eflags & X86_EFLAGS_IF)) local_irq_enable(); if (unlikely(page_fault_trace)) diff -r c405c0d1b49b -r d916497135ac xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu Nov 10 11:12:00 2005 +++ b/xen/arch/x86/domain.c Thu Nov 10 14:03:33 2005 @@ -647,7 +647,7 @@ regs->rip = stu.rip; regs->cs = stu.cs | 3; /* force guest privilege */ - regs->rflags = stu.rflags; + regs->rflags = (stu.rflags & ~(EF_IOPL|EF_VM)) | EF_IE; regs->rsp = stu.rsp; regs->ss = stu.ss | 3; /* force guest privilege */ diff -r c405c0d1b49b -r d916497135ac xen/arch/x86/x86_32/entry.S --- a/xen/arch/x86/x86_32/entry.S Thu Nov 10 11:12:00 2005 +++ b/xen/arch/x86/x86_32/entry.S Thu Nov 10 14:03:33 2005 @@ -156,7 +156,7 @@ * By this time, all the setups in the VMCS must be complete. */ .if \launch - /* VMLUANCH */ + /* VMLAUNCH */ .byte 0x0f,0x01,0xc2 pushf call vm_launch_fail @@ -394,7 +394,12 @@ shll $16,%eax # Bits 16-23: saved_upcall_mask movw UREGS_cs+4(%esp),%ax # Bits 0-15: CS FLT15: movl %eax,%gs:4(%esi) + test $0x00FF0000,%eax # Bits 16-23: saved_upcall_mask + setz %ch # %ch == !saved_upcall_mask movl UREGS_eflags+4(%esp),%eax + andl $~X86_EFLAGS_IF,%eax + shlb $1,%ch # Bit 9 (EFLAGS.IF) + orb %ch,%ah # Fold EFLAGS.IF into %eax FLT16: movl %eax,%gs:8(%esi) test $TBF_EXCEPTION_ERRCODE,%cl jz 1f diff -r c405c0d1b49b -r d916497135ac xen/arch/x86/x86_64/entry.S --- a/xen/arch/x86/x86_64/entry.S Thu Nov 10 11:12:00 2005 +++ b/xen/arch/x86/x86_64/entry.S Thu Nov 10 14:03:33 2005 @@ -352,8 +352,6 @@ FLT2: movq %rax,32(%rsi) # SS movq UREGS_rsp+8(%rsp),%rax FLT3: movq %rax,24(%rsi) # RSP - movq UREGS_eflags+8(%rsp),%rax -FLT4: movq %rax,16(%rsi) # RFLAGS movq VCPU_vcpu_info(%rbx),%rax pushq VCPUINFO_upcall_mask(%rax) testb $TBF_INTERRUPT,%cl @@ -362,7 +360,15 @@ popq %rax shlq $32,%rax # Bits 32-39: saved_upcall_mask movw UREGS_cs+8(%rsp),%ax # Bits 0-15: CS -FLT5: movq %rax,8(%rsi) # CS/saved_upcall_mask +FLT4: movq %rax,8(%rsi) # CS / saved_upcall_mask + shrq $32,%rax + testb $0xFF,%al # Bits 0-7: saved_upcall_mask + setz %ch # %ch == !saved_upcall_mask + movq UREGS_eflags+8(%rsp),%rax + andq $~X86_EFLAGS_IF,%rax + shlb $1,%ch # Bit 9 (EFLAGS.IF) + orb %ch,%ah # Fold EFLAGS.IF into %eax +FLT5: movq %rax,16(%rsi) # RFLAGS movq UREGS_rip+8(%rsp),%rax FLT6: movq %rax,(%rsi) # RIP testb $TBF_EXCEPTION_ERRCODE,%cl diff -r c405c0d1b49b -r d916497135ac xen/include/public/arch-x86_32.h --- a/xen/include/public/arch-x86_32.h Thu Nov 10 11:12:00 2005 +++ b/xen/include/public/arch-x86_32.h Thu Nov 10 14:03:33 2005 @@ -90,7 +90,7 @@ uint16_t cs; uint8_t saved_upcall_mask; uint8_t _pad0; - uint32_t eflags; + uint32_t eflags; /* eflags.IF == !saved_upcall_mask */ uint32_t esp; uint16_t ss, _pad1; uint16_t es, _pad2; diff -r c405c0d1b49b -r d916497135ac xen/include/public/arch-x86_64.h --- a/xen/include/public/arch-x86_64.h Thu Nov 10 11:12:00 2005 +++ b/xen/include/public/arch-x86_64.h Thu Nov 10 14:03:33 2005 @@ -154,7 +154,7 @@ uint16_t cs, _pad0[1]; uint8_t saved_upcall_mask; uint8_t _pad1[3]; - __DECL_REG(flags); + __DECL_REG(flags); /* rflags.IF == !saved_upcall_mask */ __DECL_REG(sp); uint16_t ss, _pad2[3]; uint16_t es, _pad3[3]; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |