1
0
Fork 0
forked from len0rd/rockbox
foxbox/apps/plugins/lib/gcc-support.c
Aidan MacDonald 6ea328f0f1 arm: add div0 handler for 64-bit division on ARMv7-M
Even though ARMv7-M has a hardware divider, 64-bit division is
handled in software and needs a div0 handler. The libgcc routines
call __aeabi_{i,l}div0 so we alias those to __div0.

Change-Id: I5152c43d39e25e03f31404753f13978a614aca06
2025-04-19 09:43:40 -04:00

55 lines
1.6 KiB
C

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2009 by Michael Sevakis
*
* Miscellaneous compiler support routines.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied
*
****************************************************************************/
#include "plugin.h"
#if defined(ARM_NEED_DIV0)
void __attribute__((naked)) __div0(void)
{
asm volatile("bx %0" : : "r"(rb->__div0));
}
#if defined(CPU_ARM_MICRO)
void __aeabi_idiv0(void) __attribute__((alias("__div0")));
void __aeabi_ldiv0(void) __attribute__((alias("__div0")));
#endif
#endif
void *memcpy(void *dest, const void *src, size_t n)
{
return rb->memcpy(dest, src, n);
}
void *memset(void *dest, int c, size_t n)
{
return rb->memset(dest, c, n);
}
void *memmove(void *dest, const void *src, size_t n)
{
return rb->memmove(dest, src, n);
}
int memcmp(const void *s1, const void *s2, size_t n)
{
return rb->memcmp(s1, s2, n);
}