Date: Mon, 2 Jan 2012 09:56:41 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r229270 - in projects/arm_eabi/sys: conf libkern/arm Message-ID: <201201020956.q029ufFB058288@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Mon Jan 2 09:56:40 2012 New Revision: 229270 URL: http://svn.freebsd.org/changeset/base/229270 Log: Implement the required __aeabi_* functions by the Kernel Added: projects/arm_eabi/sys/libkern/arm/ldivmod.S projects/arm_eabi/sys/libkern/arm/ldivmod_helper.c Modified: projects/arm_eabi/sys/conf/files.arm projects/arm_eabi/sys/libkern/arm/divsi3.S Modified: projects/arm_eabi/sys/conf/files.arm ============================================================================== --- projects/arm_eabi/sys/conf/files.arm Mon Jan 2 09:53:47 2012 (r229269) +++ projects/arm_eabi/sys/conf/files.arm Mon Jan 2 09:56:40 2012 (r229270) @@ -63,6 +63,8 @@ geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr libkern/arm/divsi3.S standard libkern/arm/ffs.S standard +libkern/arm/ldivmod.S standard +libkern/arm/ldivmod_helper.c standard libkern/arm/muldi3.c standard libkern/ashldi3.c standard libkern/ashrdi3.c standard Modified: projects/arm_eabi/sys/libkern/arm/divsi3.S ============================================================================== --- projects/arm_eabi/sys/libkern/arm/divsi3.S Mon Jan 2 09:53:47 2012 (r229269) +++ projects/arm_eabi/sys/libkern/arm/divsi3.S Mon Jan 2 09:56:40 2012 (r229270) @@ -49,6 +49,10 @@ ENTRY_NP(__modsi3) #endif RET +#ifdef __ARM_EABI__ +ENTRY_NP(__aeabi_uidiv) +ENTRY_NP(__aeabi_uidivmod) +#endif ENTRY_NP(__udivsi3) .L_udivide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 @@ -71,6 +75,10 @@ ENTRY_NP(__udivsi3) mov r1, #0 RET +#ifdef __ARM_EABI__ +ENTRY_NP(__aeabi_idiv) +ENTRY_NP(__aeabi_idivmod) +#endif ENTRY_NP(__divsi3) .L_divide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 Added: projects/arm_eabi/sys/libkern/arm/ldivmod.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arm_eabi/sys/libkern/arm/ldivmod.S Mon Jan 2 09:56:40 2012 (r229270) @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <machine/asm.h> +__FBSDID("$FreeBSD$"); + +ENTRY_NP(__aeabi_ldivmod) + sub sp, sp, #8 /* Space for the remainder */ + stmfd sp!, {sp, lr} /* Sace the rem pointer and lr */ + bl PIC_SYM(_C_LABEL(__kern_ldivmod), PLT) + ldr lr, [sp, #4] /* Restore lr */ + add sp, sp, #8 /* Move sp to the remainder value */ + ldmfd sp!, {r2, r3} /* Load the remainder */ + RET + +ENTRY_NP(__aeabi_uldivmod) + sub sp, sp, #8 /* Space for the remainder */ + stmfd sp!, {sp, lr} /* Sace the rem pointer and lr */ + bl PIC_SYM(_C_LABEL(__qdivrem), PLT) + ldr lr, [sp, #4] /* Restore lr */ + add sp, sp, #8 /* Move sp to the remainder value */ + ldmfd sp!, {r2, r3} /* Load the remainder */ + RET + Added: projects/arm_eabi/sys/libkern/arm/ldivmod_helper.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/arm_eabi/sys/libkern/arm/ldivmod_helper.c Mon Jan 2 09:56:40 2012 (r229270) @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <libkern/quad.h> + +/* + * Helper for __aeabi_ldivmod. + * TODO: __divdi3 calls __qdivrem. We should do the same and use the + * remainder value rather than re-calculating it. + */ +long long __kern_ldivmod(long long, long long, long long *); + +long long +__kern_ldivmod(long long n, long long m, long long *rem) +{ + long long q; + + q = __divdi3(n, m); /* q = n / m */ + *rem = n - m * q; + + return q; +} +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201020956.q029ufFB058288>