PSP_LARGE_MEMORY=1 produces invalid PBP

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
kfactor
Posts: 4
Joined: Sat Nov 17, 2007 1:33 am

PSP_LARGE_MEMORY=1 produces invalid PBP

Post by kfactor »

I'm trying to get large memory support for an application, but I've encountered a few problems when trying to build even simple SDK examples with PSP_LARGE_MEMORY=1 set in the makefile.

The first problem is that mksfoex dies with a segfault when called by make.
I'm using a (painfully slow) PowerBook G4 under OSX 10.5, (PowerPC/Big Endian).
With my limited understanding of the code. I've tracked it down to this point in the code (here's an svn diff with my fix):

Code: Select all

--- mksfoex.c	(revision 2409)
+++ mksfoex.c	(working copy)
@@ -303,8 +303,8 @@
 			totalsize = (valsize + 3) & ~3;
 			SW(&e->valsize, valsize);
 			SW(&e->totalsize, totalsize);
-			memset(d, 0, e->totalsize);
-			memcpy(d, g_vals[i].data, e->valsize);
+			memset(d, 0, totalsize);
+			memcpy(d, g_vals[i].data, valsize);
 			d += totalsize;
 		}
 		e++;
The code appears to use the (endian swapped in my case) variable as a count to memcpy and memset.

Having applied this fix though, the produced PBP's are invalid as far as my PSP is concerned.

Could there be more endianness issues with this utility?

As a sidenote, which is the recommended way of enabling big memory support on a PSP Slim application?

I would like to use the standard malloc instead of a custom solution if possible. Also from what I understand PSP_LARGE_MEMORY=1 only affects the PBP build of an application. How could I enable large memory support to the normal, debuggable prx build of an app?

PS: If there are still people having trouble compiling the SDK's GCC on 10.5 with a PowerPC CPU (compiler errors in gcc/config/rs6000/host-darwin.c), I have sourced a patch, which fixes this problem.

Thanks in advance
kFactor
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Hmm there are a few endian bugs in there, probably cause noone complained until now and most people use sensible processors :P I will see if I can fix them all :P

Oh and if you are debugging using psplink or something then build a version of the bootstrap with large memory support (when the tool works of course :P)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Try and new version, I can't promise anything, if that doesn't work then paste a hexdump of a test sfo and I will see if I can work out which bit I have screwed up :P
kfactor
Posts: 4
Joined: Sat Nov 17, 2007 1:33 am

Post by kfactor »

That fixed it. Thanks !

Let me know if there are any parts of the SDK that need testing under OSX or a big endian arch.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well the main issues are the tools and psplinkusb code, though most of that _should_ be stable now :P
Post Reply