Hi All
I am facing some issue with mtmsr assembly instruction while trying to write into msr register of MPC8641D.
below is my code which is compiling successfully but get runtime error as illegal instruction.
register long toMSR;
register long fromMSR;
asm ("mfmsr %0;"
: "=r" (fromMSR) // output operand
);
printf("after mfmsr");
asm("mtmsr %0;"
: "r" (toMSR) // input operand
);
printf(" after mtmsr");
Output:
after mfmsr
illegal instruction -- error
what could be the possible error in the above code?
is the syntax is correct?
c
Hi Marius
I am using Buildroot cross compiler for MP8641HPCN architecture.
I am not using any Code Warrior. I am just building an userspace application and trying
in my board loaded with linux.
Hi Heinz
Thanks for your reply. So You mean I dont have any write access from userspace to change the MSR.
Is my understanding correct??
Thank you
Lachu
Hi Heinz
As you told me I understood that I cannot use msmtr instruction in userspace. I am now writing the msr register in uboot initialization and verifying what I have written. I am trying to write an application to run on uboot. prior to that I tried running the hello_world demo example in uboot. I am facing issue with loads command. after going through some web sources I understood it may be a problem in load address.
Now I want to know how should I separate the application from compiling along with uboot so that i dont want to compile uboot everytime I want to compile my application.
or do we have any other replacement to wrtie into MSR and other special purpose registers in userspace application(using movw instruction).
Regards
Lakshmanan K
Hi,
Please find below an example about using mtmsr instruction with MW compiler from CW Classic:
asm void __reset(void)
{
//
// Enable altivec, floating point and machine check exception
//
lis r3, 0x0200
ori r3, r3, 0x3000
mtmsr r3
b __start
}
What toolchain/compiler are you using? Can you tell me please also your CW version?
Regards and thank you,
Marius