22#define IH_C_BOUND 0x0001
24extern int _iop_reboot_count;
28#ifdef F_SifInitIopHeap
36 static int _rb_count = 0;
37 if (_rb_count != _iop_reboot_count) {
38 _rb_count = _iop_reboot_count;
39 memset(&_ih_cd, 0,
sizeof _ih_cd);
41 memset(&_ih_caps, 0,
sizeof _ih_caps);
49 while ((res = SifBindRpc(&_ih_cd, 0x80000003, 0)) >= 0 && !_ih_cd.server)
55 _ih_caps |= IH_C_BOUND;
61#ifdef F_SifExitIopHeap
65 memset(&_ih_caps, 0,
sizeof _ih_caps);
69#ifdef F_SifAllocIopHeap
70void *SifAllocIopHeap(
int size)
78 if (SifInitIopHeap() < 0)
83 if (SifCallRpc(&_ih_cd, 1, 0, &arg, 4, &arg, 4, NULL, NULL) < 0)
86 return (
void *)arg.addr;
90#ifdef F_SifFreeIopHeap
91int SifFreeIopHeap(
void *addr)
99 if (SifInitIopHeap() < 0)
104 if (SifCallRpc(&_ih_cd, 2, 0, &arg, 4, &arg, 4, NULL, NULL) < 0)
111#ifdef F_SifLoadIopHeap
112int SifLoadIopHeap(
const char *path,
void *addr)
116 if (SifInitIopHeap() < 0)
120 strncpy(arg.path, path, LIH_PATH_MAX - 1);
121 arg.path[LIH_PATH_MAX - 1] = 0;
123 if (SifCallRpc(&_ih_cd, 3, 0, &arg,
sizeof arg, &arg, 4, NULL, NULL) < 0)