I am working on the MMU protect project of GSOC2011 using the PSIM environment(Powerpc 6xx).<br><br>When I try to set the Ks and Kp bit of SR(segment register), the value never changed successfully.<br>I use the functions defined in spr.h like:<br>
_write_SR(0, 0x60000000) ;/*I want to set the Ks and Kp bit*/<br> _read_SR(0x51000) ;<br>the asm actually used is <br> /*write*/ <br> asm volatile("mtsrin %0,%1" : : "r"(val), "r" (va): "memory");<br>
/*read*/<br> asm volatile("mfsrin %0,%1" : "=r" (val): "r" (va));<br><br>when I use these SR functions , the MSR value is 0xa072 (or 0x2042), the MSR[PR] bit which control the Privilege level is 0, as expected.<br>
<br clear="all">But the return of _read_SR is always 0. Is there anything I should notice when change or get the SR value?<br><br>Any feedback will be welcome<br>Thank you <br>-- <br>Best regards<br><br>Quanming Shi<br>
<br>