9 unsigned long* InitRam;
10 unsigned long* StartRam;
11 unsigned long InitSizeRam;
12 unsigned long ZeroSizeRam;
15 extern unsigned long __cs3_regions;
16 extern unsigned long __cs3_heap_start;
19 void __libc_init_array(void);
20 void exit(int ErrorCode);
22 static void *heap_pointer = NULL;
24 void __cs3_start_c(void) {
25 static SCS3Regions* pCS3Regions = (SCS3Regions*)&__cs3_regions;
26 unsigned long* pulDest;
27 unsigned long* pulSrc;
28 unsigned long ByteCount;
31 pulSrc = pCS3Regions->InitRam;
32 pulDest = pCS3Regions->StartRam;
33 ByteCount = pCS3Regions->InitSizeRam;
34 if (pulSrc != pulDest) {
35 for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
36 *(pulDest++) = *(pulSrc++);
39 pulDest = (unsigned long*)(void*)((char*)pulDest + ByteCount);
42 ByteCount = pCS3Regions->ZeroSizeRam;
43 for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
47 heap_pointer = &__cs3_heap_start;
52 int _kill(int pid, int sig) {
57 void _exit(int status) {
65 void *_sbrk(unsigned int incr) {
68 unsigned int next = ((((unsigned int)heap_pointer + incr) + 7) & ~7);
69 if (next > __get_MSP()) {
72 mem = (void *)heap_pointer;
74 heap_pointer = (void *)next;