Changing IVPR on the P1021 causes Program Interrupt Exception

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

Changing IVPR on the P1021 causes Program Interrupt Exception

Jump to solution
700 Views
zwilcox
Contributor IV

I'm attempting to change the IVPR.  I'm doing this by setting MSR[EE] = 0, setting the IVPR register, some other initialize stuff, then setting MSR[EE]  = 1.
I then get a program interrupt exception and jump to the new IVPR + IVOR6.   


When I comment out the section that sets IVPR, and interrupts fire, then it jumps to the old IVPR + IVOR4, as expected.
This indicates that I'm doing something wrong when setting IVPR Smiley Sad

MSR[PR] = 0 when I'm setting IVPR and the MSR bits so I'm in supervisor mode.

IVOR4, IVOR6 is 0x500 and 0x700 respectively and don't change.

Below is an abbreviated code of me changing the IVPR:

uint32_t msr_reg = 0;
 __asm__ volatile
 (
 "mfmsr %0 \n"
 : "=r" (msr_reg)
 :
 : "0" /* clobbered register */
 );
 //MSR = 0x2029200 at this point
 msr_reg &= ~MSR_EE_MASK; //MSR_EE_MASK = 0x00008000

 __asm__ volatile
 (
 "mtmsr %0 \n"
 :
 : "r" (msr_reg)
 : "0"
 );
 //MSR = 0x2021200 at this point

 //IVPR = 0x3ff60000 at this point
 uint32_t ivpr = 0x200000;
 __asm__ volatile
 (
 "mtspr ivpr, %0\n"
 :
 : "r" (ivpr)
 );
 //IVPR = 0x00200000 at this point

 /*
 * initializing PIC code
 */

 msr_reg = 0;
 __asm__ volatile
 (
 "mfmsr %0 \n"
 : "=r" (msr_reg)
 :
 : "0" /* clobbered register */
 );
 //MSR = 0x2021200 at this point

 msr_reg |= MSR_EE_MASK; //MSR_EE_MASK = 0x00008000
 __asm__ volatile
 (
 "mtmsr %0 \n"
 :
 : "r" (msr_reg)
 : "0"
 );
 //Sudden jump to new IVPR + IVOR6‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I'd be grateful for any pointers on what I'm doing wrong.

Edit: The problem exists when I change the IVPR manually through the JTAG device :smileyconfused:

Edit: The ESR register is: 0x08000000 indicating an illegal instruction.

Edit:  The SRR0 register is indicating the exception occurred at: IVPR + IVOR10.  

Labels (1)
0 Kudos
1 Solution
551 Views
zwilcox
Contributor IV

The Program Interrupt Exception seemed to be from my interrupt vector not being aligned correct.  
Fixed that.
Then disabled Decrementer interrupt in the TCR register.  

View solution in original post

0 Kudos
1 Reply
552 Views
zwilcox
Contributor IV

The Program Interrupt Exception seemed to be from my interrupt vector not being aligned correct.  
Fixed that.
Then disabled Decrementer interrupt in the TCR register.  

0 Kudos