From: Ian Campbell Subject: [PATCH V2 17/46] xen: arm64: div64 Date: Thu, 14 Feb 2013 16:47:31 +0000 Message-ID: <1360860480-9245-17-git-send-email-ian.campbell@citrix.com> References: <1360860465.20449.472.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1360860465.20449.472.camel@zakaz.uk.xensource.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.xen.org Cc: stefano.stabellini@citrix.com, tim@xen.org, Ian Campbell List-Id: xen-devel@lists.xenproject.org Signed-off-by: Ian Campbell Acked-by: Tim Deegan --- xen/include/asm-arm/div64.h | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/xen/include/asm-arm/div64.h b/xen/include/asm-arm/div64.h index 7b00808..d5bdc76 100644 --- a/xen/include/asm-arm/div64.h +++ b/xen/include/asm-arm/div64.h @@ -21,6 +21,19 @@ * calling convention for arguments and results (beware). */ + +#if BITS_PER_LONG == 64 + +# define do_div(n,base) ({ \ + uint32_t __base = (base); \ + uint32_t __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ + }) + +#elif BITS_PER_LONG == 32 + #ifdef __ARMEB__ #define __xh "r0" #define __xl "r1" @@ -222,7 +235,9 @@ __nr; \ }) -#endif +#endif /* GCC version */ + +#endif /* BITS_PER_LONG */ #endif /* -- 1.7.2.5