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 

FPU Exception error driving me crazy!

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



Joined: 17 Aug 2006
Posts: 154

PostPosted: Tue Mar 04, 2008 7:20 am    Post subject: FPU Exception error driving me crazy! Reply with quote

I'm having most irritating error EVER!
I have a structure like this one:

Code:
struct ammo_struct
{
   float x;
   float y;
   float xmov;
   float ymov;
   bool draw;
};

But when I try to do ANYTHING with it,like
Code:
ammo[i].x=1;

It gives me FPU Exception error in PSPLink:

Code:
host0:/> ./blowup.prx
Load/Start host0:/blowup.prx UID: 0x04264C2D Name: "blowup"
host0:/> Exception - FPU Exception (IV)
Thread ID - 0x0425C759
Th Name   - user_main
Module ID - 0x04264C2D
Mod Name  - "blowup"
EPC       - 0x088054BC
Cause     - 0x1000003C
BadVAddr  - 0x40A00436
Status    - 0x60088613
zr:0x00000000 at:0x2008FF00 v0:0x08888984 v1:0x000000AA
a0:0x09FBF470 a1:0x000000A0 a2:0x88213168 a3:0x00000001
t0:0x00000002 t1:0x00000000 t2:0x000000FF t3:0x00000030
t4:0x09FBF348 t5:0x00001E04 t6:0x08812B68 t7:0x20088600
s0:0x0889A4DC s1:0x09FBFE34 s2:0x0000000C s3:0x09FBFEE0
s4:0x00000032 s5:0x00000013 s6:0x00000010 s7:0xDEADBEEF
t8:0x000000FF t9:0x000000FF k0:0x09FBFF00 k1:0x00000000
gp:0x088A2480 sp:0x09FBF3A0 fp:0x00000001 ra:0x08804D6C
0x088054BC: 0x4602183C '<..F' - c.lt.s     $fpr03, $fpr02

I have many structures in my program,all of them are working fine,but this is giving me such problems. I've already tried psp-addr2line,but all I get is ??(yes,it's compiled with -g option).Please help

Edit: I've seen that it's possible to disable Fpu Exceptions - how can you do that?
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Mar 04, 2008 8:58 am    Post subject: Reply with quote

For a start you need to subtract the module base address from the EPC to get a relative address for use in psp-addr2line, you could try doing 'calc $epc-$mod' in your psplink shell when it crashes, depends what version of psplink you have as to whether it will work.

As for disabling the fpu exceptions then include pspfpu.h and call pspfpu_set_enable(0);

Based on the instruction it is dying at it looks like the values you are comparing somewhere are completely foobar. You could always try it in GDB.
Back to top
View user's profile Send private message
gambiting



Joined: 17 Aug 2006
Posts: 154

PostPosted: Wed Mar 05, 2008 6:32 am    Post subject: Reply with quote

TyRaNiD wrote:
For a start you need to subtract the module base address from the EPC to get a relative address for use in psp-addr2line, you could try doing 'calc $epc-$mod' in your psplink shell when it crashes, depends what version of psplink you have as to whether it will work.

As for disabling the fpu exceptions then include pspfpu.h and call pspfpu_set_enable(0);

Based on the instruction it is dying at it looks like the values you are comparing somewhere are completely foobar. You could always try it in GDB.
I can't get anything from PSPLINK,even with address calculated your way,but disabling FPU exceptions works for now....but I doubt if it's the best way of handling it.But thanks very much for you input :D
Back to top
View user's profile Send private message
Shapyi



Joined: 25 Apr 2005
Posts: 95

PostPosted: Fri Mar 07, 2008 2:59 am    Post subject: Reply with quote

Setting it like this:

Code:
ammo[i].x = 1.0f;


Is probably more "proper" in terms of coding. It might be throwing an exception because you gave it an int. I dunno, it could be psplink.
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Fri Mar 07, 2008 4:31 am    Post subject: Reply with quote

Are you sure that :
i >=0
and
i < the max bound

Is ammo static-ly defined or dynamically allocated ?
_________________
--pspZorba--
NO to K1.5 !
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