summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/sh64/brk.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-08-13 20:08:30 +0000
committerEric Andersen <andersen@codepoet.org>2003-08-13 20:08:30 +0000
commit533d76fbc420a8cdca389dbea0d86eb64e0e8096 (patch)
tree122e91e59f3b0d1b346a30c2b90320980db0935d /libc/sysdeps/linux/sh64/brk.c
parentae3cf778c3155c085468fe72a47ddd696a1b5a00 (diff)
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.
Diffstat (limited to 'libc/sysdeps/linux/sh64/brk.c')
-rw-r--r--libc/sysdeps/linux/sh64/brk.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c
new file mode 100644
index 000000000..4f97fb084
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/brk.c
@@ -0,0 +1,22 @@
+/* From libc-5.3.12 */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+extern void * ___brk_addr;
+
+extern int __init_brk (void);
+extern void *_brk(void *ptr);
+
+int brk(void * end_data_seg)
+{
+ if (__init_brk () == 0)
+ {
+ ___brk_addr = _brk(end_data_seg);
+ if (___brk_addr == end_data_seg)
+ return 0;
+ __set_errno(ENOMEM);
+ }
+ return -1;
+}