Subversion Repositories freemyipod

Rev

Rev 538 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
492 theseven 1
//
2
//
3
//    Copyright 2011 TheSeven
4
//
5
//
6
//    This file is part of emCORE.
7
//
8
//    emCORE is free software: you can redistribute it and/or
9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
13
//    emCORE is distributed in the hope that it will be useful,
14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
19
//    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//
22
 
23
 
24
#include "emcoreapp.h"
25
#undef memset
26
#undef memmove
27
#undef memcpy
28
#undef memcmp
29
 
30
 
31
int __clzsi2(int arg) __attribute__((naked,noinline));
32
int __clzsi2(int arg)
33
{
538 theseven 34
    __asm__ volatile("ldr\tr12, =__emcore_syscall\n\tldr\tr12, [r12]\n\tldr\tpc, [r12,#8]\n\t.ltorg\n\t");
492 theseven 35
}
36
 
37
// This one has a non-standard calling convention, so we just declare it as void
38
void __aeabi_idivmod(void) __attribute__((naked,noinline));
39
void __aeabi_idivmod(void)
40
{
538 theseven 41
    __asm__ volatile("ldr\tr12, =__emcore_syscall\n\tldr\tr12, [r12]\n\tldr\tpc, [r12,#0xc]\n\t.ltorg\n\t");
492 theseven 42
}
43
 
44
// This one has a non-standard calling convention, so we just declare it as void
45
void __aeabi_uidivmod(void) __attribute__((naked,noinline));
46
void __aeabi_uidivmod(void)
47
{
538 theseven 48
    __asm__ volatile("ldr\tr12, =__emcore_syscall\n\tldr\tr12, [r12]\n\tldr\tpc, [r12,#0x10]\n\t.ltorg\n\t");
492 theseven 49
}
50
 
51
extern __attribute__((alias("__aeabi_idivmod"))) void __aeabi_idiv(void);
52
extern __attribute__((alias("__aeabi_uidivmod"))) void __aeabi_uidiv(void);
53
 
491 theseven 54
void* memset(void *dst, int c, size_t length)
55
{
56
    return __emcore_syscall->memset(dst, c, length);
57
}
58
 
59
void* memmove(void *dst, const void *src, size_t length)
60
{
61
    return __emcore_syscall->memmove(dst, src, length);
62
}
63
 
64
void* memcpy(void *dst, const void *src, size_t length)
65
{
66
    return __emcore_syscall->memcpy(dst, src, length);
67
}
68
 
69
int memcmp(const void *src1, const void *src2, size_t length)
70
{
71
    return __emcore_syscall->memcmp(src1, src2, length);
72
}