3 /* The current plan is to have one sbrk handler for all cpus.
4 Hence use `asm' for each global variable here to avoid the cpu prefix.
5 We can't intrude on the user's namespace (another reason to use asm). */
8 #include <sys/syscall.h>
12 /* These variables are publicly accessible for debugging purposes.
13 The user is also free to set sbrk_size to something different.
16 extern int sbrk_size
asm ("sbrk_size");
18 caddr_t sbrk_start
asm ("sbrk_start");
19 caddr_t sbrk_loc
asm ("sbrk_loc");
21 /*caddr_t _sbrk_r (struct _reent *, size_t) asm ("__sbrk_r");*/
23 /* FIXME: We need a semaphore here. */
26 _sbrk_r (struct _reent
*r
, size_t nbytes
)
31 /* Ensure we don't underflow. */
32 sbrk_loc
+ nbytes
< sbrk_start
33 /* Ensure we don't overflow. */
34 || sbrk_loc
+ nbytes
> sbrk_start
+ sbrk_size
)
37 return ((caddr_t
) -1);