Installing exception handler

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

Moderators: cheriff, TyRaNiD

Post Reply
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Installing exception handler

Post by m0skit0 »

I've tried but can't get it work...

Tried the sample coming with the PSPSDK, tranformed it into a kernel mode PRX and used it as a plugin. It kind of worked as the regdump appeared. Back to VSH I ran a homebrew with an exception (using _sw(0,0)). Nothing, PSP just froze and shut down.

I've used an EBOOT that loads a kernel mode PRX that also uses pspDebugInstallErrorHandler, then generate an exception from the EBOOT. Just freezes and reboots.

Tried generating the exception from the PRX... Same thing...

Can somebody explain me what I'm doing wrong here?
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

The exception handler in the sdk is abit old now, it doesn't really work in most scenarios, it only worked before because of the fact that kernel ELFs were loaded into user memory regions.

You should use psplink unless you have a good reason not to, otherwise you might need to use psplink's exception code instead and use that in a kernel prx.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

There's a kernel mode prx already out that works with current user mode homebrew. Do a search of old threads. You'll find examples of using it in DaedalusX64 and dosbox.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

Thanks for the replies, guys.

@Tyranid: I've tried using psplink ([offtopic]the best homebrew ever in my opinion, with prxtool; excellent job, man[/offtopic]) several times, both in Linux (Ubuntu 9.04) and Windows (XP Pro SP2), with the same result: errors xD

I got a ta88v3 with CFW Enabler, and that's how I proceed:

I run usbhostfs_pc y pspsh in different terminals

$ ./usbhostfs_pc

Code: Select all

USBHostFS (c) TyRaNiD 2k6
Built Jul  4 2009 02:25:47 - $Revision: 2368 $
Connected to device
$ ./pspsh

Shows in usbhostfs_pc terminal:

Code: Select all

Accepting async connection (0) from 127.0.0.1
Accepting async connection (2) from 127.0.0.1
Accepting async connection (3) from 127.0.0.1
I run PSPLink 3.0 OE on PSP, with USB cable plugged in, and it runs. But when gameboot fades, below the psplink bootstrap message I get:

Code: Select all

Error 8002013B starting module
and back to XMB with "The game could not be started (8002014E)".

Seems like a module in the plugins is corrupted... :P

@J.F: thanks I think I saw it before. Isn't it the thread that Tyranid replies saying to better use pspDebugInstallErrorHandler?
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Odd that, never seen that before. You aren't already running the psplink prx as a plugin or something strange are you as that error code kind of implies the library is already there.

Then again I have never tried it with CF Enabler, people have said they have had psplinkusb running on a PSP-3000 before now so I guess it might work, maybe.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

I mean this: http://forums.ps2dev.org/viewtopic.php?t=9591

That thread links to the post where crazyc first posted the exception prx that people like DX64 are using. It also has the prx and related files in a rar as well.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

@TyRaNiD: I'm running both prxes as plugins; that's what CFE says anyway. The library is already there? How could that be? :P

And yeah, people use psplink on 3K, I know a few. But man, I can't... :P

@J.F.: yeah, just the post I told you about. I downloaded and tried the exception.prx file, but no way, same behaviour :( Tried as plugin, and as a kernel module loaded by an EBOOT. Here's the code I'm using (maybe I'm missing something here...):

Code: Select all

#include <pspsdk.h>

#include <pspkernel.h>

#include <pspdebug.h>

#include <pspctrl.h>



#define PRX_PATH "excephandler.prx"



PSP_MODULE_INFO&#40;"ExcepTrigger",0,0,1&#41;;

PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_USER&#41;;


/* The exception xD */
int exception&#40;&#41;
&#123;
	_sw&#40;0,0&#41;;
&#125;


/* Loop until a key is pressed */

void wait_for_key_press&#40;int button&#41;

&#123;	

	SceCtrlData pad;

	do

	&#123;

		sceCtrlReadBufferPositive&#40;&pad,1&#41;;

	&#125;

	while&#40;!&#40;pad.Buttons & button&#41;&#41;;	

&#125;



int main&#40;int argc, char *argv&#91;&#93;&#41;

&#123;

	SceUID modid;	

	

	pspDebugScreenInit&#40;&#41;;

	

	modid = sceKernelLoadModule&#40;PRX_PATH, 0, NULL&#41;;

	

	if &#40;modid <= 0&#41;

		pspDebugScreenPrintf&#40;"No se pudo cargar el modulo\n"&#41;;

	else

	&#123;	

		pspDebugScreenPrintf&#40;"Arrancando manejador de excepciones...\n"&#41;;

		sceKernelStartModule&#40;modid, 0, NULL, NULL, NULL&#41;;

	&#125;

	sceKernelDelayThread&#40;1000000&#41;;

	

	pspDebugScreenPrintf&#40;"Cargado con exito. "&#41;;		

	pspDebugScreenPrintf&#40;"Pulsa X para ejecutar la excepcion\n"&#41;;

	wait_for_key_press&#40;PSP_CTRL_CROSS&#41;;

	exception&#40;&#41;;
	
	/* No llegamos a ejecutar esto */
	sceKernelExitGame&#40;&#41;;

	

	return 0;

&#125;
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Well, the exception handler prx IS a kernel level prx - mayhap the ChickHEN CFW thingy can't handle that.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

Ok then it should load in kernel mode. I've tried other kernel modules (such as a kernel memory dumper) and they worked just fine...

I don't know what the hell is going on here... But I'm getting a hackable PSP this same week xD

And also, how would I recompile PSPLink? Can't find the sources for the plugins.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Kreationz
Posts: 52
Joined: Sun May 18, 2008 11:01 am

Post by Kreationz »

In DX64 the BSOD's are created by the exception handler, but I personally make sure I can recreate the error then I use psp-gdb to find the code which is causing the error. I've found both to be a very useful tools.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

I've finally managed to make my own exception hanlder, but it lacks some functionality I would be happy someone enlightens me about it.

I used the pspsdk exception sample and transformed it into a PRX, then used it as a game plugin with CFW Enabler. But the problem is that when a load an EBOOT with an exception trigger such as _sw(0,0) or asm("break"), the PSP keeps freezing, just like the plugin wasn't loaded or something. But when the exception is called inside the plugin, the exception handler is called perfectly.

So how can this be? :P

Thanks again!
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

It's a huge pain to do things like printing at the exception level. That's why the exception PRX that's part of DX64 we were talking about redirects the exception to a user function in the program, so that IT can do the printing instead.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

JF wrote:It's a huge pain to do things like printing at the exception level
Well I don't have such problem, I use pspDebugScreenPrintf() (which is user mode, right?) and it works perfectly.

But my question is why the exception, when triggered inside the PRX, is caught by the exception handler, but when triggered outside it (even if the exception handler PRX is loaded) it is not.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Post Reply