From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] stubdom: x86_32 compilation fix Date: Tue, 26 Feb 2008 15:01:31 +0000 Message-ID: <20080226150131.GD10008@implementation.uk.xensource.com> References: <20080219113941.GF21201@edwin-srv.sh.intel.com> <20080225115635.GD4380@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20080225115635.GD4380@implementation.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org stubdom: fix x86_32 compilation by __moddi3 from FreeBSD (like has been done previously for umoddi3 etc.) Signed-off-by: Samuel Thibault diff -r 09af1b46f89f extras/mini-os/lib/math.c --- a/extras/mini-os/lib/math.c Tue Feb 26 13:12:55 2008 +0000 +++ b/extras/mini-os/lib/math.c Tue Feb 26 14:57:50 2008 +0000 @@ -388,6 +388,30 @@ __umoddi3(u_quad_t a, u_quad_t b) return (r); } +/* + * Return remainder after dividing two signed quads. + * + * XXX + * If -1/2 should produce -1 on this machine, this code is wrong. + */ +quad_t +__moddi3(a, b) + quad_t a, b; +{ + u_quad_t ua, ub, ur; + int neg; + + if (a < 0) + ua = -(u_quad_t)a, neg = 1; + else + ua = a, neg = 0; + if (b < 0) + ub = -(u_quad_t)b; + else + ub = b; + (void)__qdivrem(ua, ub, &ur); + return (neg ? -ur : ur); +} #endif /* !defined(__ia64__) */ #ifndef HAVE_LIBC