Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/arm When using EABI, call __aeabi_{i, l}...
details: https://anonhg.NetBSD.org/src/rev/9bfe3a48b09c
branches: trunk
changeset: 786732:9bfe3a48b09c
user: matt <matt%NetBSD.org@localhost>
date: Wed May 08 05:13:56 2013 +0000
description:
When using EABI, call __aeabi_{i,l}div0 when diving by 0.
diffstat:
common/lib/libc/arch/arm/gen/__aeabi_idiv0.c | 7 +++----
common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c | 7 +++----
common/lib/libc/arch/arm/gen/divide.S | 12 +++++++++---
common/lib/libc/arch/arm/gen/divsi3.S | 6 +++++-
common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S | 16 +++++++++++++++-
common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S | 13 ++++++++++++-
6 files changed, 47 insertions(+), 14 deletions(-)
diffs (169 lines):
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/gen/__aeabi_idiv0.c
--- a/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c Wed May 08 05:13:56 2013 +0000
@@ -29,9 +29,9 @@
#include <sys/cdefs.h>
-__RCSID("$NetBSD: __aeabi_idiv0.c,v 1.1 2013/01/23 07:38:19 matt Exp $");
+__RCSID("$NetBSD: __aeabi_idiv0.c,v 1.2 2013/05/08 05:13:56 matt Exp $");
-#if !defined(_KERNEL)
+#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
@@ -44,8 +44,7 @@
int
__aeabi_idiv0(int result)
{
-#ifdef _KERNEL
-#else
+#if !defined(_KERNEL) || !defined(_STANDALONE)
siginfo_t info;
memset(&info, 0, sizeof info);
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c
--- a/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c Wed May 08 05:13:56 2013 +0000
@@ -29,9 +29,9 @@
#include <sys/cdefs.h>
-__RCSID("$NetBSD: __aeabi_ldiv0.c,v 1.1 2013/01/23 07:38:19 matt Exp $");
+__RCSID("$NetBSD: __aeabi_ldiv0.c,v 1.2 2013/05/08 05:13:56 matt Exp $");
-#if !defined(_KERNEL)
+#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
@@ -44,8 +44,7 @@
long long
__aeabi_ldiv0(long long result)
{
-#ifdef _KERNEL
-#else
+#if !defined(_KERNEL) && !defined(_STANDALONE)
siginfo_t info;
memset(&info, 0, sizeof info);
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/gen/divide.S
--- a/common/lib/libc/arch/arm/gen/divide.S Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/gen/divide.S Wed May 08 05:13:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: divide.S,v 1.1 2012/10/30 12:42:13 christos Exp $ */
+/* $NetBSD: divide.S,v 1.2 2013/05/08 05:13:56 matt Exp $ */
/*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -23,14 +23,20 @@
.L_overflow:
#if !defined(_KERNEL) && !defined(_STANDALONE)
+#ifdef __ARM_EABI__
+ mov r0, r1 /* return quotient */
+ b PLT_SYM(__aeabi_idiv0)
+#else
mov r0, #8 /* SIGFPE */
- bl PIC_SYM(_C_LABEL(raise), PLT) /* raise it */
+ bl PLT_SYM(_C_LABEL(raise)) /* raise it */
mov r0, #0
+ RET
+#endif
#else
/* XXX should cause a fatal error */
mvn r0, #0
+ RET
#endif
- RET
.globl __udivide
__udivide: /* r0 = r0 / r1; r1 = r0 % r1 */
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/gen/divsi3.S
--- a/common/lib/libc/arch/arm/gen/divsi3.S Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/gen/divsi3.S Wed May 08 05:13:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: divsi3.S,v 1.4 2012/10/30 12:42:13 christos Exp $ */
+/* $NetBSD: divsi3.S,v 1.5 2013/05/08 05:13:56 matt Exp $ */
/*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -18,5 +18,9 @@
ENTRY_NP(__aeabi_idivmod)
ENTRY_NP(__aeabi_idiv)
+#if defined(__ARM_EABI__) && defined(PIC_SYMVER)
+ .symver __aeabi_idiv,__aeabi_idiv@@GCC_3.5
+ .symver __aeabi_idivmod,__aeabi_idivmod@@GCC_3.5
+#endif
ENTRY(__divsi3)
b __divide
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S
--- a/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S Wed May 08 05:13:56 2013 +0000
@@ -29,9 +29,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: __aeabi_ldivmod.S,v 1.4 2013/05/05 19:02:22 skrll Exp $")
+RCSID("$NetBSD: __aeabi_ldivmod.S,v 1.5 2013/05/08 05:13:56 matt Exp $")
ENTRY(__aeabi_ldivmod)
+ orrs ip, r2, r3
+ beq .Ldivbyzero
+
push {r4-r5, sl, lr}
#define NEG r5
mov NEG, #0
@@ -126,4 +129,15 @@
mov AHI, #0
pop {r4-r5, sl, lr}
RET
+
+.Ldivbyzero:
+ push {r0-r1, ip, lr}
+ cmps AHI, #0
+ mvnge ALO, #0
+ movge AHI, ALO, lsr #1
+ movlt ALO, #0
+ andlt AHI, AHI, #0x800000000
+ bl PLT_SYM(__aeabi_ldiv0)
+ pop {r2-r3, ip, lr}
+ RET
END(__aeabi_ldivmod)
diff -r 802962ada773 -r 9bfe3a48b09c common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S
--- a/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S Wed May 08 04:33:15 2013 +0000
+++ b/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S Wed May 08 05:13:56 2013 +0000
@@ -29,7 +29,7 @@
#include <machine/asm.h>
-RCSID("$NetBSD: __aeabi_uldivmod.S,v 1.4 2013/04/14 17:05:11 skrll Exp $")
+RCSID("$NetBSD: __aeabi_uldivmod.S,v 1.5 2013/05/08 05:13:56 matt Exp $")
/*
* typedef struct { unsigned long long quo, rem } ulldiv_t;
@@ -38,6 +38,9 @@
*/
ENTRY(__aeabi_uldivmod)
+ orrs ip, r2, r3
+ beq .Ldivbyzero
+
push {r4,lr}
sub sp, sp, #16
add ip, sp, #8
@@ -50,4 +53,12 @@
*/
pop {r2-r4,lr}
RET
+
+.Ldivbyzero:
+ push {r0-r1,ip,lr}
+ mvn r0, #0
+ mvn r1, #0
+ bl PLT_SYM(__aeabi_ldiv0)
+ pop {r2-r3,ip,lr}
+ RET
END(__aeabi_uldivmod)
Home |
Main Index |
Thread Index |
Old Index