After triggering the software interrupt 1
INTC.SSCIR.B.SET = 1; // to trigger a software interrupt.
I'm using this assembly code inside the interrupt service routine to change the PR bit of the MSR register.
1) to read the current MSR value into variable var
var is declared as:
uint32_t var = 0;
__asm__ __volatile__ ("e_lis %r30, (var)@h");
__asm__ __volatile__("e_ori %r30, %r30, (var)@l");
__asm__ __volatile__("mfmsr %r31");
__asm__ __volatile__("e_stw %r31, 0(%r30)");
But the e_ori instruction is intrepretted as e_mulli instruction in the disassembly, therefore its not loading the lower 16 bits into the r30 register, and returning a IVOR1 exception after executing the e_stw instruction.
Is this the correct way to do it? please suggest some solution.
Yes, the code works. Why I would post not working code?
var is defined as global 32-bit variable for me.
Change from user to supervisor is done via system call exception IVOR. (see core reference manual)
Thanks. I have tried calling sm("se_sc"); from my code and have set up an IVOR8_Handler. I have tried masking out the PR bit from the MSR register, but do not know which mnemonic do I use. Please can you expand upon how to change to supervisor mode? Many thanks.