Subversion Repositories freemyipod

Rev

Rev 491 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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