2 * Copyright (C) 1996 Paul Mackerras.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 #include <linux/config.h>
12 static inline unsigned long get_ ## reg (void) \
13 { unsigned long ret; asm volatile ("mf" #reg " %0" : "=r" (ret) :); return ret; }
16 static inline void set_ ## reg (unsigned long val) \
17 { asm volatile ("mt" #reg " %0" : : "r" (val)); }
24 #define GSETSPR(n, name) \
25 static inline long get_ ## name (void) \
26 { long ret; asm volatile ("mfspr %0," #n : "=r" (ret) : ); return ret; } \
27 static inline void set_ ## name (long val) \
28 { asm volatile ("mtspr " #n ",%0" : : "r" (val)); }
62 static inline int get_sr(int n)
67 // DRENG does not assemble
68 asm (" mfsrin %0,%1" : "=r" (ret) : "r" (n << 28));
73 static inline void set_sr(int n, int val)
76 // DRENG does not assemble
77 asm ("mtsrin %0,%1" : : "r" (val), "r" (n << 28));
81 static inline void store_inst(void *p)
83 asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
86 static inline void cflush(void *p)
88 asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
91 static inline void cinval(void *p)
93 asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));