diff options
| author | Clément Chigot <chigot.c@gmail.com> | 2021-12-17 11:03:21 +0100 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2022-01-05 16:44:50 +0000 |
| commit | 002283eaca8335c4c1fb209f267bacf5afe6cf2c (patch) | |
| tree | 67d4b17782a437f0cd8f729df984ccc1b82e2587 /src/runtime | |
| parent | 2c58bb2e428c1f587dc30817bc211570f6fd4793 (diff) | |
| download | go-002283eaca8335c4c1fb209f267bacf5afe6cf2c.tar.xz | |
runtime: ensure that asmsyscall6 follow AIX stack convention
The function asmsyscall6 must follow AIX stack layout. It means
that its first local variable must be stored after its arguments
area, ie after offset 112.
Fixes #50185
Change-Id: I897731ddd2a9faad8218443a4c2f4b204ad7e173
Reviewed-on: https://go-review.googlesource.com/c/go/+/373074
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/sys_aix_ppc64.s | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/runtime/sys_aix_ppc64.s b/src/runtime/sys_aix_ppc64.s index c171c191c0..217ebb8878 100644 --- a/src/runtime/sys_aix_ppc64.s +++ b/src/runtime/sys_aix_ppc64.s @@ -25,7 +25,12 @@ TEXT callCfunction<>(SB), NOSPLIT|NOFRAME,$0 // stored in libcall_fn and store the results in libcall struture // Up to 6 arguments can be passed to this C function // Called by runtime.asmcgocall -// It reserves a stack of 288 bytes for the C function. +// It reserves a stack of 288 bytes for the C function. It must +// follow AIX convention, thus the first local variable must +// be stored at the offset 112, after the linker area (48 bytes) +// and the argument area (64). +// The AIX convention is described here: +// https://www.ibm.com/docs/en/aix/7.2?topic=overview-runtime-process-stack // NOT USING GO CALLING CONVENTION // runtime.asmsyscall6 is a function descriptor to the real asmsyscall6. DATA runtime·asmsyscall6+0(SB)/8, $asmsyscall6<>(SB) @@ -34,7 +39,8 @@ DATA runtime·asmsyscall6+16(SB)/8, $0 GLOBL runtime·asmsyscall6(SB), NOPTR, $24 TEXT asmsyscall6<>(SB),NOSPLIT,$256 - MOVD R3, 48(R1) // Save libcall for later + // Save libcall for later + MOVD R3, 112(R1) MOVD libcall_fn(R3), R12 MOVD libcall_args(R3), R9 MOVD 0(R9), R3 @@ -50,7 +56,7 @@ TEXT asmsyscall6<>(SB),NOSPLIT,$256 MOVD 40(R1), R2 // Store result in libcall - MOVD 48(R1), R5 + MOVD 112(R1), R5 MOVD R3, (libcall_r1)(R5) MOVD $-1, R6 CMP R6, R3 |
