[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 5/5] xen/x86: Identify reset_stack_and_jump() as noreturn
reset_stack_and_jump() is actually a macro, but can effectively become noreturn by giving it an unreachable() declaration. Propagate the 'noreturn-ness' up through the direct and indirect callers. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> Reviewed-by: Jan Beulich <JBeulich@xxxxxxxx> Reviewed-by: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/domain.c | 6 ++---- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/setup.c | 2 +- xen/include/asm-x86/current.h | 11 +++++++---- xen/include/asm-x86/domain.h | 2 +- xen/include/asm-x86/hvm/vmx/vmx.h | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 6618ae6..c42a079 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -133,12 +133,12 @@ void startup_cpu_idle_loop(void) reset_stack_and_jump(idle_loop); } -static void continue_idle_domain(struct vcpu *v) +static void noreturn continue_idle_domain(struct vcpu *v) { reset_stack_and_jump(idle_loop); } -static void continue_nonidle_domain(struct vcpu *v) +static void noreturn continue_nonidle_domain(struct vcpu *v) { check_wakeup_from_wait(); mark_regs_dirty(guest_cpu_user_regs()); @@ -1521,13 +1521,11 @@ void context_switch(struct vcpu *prev, struct vcpu *next) update_vcpu_system_time(next); schedule_tail(next); - BUG(); } void continue_running(struct vcpu *same) { schedule_tail(same); - BUG(); } int __sync_local_execstate(void) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 61b1ec8..4fd5376 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -911,7 +911,7 @@ static void svm_ctxt_switch_to(struct vcpu *v) wrmsrl(MSR_TSC_AUX, hvm_msr_tsc_aux(v)); } -static void svm_do_resume(struct vcpu *v) +static void noreturn svm_do_resume(struct vcpu *v) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; bool_t debug_state = v->domain->debugger_attached; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index b49256d..addd071 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -541,7 +541,7 @@ static char * __init cmdline_cook(char *p, char *loader_name) return p; } -void __init __start_xen(unsigned long mbi_p) +void __init noreturn __start_xen(unsigned long mbi_p) { char *memmap_type = NULL; char *cmdline, *kextra, *loader; diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index c2792ce..4d1f20e 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -59,10 +59,13 @@ static inline struct cpu_info *get_cpu_info(void) ((sp & (~(STACK_SIZE-1))) + \ (STACK_SIZE - sizeof(struct cpu_info) - sizeof(unsigned long))) -#define reset_stack_and_jump(__fn) \ - __asm__ __volatile__ ( \ - "mov %0,%%"__OP"sp; jmp %c1" \ - : : "r" (guest_cpu_user_regs()), "i" (__fn) : "memory" ) +#define reset_stack_and_jump(__fn) \ + ({ \ + __asm__ __volatile__ ( \ + "mov %0,%%"__OP"sp; jmp %c1" \ + : : "r" (guest_cpu_user_regs()), "i" (__fn) : "memory" ); \ + unreachable(); \ + }) #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu)) diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 4ff89f0..49f7c0c 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -395,7 +395,7 @@ struct arch_vcpu unsigned long flags; /* TF_ */ - void (*schedule_tail) (struct vcpu *); + void noreturn (*schedule_tail) (struct vcpu *); void (*ctxt_switch_from) (struct vcpu *); void (*ctxt_switch_to) (struct vcpu *); diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index 6f6b672..827c97e 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -91,7 +91,7 @@ typedef enum { void vmx_asm_vmexit_handler(struct cpu_user_regs); void vmx_asm_do_vmentry(void); void vmx_intr_assist(void); -void vmx_do_resume(struct vcpu *); +void noreturn vmx_do_resume(struct vcpu *); void vmx_vlapic_msr_changed(struct vcpu *v); void vmx_realmode(struct cpu_user_regs *regs); void vmx_update_debug_state(struct vcpu *v); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |