From 71150804d1ac8ed2f7b9c6d3025fd415c58b129e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 15 Jul 2004 07:34:00 +0000 Subject: h8300 updates from Yoshinori Sato --- libc/sysdeps/linux/h8300/brk.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 libc/sysdeps/linux/h8300/brk.c (limited to 'libc/sysdeps/linux/h8300/brk.c') diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c new file mode 100644 index 000000000..71de9501f --- /dev/null +++ b/libc/sysdeps/linux/h8300/brk.c @@ -0,0 +1,33 @@ +/* brk on H8/300 by ysato */ + +#include +#include +#include + + +/* This must be initialized data because commons can't have aliases. */ +void *___brk_addr = 0; + + +int brk (void *addr) +{ + void *newbrk; + + asm ("mov.l %2,er1\n\t" + "mov.l %1,er0\n\t" + "trapa #0\n\t" + "mov.l er0,%0" + : "=r" (newbrk) + : "0" (__NR_brk), "g" (addr) + : "er0","er1"); + + ___brk_addr = newbrk; + + if (newbrk < addr) + { + __set_errno (ENOMEM); + return -1; + } + + return 0; +} -- cgit v1.2.3