INTC Handler if using SPE instructions in isr

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

INTC Handler if using SPE instructions in isr

1,653 Views
dega
Contributor II

Hi,

can someone suggest how to modify the sw interrupt handler if I want to use SPE instructions inside an ISR?

 

I am coding with S32DS for an MPC5777C; The auto-generated file intc_sw_handlers.s states: "If SPE instructions are used, the stack frame must include the accumulator, and prologue and epilogue must be modified."

 

 

Thanks,

Marco

Original Attachment has been moved to: intc_sw_handlers.S.zip

Labels (1)
Tags (3)
3 Replies

987 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, if you see example I have shared here, I have modified mentioned file to enable SPE:

https://community.nxp.com/docs/DOC-328290 

Note that used compiler was GHS thus there may be some differences.

986 Views
dega
Contributor II

Hi David,

I see that these three lines re-enabe the SPE:

mfmsr r0           # As function prologs/epilogs may contain
e_or2is r0, 0x0200 # SPE instruction, enable SPE, as MSR
mtmsr r0           # register is cleared at this point

However the accumulator is not being saved in the stack, as the header in intc_sw_handlers.s states it should be, Is that not necessary?

I tried with this to save it:

evxor r3, r3, r3     ;# Clear R3
evmwumiaa r3, r3, r3 ;# read SPE accumulator value
se_stw r3, 0x04 (r1) ;# Save SPE accumulator

and this to restore it: 

se_lwz r3, 0x04 (r1) ;# read SPE accumulator
evmra r3, r3         ;# restore SPE accumulator

but then if I use an instruction from mlib in the interrupt everything crashes.

I made a simple project that shows this, can you have a look?

Another question: how do I set up the error handler for IVOR32? Because I can not see what is the exception that crashes the program.

Thanks,

Marco

0 Kudos

986 Views
dega
Contributor II

Hi David,

I was saving just the lowest 32 bit of r3, using evstdd and evldd doens't crash anymore.

I am still struggling with the exception I had earlier, how can I handle it to see where was the problem?

Regards,
Marco