/* SPDX-License-Identifier: GPL-2.0 */1#include <asm/ppc_asm.h>2#include <asm/asm-compat.h>34/* unsigned long xmon_mfspr(sprn, default_value) */5_GLOBAL(xmon_mfspr)6LOAD_REG_ADDR(r5, .Lmfspr_table)7b xmon_mxspr89/* void xmon_mtspr(sprn, new_value) */10_GLOBAL(xmon_mtspr)11LOAD_REG_ADDR(r5, .Lmtspr_table)12b xmon_mxspr1314/*15* r3 = sprn16* r4 = default or new value17* r5 = table base18*/19xmon_mxspr:20/*21* To index into the table of mxsprs we need:22* i = (sprn & 0x3ff) * 823* or using rwlinm:24* i = (sprn << 3) & (0x3ff << 3)25*/26rlwinm r3, r3, 3, 0x3ff << 327add r5, r5, r328mtctr r529mr r3, r4 /* put default_value in r3 for mfspr */30bctr3132.Lmfspr_table:33spr = 034.rept 102435mfspr r3, spr36blr37spr = spr + 138.endr3940.Lmtspr_table:41spr = 042.rept 102443mtspr spr, r444blr45spr = spr + 146.endr474849