forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Installing exception handler

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sun Jul 05, 2009 8:10 am    Post subject: Installing exception handler Reply with quote

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.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sun Jul 05, 2009 8:13 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Jul 05, 2009 8:50 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sun Jul 05, 2009 6:51 pm    Post subject: Reply with quote

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:
USBHostFS (c) TyRaNiD 2k6
Built Jul  4 2009 02:25:47 - $Revision: 2368 $
Connected to device

$ ./pspsh

Shows in usbhostfs_pc terminal:
Code:
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:
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.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Mon Jul 06, 2009 2:31 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jul 06, 2009 4:15 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Mon Jul 06, 2009 6:57 am    Post subject: Reply with quote

@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:
#include <pspsdk.h>

#include <pspkernel.h>

#include <pspdebug.h>

#include <pspctrl.h>



#define PRX_PATH "excephandler.prx"



PSP_MODULE_INFO("ExcepTrigger",0,0,1);

PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);


/* The exception xD */
int exception()
{
   _sw(0,0);
}


/* Loop until a key is pressed */

void wait_for_key_press(int button)

{   

   SceCtrlData pad;

   do

   {

      sceCtrlReadBufferPositive(&pad,1);

   }

   while(!(pad.Buttons & button));   

}



int main(int argc, char *argv[])

{

   SceUID modid;   

   

   pspDebugScreenInit();

   

   modid = sceKernelLoadModule(PRX_PATH, 0, NULL);

   

   if (modid <= 0)

      pspDebugScreenPrintf("No se pudo cargar el modulo\n");

   else

   {   

      pspDebugScreenPrintf("Arrancando manejador de excepciones...\n");

      sceKernelStartModule(modid, 0, NULL, NULL, NULL);

   }

   sceKernelDelayThread(1000000);

   

   pspDebugScreenPrintf("Cargado con exito. ");      

   pspDebugScreenPrintf("Pulsa X para ejecutar la excepcion\n");

   wait_for_key_press(PSP_CTRL_CROSS);

   exception();
   
   /* No llegamos a ejecutar esto */
   sceKernelExitGame();

   

   return 0;

}

_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jul 06, 2009 8:18 am    Post subject: Reply with quote

Well, the exception handler prx IS a kernel level prx - mayhap the ChickHEN CFW thingy can't handle that.
Back to top
View user's profile Send private message AIM Address
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Mon Jul 06, 2009 9:16 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Kreationz



Joined: 18 May 2008
Posts: 53

PostPosted: Tue Jul 07, 2009 9:32 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Fri Jul 10, 2009 6:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jul 11, 2009 12:22 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Sat Jul 11, 2009 2:46 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group