diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2018-07-30 15:28:46 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-08-01 01:30:04 -0500 |
commit | ff576aa8187b47f61f902b6a097693d00c937d4c (patch) | |
tree | 8bc1e78135918760aba51ea3f328c337ec59397d /external | |
parent | be54c89e7e97e5127b2242dd81edda1b70362c44 (diff) | |
download | skiboot-ff576aa8187b47f61f902b6a097693d00c937d4c.zip skiboot-ff576aa8187b47f61f902b6a097693d00c937d4c.tar.gz skiboot-ff576aa8187b47f61f902b6a097693d00c937d4c.tar.bz2 |
opal-prd: Fix opal-prd crash
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>
Diffstat (limited to 'external')
-rw-r--r-- | external/opal-prd/thunk.S | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S index e09cef9..d0ccd64 100644 --- a/external/opal-prd/thunk.S +++ b/external/opal-prd/thunk.S @@ -119,7 +119,7 @@ call_le: std %r0,(32+16)(%r1) /* Branch to original function */ - mtlr %r11 + mtlr %r12 blrl /* Restore stack and LR */ @@ -137,7 +137,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" ;\ @@ -146,7 +146,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" ;\ |