From 533d76fbc420a8cdca389dbea0d86eb64e0e8096 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 13 Aug 2003 20:08:30 +0000 Subject: Patch from Paul Mundt adding uClibc sh64 support: Here's a patch that implements the beginnings of a rudimentary sh64 port. So far, this only works static, as I haven't done any of the ldso work yet. I've also not touched the libpthread stuff yet either, so that's also disabled for now. This port was based off of some work that Sean McGoogan at SuperH did for his initial port, but the this patch doesn't carry over too much from there (basically the libc/sysdeps/linux/sh64/Makefile (or rather, parts of it), the setjmp/longjmp stuff (which I had to rewrite portions of it to work with the new toolchains), etc.). However, for static, everything appears to work correcly, at least in a hello world type application. --- libc/sysdeps/linux/sh64/sbrk.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 libc/sysdeps/linux/sh64/sbrk.c (limited to 'libc/sysdeps/linux/sh64/sbrk.c') diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c new file mode 100644 index 000000000..c39d60063 --- /dev/null +++ b/libc/sysdeps/linux/sh64/sbrk.c @@ -0,0 +1,25 @@ +/* From libc-5.3.12 */ + +#include +#include +#include + +extern void * ___brk_addr; + +extern int __init_brk (void); +extern void *_brk(void *ptr); + +void * +sbrk(intptr_t increment) +{ + if (__init_brk () == 0) + { + char * tmp = (char*)___brk_addr+increment; + ___brk_addr = _brk(tmp); + if (___brk_addr == tmp) + return tmp-increment; + __set_errno(ENOMEM); + return ((void *) -1); + } + return ((void *) -1); +} -- cgit v1.2.3