From: Julien Grall Subject: [RFC 10/10] xen/arm: Factorize the C code to dispatch HVC Date: Tue, 15 Dec 2015 17:52:08 +0000 Message-ID: <1450201928-4928-11-git-send-email-julien.grall@citrix.com> References: <1450201928-4928-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a8tzc-0005rl-Fs for xen-devel@lists.xenproject.org; Tue, 15 Dec 2015 18:06:32 +0000 In-Reply-To: <1450201928-4928-1-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Julien Grall , ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Now that Xen hypercall is fully dispatched in assembly, the code to handle HVC32/HVC64 is mostly the same. Create an helper to avoid duplicating the code. Signed-off-by: Julien Grall --- xen/arch/arm/traps.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 3cd8992..a49530a 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1335,6 +1335,20 @@ static void do_trap_psci(struct cpu_user_regs *regs) } } +static void do_trap_hvc(struct cpu_user_regs *regs, uint32_t iss) +{ + +#ifndef NDEBUG + if ( (iss & 0xff00) == 0xff00 ) + return do_debug_trap(regs, iss & 0x00ff); +#endif + if ( iss == 0 ) + return do_trap_psci(regs); + + /* The ISS is not supported */ + domain_crash_synchronous(); +} + static bool_t check_multicall_32bit_clean(struct multicall_entry *multi) { int i; @@ -2406,31 +2420,13 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) case HSR_EC_HVC32: GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr)); perfc_incr(trap_hvc32); -#ifndef NDEBUG - if ( (hsr.iss & 0xff00) == 0xff00 ) - return do_debug_trap(regs, hsr.iss & 0x00ff); -#endif - if ( hsr.iss == 0 ) - return do_trap_psci(regs); - - /* The ISS is not supported */ - domain_crash_synchronous(); - + do_trap_hvc(regs, hsr.iss); break; #ifdef CONFIG_ARM_64 case HSR_EC_HVC64: GUEST_BUG_ON(psr_mode_is_32bit(regs->cpsr)); perfc_incr(trap_hvc64); -#ifndef NDEBUG - if ( (hsr.iss & 0xff00) == 0xff00 ) - return do_debug_trap(regs, hsr.iss & 0x00ff); -#endif - if ( hsr.iss == 0 ) - return do_trap_psci(regs); - - /* The ISS is not supported */ - domain_crash_synchronous(); - + do_trap_hvc(regs, hsr.iss); break; case HSR_EC_SMC64: /* -- 2.1.4