Commit 6735fef1 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/ps3: Fix lv1 hcall assembly for ELFv2 calling convention

Stack-passed parameters begin at a different offset in the caller's
stack in the ELFv2 ABI.
Reported-by: default avatarGeoff Levand <geoff@infradead.org>
Fixes: 8c5fa3b5 ("powerpc/64: Make ELFv2 the default for big-endian builds")
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Tested-by: default avatarGeoff Levand <geoff@infradead.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231227072405.63751-2-npiggin@gmail.com
parent 6e9de205
...@@ -201,11 +201,13 @@ ...@@ -201,11 +201,13 @@
#ifdef CONFIG_PPC64_ELF_ABI_V2 #ifdef CONFIG_PPC64_ELF_ABI_V2
#define STK_GOT 24 #define STK_GOT 24
#define __STK_PARAM(i) (32 + ((i)-3)*8) #define STK_PARAM_AREA 32
#else #else
#define STK_GOT 40 #define STK_GOT 40
#define __STK_PARAM(i) (48 + ((i)-3)*8) #define STK_PARAM_AREA 48
#endif #endif
#define __STK_PARAM(i) (STK_PARAM_AREA + ((i)-3)*8)
#define STK_PARAM(i) __STK_PARAM(__REG_##i) #define STK_PARAM(i) __STK_PARAM(__REG_##i)
#ifdef CONFIG_PPC64_ELF_ABI_V2 #ifdef CONFIG_PPC64_ELF_ABI_V2
......
...@@ -714,7 +714,7 @@ _GLOBAL(_##API_NAME) \ ...@@ -714,7 +714,7 @@ _GLOBAL(_##API_NAME) \
std r4, 0(r11); \ std r4, 0(r11); \
ld r11, -16(r1); \ ld r11, -16(r1); \
std r5, 0(r11); \ std r5, 0(r11); \
ld r11, 48+8*8(r1); \ ld r11, STK_PARAM_AREA+8*8(r1); \
std r6, 0(r11); \ std r6, 0(r11); \
\ \
ld r0, 16(r1); \ ld r0, 16(r1); \
...@@ -746,22 +746,22 @@ _GLOBAL(_##API_NAME) \ ...@@ -746,22 +746,22 @@ _GLOBAL(_##API_NAME) \
mflr r0; \ mflr r0; \
std r0, 16(r1); \ std r0, 16(r1); \
\ \
std r10, 48+8*7(r1); \ std r10, STK_PARAM_AREA+8*7(r1); \
\ \
li r11, API_NUMBER; \ li r11, API_NUMBER; \
lv1call; \ lv1call; \
\ \
ld r11, 48+8*7(r1); \ ld r11, STK_PARAM_AREA+8*7(r1); \
std r4, 0(r11); \ std r4, 0(r11); \
ld r11, 48+8*8(r1); \ ld r11, STK_PARAM_AREA+8*8(r1); \
std r5, 0(r11); \ std r5, 0(r11); \
ld r11, 48+8*9(r1); \ ld r11, STK_PARAM_AREA+8*9(r1); \
std r6, 0(r11); \ std r6, 0(r11); \
ld r11, 48+8*10(r1); \ ld r11, STK_PARAM_AREA+8*10(r1); \
std r7, 0(r11); \ std r7, 0(r11); \
ld r11, 48+8*11(r1); \ ld r11, STK_PARAM_AREA+8*11(r1); \
std r8, 0(r11); \ std r8, 0(r11); \
ld r11, 48+8*12(r1); \ ld r11, STK_PARAM_AREA+8*12(r1); \
std r9, 0(r11); \ std r9, 0(r11); \
\ \
ld r0, 16(r1); \ ld r0, 16(r1); \
...@@ -777,7 +777,7 @@ _GLOBAL(_##API_NAME) \ ...@@ -777,7 +777,7 @@ _GLOBAL(_##API_NAME) \
li r11, API_NUMBER; \ li r11, API_NUMBER; \
lv1call; \ lv1call; \
\ \
ld r11, 48+8*8(r1); \ ld r11, STK_PARAM_AREA+8*8(r1); \
std r4, 0(r11); \ std r4, 0(r11); \
\ \
ld r0, 16(r1); \ ld r0, 16(r1); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment