Segment Register problem on PSIM

Joel Sherrill joel.sherrill at
Wed Aug 17 18:56:49 UTC 2011

Check the psim source in gdb. May not be implemented.


Quanming Shi <shiquanming10 at> wrote:

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

More information about the users mailing list