Allocating an Ordering Table with calloc3/malloc3
Posted: April 7th, 2020, 4:21 am
Hey everyone,
I have a silly question again >o< Don't get mad at me!
For my "game" I prepared an OrderingTable for some elements by declaring globaly:
And setting them up with:
This works all fine! I'm happy x3 And the story could end there buuuut! I wanted to be really cutting edge and wanted to allocate a dynamic OrderingTable using calloc3. So I prepared the memory allocation with:
And well... allocated a new GsOT, GsOT_Tag - just like I did in the global memory. Running my code however makes NO$PSX not happy at all! I replies with: "endless link-chain in gpu linked list dma" and the screen goes all fancy.
I played around with this a bit! Using the old calloc for allocation will make the code work. I figured out that calloc3 allocates like at the end of the heap, while calloc allocates at the start of the heap. So I guess it has to do something with really high addresses? But since the GsOT and GsOT_Tag are both allocated via calloc3, they wouldn't have big offsets...
I feel like I do something fundamentaly wrong :/ Sorry again >o<
I have a silly question again >o< Don't get mad at me!
For my "game" I prepared an OrderingTable for some elements by declaring globaly:
Code: Select all
#define OT_LENGTH 10
GsOT Wot[2];
GsOT_TAG zsorttable[2][1 << OT_LENGTH];
int activeBuffer;
Code: Select all
// set OT resolution
Wot[0].length = OT_LENGTH;
Wot[1].length = OT_LENGTH;
//set OT on OT handler(0)
Wot[0].org = zsorttable[0];
Wot[1].org = zsorttable[1];
Code: Select all
extern u_char* const __heapbase;
extern unsigned long __heapsize;
inline void setupHeap()
{
InitHeap3((unsigned long*)__heapbase, __heapsize);
}
I played around with this a bit! Using the old calloc for allocation will make the code work. I figured out that calloc3 allocates like at the end of the heap, while calloc allocates at the start of the heap. So I guess it has to do something with really high addresses? But since the GsOT and GsOT_Tag are both allocated via calloc3, they wouldn't have big offsets...
I feel like I do something fundamentaly wrong :/ Sorry again >o<