Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #include <asm/ppc_asm.h>
0003 #include <asm/asm-compat.h>
0004 
0005 /* unsigned long xmon_mfspr(sprn, default_value) */
0006 _GLOBAL(xmon_mfspr)
0007     PPC_LL  r5, .Lmfspr_table@got(r2)
0008     b   xmon_mxspr
0009 
0010 /* void xmon_mtspr(sprn, new_value) */
0011 _GLOBAL(xmon_mtspr)
0012     PPC_LL  r5, .Lmtspr_table@got(r2)
0013     b   xmon_mxspr
0014 
0015 /*
0016  * r3 = sprn
0017  * r4 = default or new value
0018  * r5 = table base
0019  */
0020 xmon_mxspr:
0021     /*
0022      * To index into the table of mxsprs we need:
0023      *  i = (sprn & 0x3ff) * 8
0024      * or using rwlinm:
0025      *  i = (sprn << 3) & (0x3ff << 3)
0026      */
0027     rlwinm  r3, r3, 3, 0x3ff << 3
0028     add r5, r5, r3
0029     mtctr   r5
0030     mr  r3, r4 /* put default_value in r3 for mfspr */
0031     bctr
0032 
0033 .Lmfspr_table:
0034     spr = 0
0035     .rept   1024
0036     mfspr   r3, spr
0037     blr
0038     spr = spr + 1
0039     .endr
0040 
0041 .Lmtspr_table:
0042     spr = 0
0043     .rept   1024
0044     mtspr   spr, r4
0045     blr
0046     spr = spr + 1
0047     .endr