Most hypercall are identical in source code, using a common MACRO to define 0/1/2 parameter(s) hypercall is much simple.
arch/ia64/xen/hypercall.S | 154 +++++++++++++----------------------------- include/asm-ia64/xen/privop.h | 26 ------- 2 files changed, 51 insertions(+), 129 deletions(-) Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]> diff --git a/arch/ia64/xen/hypercall.S b/arch/ia64/xen/hypercall.S index 615dad9..ce7b015 100644 --- a/arch/ia64/xen/hypercall.S +++ b/arch/ia64/xen/hypercall.S @@ -2,79 +2,64 @@ * Support routines for Xen hypercalls * * Copyright (C) 2005 Dan Magenheimer <[EMAIL PROTECTED]> + * Copyright (C) 2008 Yaozu (Eddie) Dong <[EMAIL PROTECTED]> */ #include <asm/asmmacro.h> #include <asm/intrinsics.h> -GLOBAL_ENTRY(xen_get_psr) - XEN_HYPER_GET_PSR - br.ret.sptk.many rp - ;; -END(xen_get_psr) - -GLOBAL_ENTRY(xen_get_ivr) - XEN_HYPER_GET_IVR - br.ret.sptk.many rp - ;; -END(xen_get_ivr) - -GLOBAL_ENTRY(xen_get_tpr) - XEN_HYPER_GET_TPR - br.ret.sptk.many rp - ;; -END(xen_get_tpr) - -GLOBAL_ENTRY(xen_set_tpr) - mov r8=r32 - XEN_HYPER_SET_TPR - br.ret.sptk.many rp - ;; -END(xen_set_tpr) - -GLOBAL_ENTRY(xen_eoi) - mov r8=r32 - XEN_HYPER_EOI - br.ret.sptk.many rp - ;; -END(xen_eoi) - -GLOBAL_ENTRY(xen_thash) - mov r8=r32 - XEN_HYPER_THASH - br.ret.sptk.many rp - ;; -END(xen_thash) - -GLOBAL_ENTRY(xen_set_itm) - mov r8=r32 - XEN_HYPER_SET_ITM - br.ret.sptk.many rp - ;; -END(xen_set_itm) +/* + * Hypercalls without parameter. + */ +#define __HCALL0(name,hcall) \ + GLOBAL_ENTRY(name); \ + break hcall; \ + br.ret.sptk.many rp; \ + END(name) -GLOBAL_ENTRY(xen_ptcga) - mov r8=r32 - mov r9=r33 - XEN_HYPER_PTC_GA - br.ret.sptk.many rp - ;; -END(xen_ptcga) +/* + * Hypercalls with 1 parameter. + */ +#define __HCALL1(name,hcall) \ + GLOBAL_ENTRY(name); \ + mov r8=r32; \ + break hcall; \ + br.ret.sptk.many rp; \ + END(name) -GLOBAL_ENTRY(xen_get_rr) - mov r8=r32 - XEN_HYPER_GET_RR - br.ret.sptk.many rp - ;; -END(xen_get_rr) +/* + * Hypercalls with 2 parameters. + */ +#define __HCALL2(name,hcall) \ + GLOBAL_ENTRY(name); \ + mov r8=r32; \ + mov r9=r33; \ + break hcall; \ + br.ret.sptk.many rp; \ + END(name) + +__HCALL0(xen_get_psr, HYPERPRIVOP_GET_PSR) +__HCALL0(xen_get_ivr, HYPERPRIVOP_GET_IVR) +__HCALL0(xen_get_tpr, HYPERPRIVOP_GET_TPR) +__HCALL0(xen_hyper_ssm_i, HYPERPRIVOP_SSM_I) + +__HCALL1(xen_set_tpr, HYPERPRIVOP_SET_TPR) +__HCALL1(xen_eoi, HYPERPRIVOP_EOI) +__HCALL1(xen_thash, HYPERPRIVOP_THASH) +__HCALL1(xen_set_itm, HYPERPRIVOP_SET_ITM) +__HCALL1(xen_get_rr, HYPERPRIVOP_GET_RR) +__HCALL1(xen_fc, HYPERPRIVOP_FC) +__HCALL1(xen_get_cpuid, HYPERPRIVOP_GET_CPUID) +__HCALL1(xen_get_pmd, HYPERPRIVOP_GET_PMD) + +__HCALL2(xen_ptcga, HYPERPRIVOP_PTC_GA) +__HCALL2(xen_set_rr, HYPERPRIVOP_SET_RR) +__HCALL2(xen_set_kr, HYPERPRIVOP_SET_KR) -GLOBAL_ENTRY(xen_set_rr) - mov r8=r32 - mov r9=r33 - XEN_HYPER_SET_RR - br.ret.sptk.many rp - ;; -END(xen_set_rr) +#ifdef CONFIG_IA32_SUPPORT +__HCALL1(xen_get_eflag, HYPERPRIVOP_GET_EFLAG) +__HCALL1(xen_set_eflag, HYPERPRIVOP_SET_EFLAG) // refer SDM vol1 3.1.8 +#endif /* CONFIG_IA32_SUPPORT */ GLOBAL_ENTRY(xen_set_rr0_to_rr4) mov r8=r32 @@ -87,45 +72,6 @@ GLOBAL_ENTRY(xen_set_rr0_to_rr4) ;; END(xen_set_rr0_to_rr4) -GLOBAL_ENTRY(xen_set_kr) - mov r8=r32 - mov r9=r33 - XEN_HYPER_SET_KR - br.ret.sptk.many rp -END(xen_set_kr) - -GLOBAL_ENTRY(xen_fc) - mov r8=r32 - XEN_HYPER_FC - br.ret.sptk.many rp -END(xen_fc) - -GLOBAL_ENTRY(xen_get_cpuid) - mov r8=r32 - XEN_HYPER_GET_CPUID - br.ret.sptk.many rp -END(xen_get_cpuid) - -GLOBAL_ENTRY(xen_get_pmd) - mov r8=r32 - XEN_HYPER_GET_PMD - br.ret.sptk.many rp -END(xen_get_pmd) - -#ifdef CONFIG_IA32_SUPPORT -GLOBAL_ENTRY(xen_get_eflag) - XEN_HYPER_GET_EFLAG - br.ret.sptk.many rp -END(xen_get_eflag) - -// some bits aren't set if pl!=0, see SDM vol1 3.1.8 -GLOBAL_ENTRY(xen_set_eflag) - mov r8=r32 - XEN_HYPER_SET_EFLAG - br.ret.sptk.many rp -END(xen_set_eflag) -#endif /* CONFIG_IA32_SUPPORT */ - GLOBAL_ENTRY(xen_send_ipi) mov r14=r32 mov r15=r33 diff --git a/include/asm-ia64/xen/privop.h b/include/asm-ia64/xen/privop.h index 7657d37..e69380a 100644 --- a/include/asm-ia64/xen/privop.h +++ b/include/asm-ia64/xen/privop.h @@ -35,22 +35,8 @@ #define XEN_HYPER_ITC_I break HYPERPRIVOP_ITC_I #define XEN_HYPER_SSM_I break HYPERPRIVOP_SSM_I #define XEN_HYPER_GET_IVR break HYPERPRIVOP_GET_IVR -#define XEN_HYPER_GET_TPR break HYPERPRIVOP_GET_TPR -#define XEN_HYPER_SET_TPR break HYPERPRIVOP_SET_TPR -#define XEN_HYPER_EOI break HYPERPRIVOP_EOI -#define XEN_HYPER_SET_ITM break HYPERPRIVOP_SET_ITM #define XEN_HYPER_THASH break HYPERPRIVOP_THASH -#define XEN_HYPER_PTC_GA break HYPERPRIVOP_PTC_GA #define XEN_HYPER_ITR_D break HYPERPRIVOP_ITR_D -#define XEN_HYPER_GET_RR break HYPERPRIVOP_GET_RR -#define XEN_HYPER_SET_RR break HYPERPRIVOP_SET_RR -#define XEN_HYPER_SET_KR break HYPERPRIVOP_SET_KR -#define XEN_HYPER_FC break HYPERPRIVOP_FC -#define XEN_HYPER_GET_CPUID break HYPERPRIVOP_GET_CPUID -#define XEN_HYPER_GET_PMD break HYPERPRIVOP_GET_PMD -#define XEN_HYPER_GET_EFLAG break HYPERPRIVOP_GET_EFLAG -#define XEN_HYPER_SET_EFLAG break HYPERPRIVOP_SET_EFLAG -#define XEN_HYPER_GET_PSR break HYPERPRIVOP_GET_PSR #define XEN_HYPER_SET_RR0_TO_RR4 break HYPERPRIVOP_SET_RR0_TO_RR4 #define XSI_IFS (XSI_BASE + XSI_IFS_OFS) @@ -70,7 +56,6 @@ #endif #ifndef __ASSEMBLY__ -#define XEN_HYPER_SSM_I asm("break %0" : : "i" (HYPERPRIVOP_SSM_I)) #define XEN_HYPER_GET_IVR asm("break %0" : : "i" (HYPERPRIVOP_GET_IVR)) /************************************************/ @@ -120,22 +105,13 @@ extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */ #define xen_get_virtual_pend() \ (*(((uint8_t *)XEN_MAPPEDREGS->interrupt_mask_addr) - 1)) -/* Hyperprivops are "break" instructions with a well-defined API. - * In particular, the virtual psr.ic bit must be off; in this way - * it is guaranteed to never conflict with a linux break instruction. - * Normally, this is done in a xen stub but this one is frequent enough - * that we inline it */ -#define xen_hyper_ssm_i() \ -({ \ - XEN_HYPER_SSM_I; \ -}) - /* Although all privileged operations can be left to trap and will * be properly handled by Xen, some are frequent enough that we use * hyperprivops for performance. */ extern unsigned long xen_get_psr(void); extern unsigned long xen_get_ivr(void); extern unsigned long xen_get_tpr(void); +extern void xen_hyper_ssm_i(void); extern void xen_set_itm(unsigned long); extern void xen_set_tpr(unsigned long); extern void xen_eoi(unsigned long);
hypcall.patch
Description: hypcall.patch
_______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel