Last change
on this file since 458 was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.1 KB
|
Line | |
---|
1 | /* Copyright (c) 2013 Red Hat, Inc. All rights reserved. |
---|
2 | |
---|
3 | This copyrighted material is made available to anyone wishing to use, modify, |
---|
4 | copy, or redistribute it subject to the terms and conditions of the BSD |
---|
5 | License. This program is distributed in the hope that it will be useful, |
---|
6 | but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties |
---|
7 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license |
---|
8 | is available at http://www.opensource.org/licenses. Any Red Hat trademarks that |
---|
9 | are incorporated in the source code or documentation are not subject to the BSD |
---|
10 | License and may only be used or replicated with the express permission of |
---|
11 | Red Hat, Inc. |
---|
12 | */ |
---|
13 | |
---|
14 | char * |
---|
15 | _sbrk (int adj) |
---|
16 | { |
---|
17 | extern char end[]; /* Defined in the linker script. */ |
---|
18 | static char * heap = end; |
---|
19 | char * rv = heap; |
---|
20 | char * sp = (char *) & sp; /* Stack grows down, heap grows up... */ |
---|
21 | |
---|
22 | if (heap + adj > sp) |
---|
23 | { |
---|
24 | #define MESSAGE "Heap and stack collision\n" |
---|
25 | write (1, MESSAGE, sizeof MESSAGE); |
---|
26 | abort (); |
---|
27 | } |
---|
28 | |
---|
29 | heap += adj; |
---|
30 | return rv; |
---|
31 | } |
---|
32 | |
---|
33 | char * sbrk (int) __attribute__((weak, alias ("_sbrk"))); |
---|
Note: See
TracBrowser
for help on using the repository browser.