mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86: Assert !in_atomic() before exiting to guest context.
Signed-off-by: Keir Fraser <keir@xen.org>
This commit is contained in:
1 parent
b07423c7ce
commit
143c33f1bc
6 files changed
+18
No files matched your search
@@ -42,6 +42,7 @@
|
||||
ENTRY(svm_asm_do_resume)
|
||||
call svm_intr_assist
|
||||
call_with_regs(nsvm_vcpu_switch)
|
||||
ASSERT_NOT_IN_ATOMIC
|
||||
|
||||
get_current(bx)
|
||||
CLGI
|
||||
|
||||
@@ -98,6 +98,7 @@ vmx_asm_vmexit_handler:
|
||||
vmx_asm_do_vmentry:
|
||||
call vmx_intr_assist
|
||||
call nvmx_switch_guest
|
||||
ASSERT_NOT_IN_ATOMIC
|
||||
|
||||
get_current(bx)
|
||||
cli
|
||||
|
||||
@@ -92,6 +92,7 @@ compat_skip_clobber:
|
||||
|
||||
/* %rbx: struct vcpu */
|
||||
ENTRY(compat_test_all_events)
|
||||
ASSERT_NOT_IN_ATOMIC
|
||||
cli # tests must not race interrupts
|
||||
/*compat_test_softirqs:*/
|
||||
movl VCPU_processor(%rbx),%eax
|
||||
|
||||
@@ -190,6 +190,7 @@ skip_clobber:
|
||||
|
||||
/* %rbx: struct vcpu */
|
||||
test_all_events:
|
||||
ASSERT_NOT_IN_ATOMIC
|
||||
cli # tests must not race interrupts
|
||||
/*test_softirqs:*/
|
||||
movl VCPU_processor(%rbx),%eax
|
||||
|
||||
@@ -30,3 +30,9 @@ bool_t in_atomic(void)
|
||||
{
|
||||
return preempt_count() || in_irq() || !local_irq_is_enabled();
|
||||
}
|
||||
|
||||
/* asm helper */
|
||||
void bug_if_in_atomic(void)
|
||||
{
|
||||
BUG_ON(in_atomic());
|
||||
}
|
||||
@@ -59,6 +59,14 @@ void ret_from_intr(void);
|
||||
GET_STACK_BASE(reg); \
|
||||
__GET_CURRENT(reg)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT_NOT_IN_ATOMIC \
|
||||
sti; /* sometimes called with interrupts disabled: safe to enable */ \
|
||||
call bug_if_in_atomic
|
||||
#else
|
||||
#define ASSERT_NOT_IN_ATOMIC
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __X86_ASM_DEFNS_H__ */
|
||||