FPU Exception error driving me crazy!

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

Moderators: cheriff, TyRaNiD

Post Reply
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

FPU Exception error driving me crazy!

Post by gambiting »

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

Code: Select all

struct ammo_struct
{
	float x;
	float y;
	float xmov;
	float ymov;
	bool draw;
};
But when I try to do ANYTHING with it,like

Code: Select all

ammo[i].x=1;
It gives me FPU Exception error in PSPLink:

Code: Select all

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&#58; 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?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

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.
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

Post by gambiting »

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
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Setting it like this:

Code: Select all

ammo&#91;i&#93;.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.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

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

Is ammo static-ly defined or dynamically allocated ?
--pspZorba--
NO to K1.5 !
Post Reply