aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalbir Singh <bsingharora@gmail.com>2016-07-19 13:08:41 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-19 18:58:07 +1000
commit8bc6cc59098d04bf6bfff7130f414418da496f38 (patch)
treed93f9d9ca2f6dd2daf3cd9a855a02fa595378fd1
parenta4c386acaa150a7e89254f41de82dcc492ad480c (diff)
downloadskiboot-8bc6cc59098d04bf6bfff7130f414418da496f38.zip
skiboot-8bc6cc59098d04bf6bfff7130f414418da496f38.tar.gz
skiboot-8bc6cc59098d04bf6bfff7130f414418da496f38.tar.bz2
Allow mtspr/mfspr to compile indepedantly of the optimization level
The compiler expects to see a constant value in the asm operations involving spr's. When compiling with -O0, spr is treated as a variable on stack when inline (this can be seen from the RTL). We do two things to fix the issue, we mark the functions as always_inline and we pass spr as a const so that the value is propagated as constants to the inline asm statement Tested with -O0 Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--include/processor.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/processor.h b/include/processor.h
index 48bbf90..caca804 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -235,7 +235,8 @@ static inline void mtmsrd(unsigned long val, int l)
asm volatile("mtmsrd %0,%1" : : "r"(val), "i"(l) : "memory");
}
-static inline unsigned long mfspr(unsigned int spr)
+static inline __attribute__((always_inline))
+unsigned long mfspr(const unsigned int spr)
{
unsigned long val;
@@ -243,7 +244,8 @@ static inline unsigned long mfspr(unsigned int spr)
return val;
}
-static inline void mtspr(unsigned int spr, unsigned long val)
+static inline __attribute__((always_inline))
+void mtspr(const unsigned int spr, unsigned long val)
{
asm volatile("mtspr %0,%1" : : "i"(spr), "r"(val) : "memory");
}