5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
23 #include <sys/types.h>
33 unsigned char * heap
= (unsigned char *)&_end
;
35 extern caddr_t
_sbrk(int nbytes
)
37 if (heap
+ nbytes
< (unsigned char *)&_heap_end
) {
38 unsigned char * prev_heap
= heap
;
40 return (caddr_t
)prev_heap
;
48 #if !defined(SEMIHOSTING)
49 extern int _gettimeofday(void *p1
, void *p2
)
54 extern int _link(char *old
, char *nw
)
59 extern int _unlink(const char *path
)
64 extern int _open(const char *name
, int flags
, int mode
)
69 extern int _close(int file
)
74 extern int _fstat(int file
, struct stat
* st
)
76 st
->st_mode
= S_IFCHR
;
80 extern int _isatty(int file
)
85 extern int _lseek(int file
, int ptr
, int dir
)
90 extern int _read(int file
, char *ptr
, int len
)
95 extern int _write(int file
, char *ptr
, int len
)
100 extern void _exit(int status
)
102 TRACE("_exit(%d)", status
);
106 extern void _kill(int pid
, int sig
)