ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
sbrk.c File Reference
#include <kernel.h>
+ Include dependency graph for sbrk.c:

Go to the source code of this file.

Functions

void * ps2_sbrk (size_t increment)
 

Variables

void * _end
 

Detailed Description

EE kernel sbrk function Primary function to malloc - reserved

Definition in file sbrk.c.

Function Documentation

◆ ps2_sbrk()

void* ps2_sbrk ( size_t  increment)

Definition at line 22 of file sbrk.c.

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 }
void * EndOfHeap(void)
void * _end

References _end, and EndOfHeap().

Referenced by _sbrk().

Variable Documentation

◆ _end

void* _end
extern

Referenced by ps2_sbrk().