aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2018-07-30 15:28:46 +0530
committerStewart Smith <stewart@linux.ibm.com>2018-11-19 16:56:13 +1100
commit184d7e4aca1accf1f311ea9645761d8056406b28 (patch)
tree6474d0669770d61b7a6d1d90d51b68cbe1b6102b
parente550528a74af7e632c359cd29e4ba295743bdb84 (diff)
downloadskiboot-184d7e4aca1accf1f311ea9645761d8056406b28.zip
skiboot-184d7e4aca1accf1f311ea9645761d8056406b28.tar.gz
skiboot-184d7e4aca1accf1f311ea9645761d8056406b28.tar.bz2
opal-prd: Fix opal-prd crash
[ Upstream commit ff576aa8187b47f61f902b6a097693d00c937d4c ] Presently callback function from HBRT uses r11 to point to target function pointer. r12 is garbage. This works fine when we compile with "-no-pie" option (as we don't use r12 to calculate TOC). As per ABIv2 : "r12 : Function entry address at global entry point" With "-pie" compilation option, we have to set r12 to point to global function entry point. So that we can calculate TOC properly. Crash log without this patch: opal-prd[2864]: unhandled signal 11 at 0000000000029320 nip 00000 00102012830 lr 0000000102016890 code 1 Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> CC: Jeremy Kerr <jk@ozlabs.org> CC: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Reviewed-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--external/opal-prd/thunk.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S
index ee3d7c3..b35dc61 100644
--- a/external/opal-prd/thunk.S
+++ b/external/opal-prd/thunk.S
@@ -118,7 +118,7 @@ call_le:
std %r0,(32+16)(%r1)
/* Branch to original function */
- mtlr %r11
+ mtlr %r12
blrl
/* Restore stack and LR */
@@ -136,7 +136,7 @@ call_le:
/* Callback from HBRT. There is one entry point per function.
*
* We assume the proper r2 is already set via the OPD, so we grab our
- * target function pointer in r11 and jump to call_le
+ * target function pointer in r12 and jump to call_le
*/
#define CALLBACK_THUNK(name) \
.pushsection ".text","ax" ;\
@@ -145,7 +145,7 @@ name##_thunk: ;\
.long 0x00000038 | le_si16(__NR_switch_endian) ;\
/* byteswapped li %r0,__NR_switch_endian */ ;\
.long 0x02000044 /* byteswapped sc */ ;\
- ld %r11,name@got(%r2) ;\
+ ld %r12,name@got(%r2) ;\
b call_le ;\
.popsection ;\
.pushsection ".data.thunk_opd","aw" ;\