more usb compatiblity changes from rodries
[libogc.git] / libogc / lwp_stack.c
blob05eadebfc4f94e6b0803ce39a53001ac071cd7de
1 #include <stdlib.h>
2 #include "lwp_stack.h"
3 #include "lwp_wkspace.h"
5 u32 __lwp_stack_allocate(lwp_cntrl *thethread,u32 size)
7 void *stack_addr = NULL;
9 if(!__lwp_stack_isenough(size))
10 size = CPU_MINIMUM_STACK_SIZE;
12 size = __lwp_stack_adjust(size);
13 stack_addr = __lwp_wkspace_allocate(size);
15 if(!stack_addr) size = 0;
17 thethread->stack = stack_addr;
18 return size;
21 void __lwp_stack_free(lwp_cntrl *thethread)
23 if(!thethread->stack_allocated)
24 return;
26 __lwp_wkspace_free(thethread->stack);