Commit 42c24fa2 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Andi Kleen

[PATCH] i386: PARAVIRT: Fix patch site clobbers to include return register

Fix a few clobbers to include the return register.  The clobbers set
is the set of all registers modified (or may be modified) by the code
snippet, regardless of whether it was deliberate or accidental.

Also, make sure that callsites which are used in contexts which don't
allow clobbers actually save and restore all clobberable registers.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Zachary Amsden <zach@vmware.com>
parent d5822035
...@@ -338,7 +338,7 @@ sysenter_past_esp: ...@@ -338,7 +338,7 @@ sysenter_past_esp:
jae syscall_badsys jae syscall_badsys
call *sys_call_table(,%eax,4) call *sys_call_table(,%eax,4)
movl %eax,PT_EAX(%esp) movl %eax,PT_EAX(%esp)
DISABLE_INTERRUPTS(CLBR_ECX|CLBR_EDX) DISABLE_INTERRUPTS(CLBR_ANY)
TRACE_IRQS_OFF TRACE_IRQS_OFF
movl TI_flags(%ebp), %ecx movl TI_flags(%ebp), %ecx
testw $_TIF_ALLWORK_MASK, %cx testw $_TIF_ALLWORK_MASK, %cx
......
...@@ -535,7 +535,7 @@ static inline unsigned long __raw_local_save_flags(void) ...@@ -535,7 +535,7 @@ static inline unsigned long __raw_local_save_flags(void)
"popl %%edx; popl %%ecx") "popl %%edx; popl %%ecx")
: "=a"(f) : "=a"(f)
: paravirt_type(save_fl), : paravirt_type(save_fl),
paravirt_clobber(CLBR_NONE) paravirt_clobber(CLBR_EAX)
: "memory", "cc"); : "memory", "cc");
return f; return f;
} }
...@@ -620,27 +620,29 @@ static inline unsigned long __raw_local_irq_save(void) ...@@ -620,27 +620,29 @@ static inline unsigned long __raw_local_irq_save(void)
.popsection .popsection
#define INTERRUPT_RETURN \ #define INTERRUPT_RETURN \
PARA_SITE(PARA_PATCH(PARAVIRT_iret), CLBR_ANY, \ PARA_SITE(PARA_PATCH(PARAVIRT_iret), CLBR_NONE, \
jmp *%cs:paravirt_ops+PARAVIRT_iret) jmp *%cs:paravirt_ops+PARAVIRT_iret)
#define DISABLE_INTERRUPTS(clobbers) \ #define DISABLE_INTERRUPTS(clobbers) \
PARA_SITE(PARA_PATCH(PARAVIRT_irq_disable), clobbers, \ PARA_SITE(PARA_PATCH(PARAVIRT_irq_disable), clobbers, \
pushl %ecx; pushl %edx; \ pushl %eax; pushl %ecx; pushl %edx; \
call *%cs:paravirt_ops+PARAVIRT_irq_disable; \ call *%cs:paravirt_ops+PARAVIRT_irq_disable; \
popl %edx; popl %ecx) \ popl %edx; popl %ecx; popl %eax) \
#define ENABLE_INTERRUPTS(clobbers) \ #define ENABLE_INTERRUPTS(clobbers) \
PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable), clobbers, \ PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable), clobbers, \
pushl %ecx; pushl %edx; \ pushl %eax; pushl %ecx; pushl %edx; \
call *%cs:paravirt_ops+PARAVIRT_irq_enable; \ call *%cs:paravirt_ops+PARAVIRT_irq_enable; \
popl %edx; popl %ecx) popl %edx; popl %ecx; popl %eax)
#define ENABLE_INTERRUPTS_SYSEXIT \ #define ENABLE_INTERRUPTS_SYSEXIT \
PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable_sysexit), CLBR_ANY, \ PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable_sysexit), CLBR_NONE, \
jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit) jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit)
#define GET_CR0_INTO_EAX \ #define GET_CR0_INTO_EAX \
call *paravirt_ops+PARAVIRT_read_cr0 push %ecx; push %edx; \
call *paravirt_ops+PARAVIRT_read_cr0; \
pop %edx; pop %ecx
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* CONFIG_PARAVIRT */ #endif /* CONFIG_PARAVIRT */
......
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