ps2sdk
1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
sbrk.c
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# (C)2001, Gustavo Scotti (gustavo@scotti.com)
7
# (c) 2003 Marcus R. Brown (mrbrown@0xd6.org)
8
# Licenced under Academic Free License version 2.0
9
# Review ps2sdk README & LICENSE files for further details.
10
*/
11
18
#include <
kernel.h
>
19
20
extern
void
*
_end
;
21
22
void
*
ps2_sbrk
(
size_t
increment)
23
{
24
static
void
* _heap_ptr = &
_end
;
25
void
*mp, *ret = (
void
*)-1;
26
27
if
(increment == 0)
28
return
_heap_ptr;
29
30
/* If the area we want to allocated is past the end of our heap, we have a problem. */
31
mp = _heap_ptr + increment;
32
if
(mp <=
EndOfHeap
()) {
33
ret = _heap_ptr;
34
_heap_ptr = mp;
35
}
36
37
return
ret;
38
}
kernel.h
EndOfHeap
void * EndOfHeap(void)
_end
void * _end
ps2_sbrk
void * ps2_sbrk(size_t increment)
Definition:
sbrk.c:22
ee
libc
src
sbrk.c
Generated on Thu Feb 11 2021 11:42:22 for ps2sdk by
1.9.2