all: copy ABI Headers (#147)
This change copies `abi_*.h` files and adjusts `#include` compilier directives for Bazel builds. The files `abi_*.h` and `internal/fakecgo/abi_*.h` are the same because Bazel does not support cross-package use of `#include` so we need each one once per package. See also https://github.com/bazelbuild/rules_go/issues/3636. Closes #144 Signed-off-by: Eliott Bouhana <eliott.bouhana@datadoghq.com>
- commit
- 813050efbc99881b368f9e85154d920e25117282
- author
- Eliott Bouhana · · 2023-08-03 14:24 UTC
- committer
- GitHub · · 2023-08-03 14:24 UTC
- parent
- f7e63e2
- signature
- GPG Unverified
4AEE18F83AFDEB23The key is unknown - refs
- tag: v0.5.0-alpha.1
12 files · +147 -28
M README.md +5 -2
| @@ -61,10 +61,13 @@ Purego uses code that originates from the Go runtime. These files are under the | |||
| 61 | 61 | License that can be found [in the Go Source](https://github.com/golang/go/blob/master/LICENSE). | |
| 62 | 62 | This is a list of the copied files: | |
| 63 | 63 | ||
| 64 | + | * `abi_*.h` from package `runtime/cgo` | |
| 64 | 65 | * `zcallback_darwin_*.s` from package `runtime` | |
| 65 | - | * `internal/abi/abi_*.h` from package `runtime/cgo` | |
| 66 | + | * `internal/fakecgo/abi_*.h` from package `runtime/cgo` | |
| 66 | 67 | * `internal/fakecgo/asm_GOARCH.s` from package `runtime/cgo` | |
| 67 | 68 | * `internal/fakecgo/callbacks.go` from package `runtime/cgo` | |
| 68 | 69 | * `internal/fakecgo/go_GOOS_GOARCH.go` from package `runtime/cgo` | |
| 69 | 70 | * `internal/fakecgo/iscgo.go` from package `runtime/cgo` | |
| 70 | - | * `internal/fakecgo/setenv.go` from package `runtime/cgo` | |
| 71 | + | * `internal/fakecgo/setenv.go` from package `runtime/cgo | |
| 72 | + | ||
| 73 | + | The files `abi_*.h` and `internal/fakecgo/abi_*.h` are the same because Bazel does not support cross-package use of `#include` so we need each one once per package. (cf. [issue](https://github.com/bazelbuild/rules_go/issues/3636)) | |
| @@ -61,10 +61,13 @@ Purego uses code that originates from the Go runtime. These files are under the | |||||
| 61 | License that can be found [in the Go Source](https://github.com/golang/go/blob/master/LICENSE). | 61 | License that can be found [in the Go Source](https://github.com/golang/go/blob/master/LICENSE). | ||
| 62 | This is a list of the copied files: | 62 | This is a list of the copied files: | ||
| 63 | 63 | ||||
| 64 | + | * `abi_*.h` from package `runtime/cgo` | |||
| 64 | * `zcallback_darwin_*.s` from package `runtime` | 65 | * `zcallback_darwin_*.s` from package `runtime` | ||
| 65 | - | * `internal/abi/abi_*.h` from package `runtime/cgo` | 66 | + | * `internal/fakecgo/abi_*.h` from package `runtime/cgo` |
| 66 | * `internal/fakecgo/asm_GOARCH.s` from package `runtime/cgo` | 67 | * `internal/fakecgo/asm_GOARCH.s` from package `runtime/cgo` | ||
| 67 | * `internal/fakecgo/callbacks.go` from package `runtime/cgo` | 68 | * `internal/fakecgo/callbacks.go` from package `runtime/cgo` | ||
| 68 | * `internal/fakecgo/go_GOOS_GOARCH.go` from package `runtime/cgo` | 69 | * `internal/fakecgo/go_GOOS_GOARCH.go` from package `runtime/cgo` | ||
| 69 | * `internal/fakecgo/iscgo.go` from package `runtime/cgo` | 70 | * `internal/fakecgo/iscgo.go` from package `runtime/cgo` | ||
| 70 | - | * `internal/fakecgo/setenv.go` from package `runtime/cgo` | 71 | + | * `internal/fakecgo/setenv.go` from package `runtime/cgo |
| 72 | + | ||||
| 73 | + | The files `abi_*.h` and `internal/fakecgo/abi_*.h` are the same because Bazel does not support cross-package use of `#include` so we need each one once per package. (cf. [issue](https://github.com/bazelbuild/rules_go/issues/3636)) | |||
R internal/abi/abi_amd64.h → abi_amd64.h +0 -0 renamed, 100% similar
renamed, 100% similar
R internal/abi/abi_arm64.h → abi_arm64.h +0 -0 renamed, 100% similar
renamed, 100% similar
D dummy.go +0 -14
| @@ -1,14 +0,0 @@ | |||
| 1 | - | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | - | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | - | ||
| 4 | - | //go:build dummy | |
| 5 | - | ||
| 6 | - | // This file exists purely to prevent the Go toolchain from stripping | |
| 7 | - | // away the C source directories and files when `go mod vendor` is used | |
| 8 | - | // to populate a `vendor/` directory of a project depending on this package. | |
| 9 | - | ||
| 10 | - | package purego | |
| 11 | - | ||
| 12 | - | import ( | |
| 13 | - | _ "github.com/ebitengine/purego/internal/abi" | |
| 14 | - | ) | |
| @@ -1,14 +0,0 @@ | |||||
| 1 | - | // SPDX-License-Identifier: Apache-2.0 | |||
| 2 | - | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |||
| 3 | - | ||||
| 4 | - | //go:build dummy | |||
| 5 | - | ||||
| 6 | - | // This file exists purely to prevent the Go toolchain from stripping | |||
| 7 | - | // away the C source directories and files when `go mod vendor` is used | |||
| 8 | - | // to populate a `vendor/` directory of a project depending on this package. | |||
| 9 | - | ||||
| 10 | - | package purego | |||
| 11 | - | ||||
| 12 | - | import ( | |||
| 13 | - | _ "github.com/ebitengine/purego/internal/abi" | |||
| 14 | - | ) | |||
D internal/abi/dummy.go +0 -7
| @@ -1,7 +0,0 @@ | |||
| 1 | - | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | - | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | - | ||
| 4 | - | //go:build dummy | |
| 5 | - | ||
| 6 | - | // Package abi is a dummy package that prevents go tooling from stripping the C dependencies. | |
| 7 | - | package abi | |
| @@ -1,7 +0,0 @@ | |||||
| 1 | - | // SPDX-License-Identifier: Apache-2.0 | |||
| 2 | - | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |||
| 3 | - | ||||
| 4 | - | //go:build dummy | |||
| 5 | - | ||||
| 6 | - | // Package abi is a dummy package that prevents go tooling from stripping the C dependencies. | |||
| 7 | - | package abi | |||
A internal/fakecgo/abi_amd64.h +99 -0
| @@ -0,0 +1,99 @@ | |||
| 1 | + | // Copyright 2021 The Go Authors. All rights reserved. | |
| 2 | + | // Use of this source code is governed by a BSD-style | |
| 3 | + | // license that can be found in the LICENSE file. | |
| 4 | + | ||
| 5 | + | // Macros for transitioning from the host ABI to Go ABI0. | |
| 6 | + | // | |
| 7 | + | // These save the frame pointer, so in general, functions that use | |
| 8 | + | // these should have zero frame size to suppress the automatic frame | |
| 9 | + | // pointer, though it's harmless to not do this. | |
| 10 | + | ||
| 11 | + | #ifdef GOOS_windows | |
| 12 | + | ||
| 13 | + | // REGS_HOST_TO_ABI0_STACK is the stack bytes used by | |
| 14 | + | // PUSH_REGS_HOST_TO_ABI0. | |
| 15 | + | #define REGS_HOST_TO_ABI0_STACK (28*8 + 8) | |
| 16 | + | ||
| 17 | + | // PUSH_REGS_HOST_TO_ABI0 prepares for transitioning from | |
| 18 | + | // the host ABI to Go ABI0 code. It saves all registers that are | |
| 19 | + | // callee-save in the host ABI and caller-save in Go ABI0 and prepares | |
| 20 | + | // for entry to Go. | |
| 21 | + | // | |
| 22 | + | // Save DI SI BP BX R12 R13 R14 R15 X6-X15 registers and the DF flag. | |
| 23 | + | // Clear the DF flag for the Go ABI. | |
| 24 | + | // MXCSR matches the Go ABI, so we don't have to set that, | |
| 25 | + | // and Go doesn't modify it, so we don't have to save it. | |
| 26 | + | #define PUSH_REGS_HOST_TO_ABI0() \ | |
| 27 | + | PUSHFQ \ | |
| 28 | + | CLD \ | |
| 29 | + | ADJSP $(REGS_HOST_TO_ABI0_STACK - 8) \ | |
| 30 | + | MOVQ DI, (0*0)(SP) \ | |
| 31 | + | MOVQ SI, (1*8)(SP) \ | |
| 32 | + | MOVQ BP, (2*8)(SP) \ | |
| 33 | + | MOVQ BX, (3*8)(SP) \ | |
| 34 | + | MOVQ R12, (4*8)(SP) \ | |
| 35 | + | MOVQ R13, (5*8)(SP) \ | |
| 36 | + | MOVQ R14, (6*8)(SP) \ | |
| 37 | + | MOVQ R15, (7*8)(SP) \ | |
| 38 | + | MOVUPS X6, (8*8)(SP) \ | |
| 39 | + | MOVUPS X7, (10*8)(SP) \ | |
| 40 | + | MOVUPS X8, (12*8)(SP) \ | |
| 41 | + | MOVUPS X9, (14*8)(SP) \ | |
| 42 | + | MOVUPS X10, (16*8)(SP) \ | |
| 43 | + | MOVUPS X11, (18*8)(SP) \ | |
| 44 | + | MOVUPS X12, (20*8)(SP) \ | |
| 45 | + | MOVUPS X13, (22*8)(SP) \ | |
| 46 | + | MOVUPS X14, (24*8)(SP) \ | |
| 47 | + | MOVUPS X15, (26*8)(SP) | |
| 48 | + | ||
| 49 | + | #define POP_REGS_HOST_TO_ABI0() \ | |
| 50 | + | MOVQ (0*0)(SP), DI \ | |
| 51 | + | MOVQ (1*8)(SP), SI \ | |
| 52 | + | MOVQ (2*8)(SP), BP \ | |
| 53 | + | MOVQ (3*8)(SP), BX \ | |
| 54 | + | MOVQ (4*8)(SP), R12 \ | |
| 55 | + | MOVQ (5*8)(SP), R13 \ | |
| 56 | + | MOVQ (6*8)(SP), R14 \ | |
| 57 | + | MOVQ (7*8)(SP), R15 \ | |
| 58 | + | MOVUPS (8*8)(SP), X6 \ | |
| 59 | + | MOVUPS (10*8)(SP), X7 \ | |
| 60 | + | MOVUPS (12*8)(SP), X8 \ | |
| 61 | + | MOVUPS (14*8)(SP), X9 \ | |
| 62 | + | MOVUPS (16*8)(SP), X10 \ | |
| 63 | + | MOVUPS (18*8)(SP), X11 \ | |
| 64 | + | MOVUPS (20*8)(SP), X12 \ | |
| 65 | + | MOVUPS (22*8)(SP), X13 \ | |
| 66 | + | MOVUPS (24*8)(SP), X14 \ | |
| 67 | + | MOVUPS (26*8)(SP), X15 \ | |
| 68 | + | ADJSP $-(REGS_HOST_TO_ABI0_STACK - 8) \ | |
| 69 | + | POPFQ | |
| 70 | + | ||
| 71 | + | #else | |
| 72 | + | // SysV ABI | |
| 73 | + | ||
| 74 | + | #define REGS_HOST_TO_ABI0_STACK (6*8) | |
| 75 | + | ||
| 76 | + | // SysV MXCSR matches the Go ABI, so we don't have to set that, | |
| 77 | + | // and Go doesn't modify it, so we don't have to save it. | |
| 78 | + | // Both SysV and Go require DF to be cleared, so that's already clear. | |
| 79 | + | // The SysV and Go frame pointer conventions are compatible. | |
| 80 | + | #define PUSH_REGS_HOST_TO_ABI0() \ | |
| 81 | + | ADJSP $(REGS_HOST_TO_ABI0_STACK) \ | |
| 82 | + | MOVQ BP, (5*8)(SP) \ | |
| 83 | + | LEAQ (5*8)(SP), BP \ | |
| 84 | + | MOVQ BX, (0*8)(SP) \ | |
| 85 | + | MOVQ R12, (1*8)(SP) \ | |
| 86 | + | MOVQ R13, (2*8)(SP) \ | |
| 87 | + | MOVQ R14, (3*8)(SP) \ | |
| 88 | + | MOVQ R15, (4*8)(SP) | |
| 89 | + | ||
| 90 | + | #define POP_REGS_HOST_TO_ABI0() \ | |
| 91 | + | MOVQ (0*8)(SP), BX \ | |
| 92 | + | MOVQ (1*8)(SP), R12 \ | |
| 93 | + | MOVQ (2*8)(SP), R13 \ | |
| 94 | + | MOVQ (3*8)(SP), R14 \ | |
| 95 | + | MOVQ (4*8)(SP), R15 \ | |
| 96 | + | MOVQ (5*8)(SP), BP \ | |
| 97 | + | ADJSP $-(REGS_HOST_TO_ABI0_STACK) | |
| 98 | + | ||
| 99 | + | #endif | |
| @@ -0,0 +1,99 @@ | |||||
| 1 | + | // Copyright 2021 The Go Authors. All rights reserved. | |||
| 2 | + | // Use of this source code is governed by a BSD-style | |||
| 3 | + | // license that can be found in the LICENSE file. | |||
| 4 | + | ||||
| 5 | + | // Macros for transitioning from the host ABI to Go ABI0. | |||
| 6 | + | // | |||
| 7 | + | // These save the frame pointer, so in general, functions that use | |||
| 8 | + | // these should have zero frame size to suppress the automatic frame | |||
| 9 | + | // pointer, though it's harmless to not do this. | |||
| 10 | + | ||||
| 11 | + | #ifdef GOOS_windows | |||
| 12 | + | ||||
| 13 | + | // REGS_HOST_TO_ABI0_STACK is the stack bytes used by | |||
| 14 | + | // PUSH_REGS_HOST_TO_ABI0. | |||
| 15 | + | #define REGS_HOST_TO_ABI0_STACK (28*8 + 8) | |||
| 16 | + | ||||
| 17 | + | // PUSH_REGS_HOST_TO_ABI0 prepares for transitioning from | |||
| 18 | + | // the host ABI to Go ABI0 code. It saves all registers that are | |||
| 19 | + | // callee-save in the host ABI and caller-save in Go ABI0 and prepares | |||
| 20 | + | // for entry to Go. | |||
| 21 | + | // | |||
| 22 | + | // Save DI SI BP BX R12 R13 R14 R15 X6-X15 registers and the DF flag. | |||
| 23 | + | // Clear the DF flag for the Go ABI. | |||
| 24 | + | // MXCSR matches the Go ABI, so we don't have to set that, | |||
| 25 | + | // and Go doesn't modify it, so we don't have to save it. | |||
| 26 | + | #define PUSH_REGS_HOST_TO_ABI0() \ | |||
| 27 | + | PUSHFQ \ | |||
| 28 | + | CLD \ | |||
| 29 | + | ADJSP $(REGS_HOST_TO_ABI0_STACK - 8) \ | |||
| 30 | + | MOVQ DI, (0*0)(SP) \ | |||
| 31 | + | MOVQ SI, (1*8)(SP) \ | |||
| 32 | + | MOVQ BP, (2*8)(SP) \ | |||
| 33 | + | MOVQ BX, (3*8)(SP) \ | |||
| 34 | + | MOVQ R12, (4*8)(SP) \ | |||
| 35 | + | MOVQ R13, (5*8)(SP) \ | |||
| 36 | + | MOVQ R14, (6*8)(SP) \ | |||
| 37 | + | MOVQ R15, (7*8)(SP) \ | |||
| 38 | + | MOVUPS X6, (8*8)(SP) \ | |||
| 39 | + | MOVUPS X7, (10*8)(SP) \ | |||
| 40 | + | MOVUPS X8, (12*8)(SP) \ | |||
| 41 | + | MOVUPS X9, (14*8)(SP) \ | |||
| 42 | + | MOVUPS X10, (16*8)(SP) \ | |||
| 43 | + | MOVUPS X11, (18*8)(SP) \ | |||
| 44 | + | MOVUPS X12, (20*8)(SP) \ | |||
| 45 | + | MOVUPS X13, (22*8)(SP) \ | |||
| 46 | + | MOVUPS X14, (24*8)(SP) \ | |||
| 47 | + | MOVUPS X15, (26*8)(SP) | |||
| 48 | + | ||||
| 49 | + | #define POP_REGS_HOST_TO_ABI0() \ | |||
| 50 | + | MOVQ (0*0)(SP), DI \ | |||
| 51 | + | MOVQ (1*8)(SP), SI \ | |||
| 52 | + | MOVQ (2*8)(SP), BP \ | |||
| 53 | + | MOVQ (3*8)(SP), BX \ | |||
| 54 | + | MOVQ (4*8)(SP), R12 \ | |||
| 55 | + | MOVQ (5*8)(SP), R13 \ | |||
| 56 | + | MOVQ (6*8)(SP), R14 \ | |||
| 57 | + | MOVQ (7*8)(SP), R15 \ | |||
| 58 | + | MOVUPS (8*8)(SP), X6 \ | |||
| 59 | + | MOVUPS (10*8)(SP), X7 \ | |||
| 60 | + | MOVUPS (12*8)(SP), X8 \ | |||
| 61 | + | MOVUPS (14*8)(SP), X9 \ | |||
| 62 | + | MOVUPS (16*8)(SP), X10 \ | |||
| 63 | + | MOVUPS (18*8)(SP), X11 \ | |||
| 64 | + | MOVUPS (20*8)(SP), X12 \ | |||
| 65 | + | MOVUPS (22*8)(SP), X13 \ | |||
| 66 | + | MOVUPS (24*8)(SP), X14 \ | |||
| 67 | + | MOVUPS (26*8)(SP), X15 \ | |||
| 68 | + | ADJSP $-(REGS_HOST_TO_ABI0_STACK - 8) \ | |||
| 69 | + | POPFQ | |||
| 70 | + | ||||
| 71 | + | #else | |||
| 72 | + | // SysV ABI | |||
| 73 | + | ||||
| 74 | + | #define REGS_HOST_TO_ABI0_STACK (6*8) | |||
| 75 | + | ||||
| 76 | + | // SysV MXCSR matches the Go ABI, so we don't have to set that, | |||
| 77 | + | // and Go doesn't modify it, so we don't have to save it. | |||
| 78 | + | // Both SysV and Go require DF to be cleared, so that's already clear. | |||
| 79 | + | // The SysV and Go frame pointer conventions are compatible. | |||
| 80 | + | #define PUSH_REGS_HOST_TO_ABI0() \ | |||
| 81 | + | ADJSP $(REGS_HOST_TO_ABI0_STACK) \ | |||
| 82 | + | MOVQ BP, (5*8)(SP) \ | |||
| 83 | + | LEAQ (5*8)(SP), BP \ | |||
| 84 | + | MOVQ BX, (0*8)(SP) \ | |||
| 85 | + | MOVQ R12, (1*8)(SP) \ | |||
| 86 | + | MOVQ R13, (2*8)(SP) \ | |||
| 87 | + | MOVQ R14, (3*8)(SP) \ | |||
| 88 | + | MOVQ R15, (4*8)(SP) | |||
| 89 | + | ||||
| 90 | + | #define POP_REGS_HOST_TO_ABI0() \ | |||
| 91 | + | MOVQ (0*8)(SP), BX \ | |||
| 92 | + | MOVQ (1*8)(SP), R12 \ | |||
| 93 | + | MOVQ (2*8)(SP), R13 \ | |||
| 94 | + | MOVQ (3*8)(SP), R14 \ | |||
| 95 | + | MOVQ (4*8)(SP), R15 \ | |||
| 96 | + | MOVQ (5*8)(SP), BP \ | |||
| 97 | + | ADJSP $-(REGS_HOST_TO_ABI0_STACK) | |||
| 98 | + | ||||
| 99 | + | #endif | |||
A internal/fakecgo/abi_arm64.h +39 -0
| @@ -0,0 +1,39 @@ | |||
| 1 | + | // Copyright 2021 The Go Authors. All rights reserved. | |
| 2 | + | // Use of this source code is governed by a BSD-style | |
| 3 | + | // license that can be found in the LICENSE file. | |
| 4 | + | ||
| 5 | + | // Macros for transitioning from the host ABI to Go ABI0. | |
| 6 | + | // | |
| 7 | + | // These macros save and restore the callee-saved registers | |
| 8 | + | // from the stack, but they don't adjust stack pointer, so | |
| 9 | + | // the user should prepare stack space in advance. | |
| 10 | + | // SAVE_R19_TO_R28(offset) saves R19 ~ R28 to the stack space | |
| 11 | + | // of ((offset)+0*8)(RSP) ~ ((offset)+9*8)(RSP). | |
| 12 | + | // | |
| 13 | + | // SAVE_F8_TO_F15(offset) saves F8 ~ F15 to the stack space | |
| 14 | + | // of ((offset)+0*8)(RSP) ~ ((offset)+7*8)(RSP). | |
| 15 | + | // | |
| 16 | + | // R29 is not saved because Go will save and restore it. | |
| 17 | + | ||
| 18 | + | #define SAVE_R19_TO_R28(offset) \ | |
| 19 | + | STP (R19, R20), ((offset)+0*8)(RSP) \ | |
| 20 | + | STP (R21, R22), ((offset)+2*8)(RSP) \ | |
| 21 | + | STP (R23, R24), ((offset)+4*8)(RSP) \ | |
| 22 | + | STP (R25, R26), ((offset)+6*8)(RSP) \ | |
| 23 | + | STP (R27, g), ((offset)+8*8)(RSP) | |
| 24 | + | #define RESTORE_R19_TO_R28(offset) \ | |
| 25 | + | LDP ((offset)+0*8)(RSP), (R19, R20) \ | |
| 26 | + | LDP ((offset)+2*8)(RSP), (R21, R22) \ | |
| 27 | + | LDP ((offset)+4*8)(RSP), (R23, R24) \ | |
| 28 | + | LDP ((offset)+6*8)(RSP), (R25, R26) \ | |
| 29 | + | LDP ((offset)+8*8)(RSP), (R27, g) /* R28 */ | |
| 30 | + | #define SAVE_F8_TO_F15(offset) \ | |
| 31 | + | FSTPD (F8, F9), ((offset)+0*8)(RSP) \ | |
| 32 | + | FSTPD (F10, F11), ((offset)+2*8)(RSP) \ | |
| 33 | + | FSTPD (F12, F13), ((offset)+4*8)(RSP) \ | |
| 34 | + | FSTPD (F14, F15), ((offset)+6*8)(RSP) | |
| 35 | + | #define RESTORE_F8_TO_F15(offset) \ | |
| 36 | + | FLDPD ((offset)+0*8)(RSP), (F8, F9) \ | |
| 37 | + | FLDPD ((offset)+2*8)(RSP), (F10, F11) \ | |
| 38 | + | FLDPD ((offset)+4*8)(RSP), (F12, F13) \ | |
| 39 | + | FLDPD ((offset)+6*8)(RSP), (F14, F15) | |
| @@ -0,0 +1,39 @@ | |||||
| 1 | + | // Copyright 2021 The Go Authors. All rights reserved. | |||
| 2 | + | // Use of this source code is governed by a BSD-style | |||
| 3 | + | // license that can be found in the LICENSE file. | |||
| 4 | + | ||||
| 5 | + | // Macros for transitioning from the host ABI to Go ABI0. | |||
| 6 | + | // | |||
| 7 | + | // These macros save and restore the callee-saved registers | |||
| 8 | + | // from the stack, but they don't adjust stack pointer, so | |||
| 9 | + | // the user should prepare stack space in advance. | |||
| 10 | + | // SAVE_R19_TO_R28(offset) saves R19 ~ R28 to the stack space | |||
| 11 | + | // of ((offset)+0*8)(RSP) ~ ((offset)+9*8)(RSP). | |||
| 12 | + | // | |||
| 13 | + | // SAVE_F8_TO_F15(offset) saves F8 ~ F15 to the stack space | |||
| 14 | + | // of ((offset)+0*8)(RSP) ~ ((offset)+7*8)(RSP). | |||
| 15 | + | // | |||
| 16 | + | // R29 is not saved because Go will save and restore it. | |||
| 17 | + | ||||
| 18 | + | #define SAVE_R19_TO_R28(offset) \ | |||
| 19 | + | STP (R19, R20), ((offset)+0*8)(RSP) \ | |||
| 20 | + | STP (R21, R22), ((offset)+2*8)(RSP) \ | |||
| 21 | + | STP (R23, R24), ((offset)+4*8)(RSP) \ | |||
| 22 | + | STP (R25, R26), ((offset)+6*8)(RSP) \ | |||
| 23 | + | STP (R27, g), ((offset)+8*8)(RSP) | |||
| 24 | + | #define RESTORE_R19_TO_R28(offset) \ | |||
| 25 | + | LDP ((offset)+0*8)(RSP), (R19, R20) \ | |||
| 26 | + | LDP ((offset)+2*8)(RSP), (R21, R22) \ | |||
| 27 | + | LDP ((offset)+4*8)(RSP), (R23, R24) \ | |||
| 28 | + | LDP ((offset)+6*8)(RSP), (R25, R26) \ | |||
| 29 | + | LDP ((offset)+8*8)(RSP), (R27, g) /* R28 */ | |||
| 30 | + | #define SAVE_F8_TO_F15(offset) \ | |||
| 31 | + | FSTPD (F8, F9), ((offset)+0*8)(RSP) \ | |||
| 32 | + | FSTPD (F10, F11), ((offset)+2*8)(RSP) \ | |||
| 33 | + | FSTPD (F12, F13), ((offset)+4*8)(RSP) \ | |||
| 34 | + | FSTPD (F14, F15), ((offset)+6*8)(RSP) | |||
| 35 | + | #define RESTORE_F8_TO_F15(offset) \ | |||
| 36 | + | FLDPD ((offset)+0*8)(RSP), (F8, F9) \ | |||
| 37 | + | FLDPD ((offset)+2*8)(RSP), (F10, F11) \ | |||
| 38 | + | FLDPD ((offset)+4*8)(RSP), (F12, F13) \ | |||
| 39 | + | FLDPD ((offset)+6*8)(RSP), (F14, F15) | |||
M internal/fakecgo/asm_amd64.s +1 -1
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | // license that can be found in the LICENSE file. | |
| 4 | 4 | ||
| 5 | 5 | #include "textflag.h" | |
| 6 | - | #include "../abi/abi_amd64.h" | |
| 6 | + | #include "abi_amd64.h" | |
| 7 | 7 | ||
| 8 | 8 | // Called by C code generated by cmd/cgo. | |
| 9 | 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | |
| @@ -3,7 +3,7 @@ | |||||
| 3 | // license that can be found in the LICENSE file. | 3 | // license that can be found in the LICENSE file. | ||
| 4 | 4 | ||||
| 5 | #include "textflag.h" | 5 | #include "textflag.h" | ||
| 6 | - | #include "../abi/abi_amd64.h" | 6 | + | #include "abi_amd64.h" |
| 7 | 7 | ||||
| 8 | // Called by C code generated by cmd/cgo. | 8 | // Called by C code generated by cmd/cgo. | ||
| 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | ||
M internal/fakecgo/asm_arm64.s +1 -1
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | // license that can be found in the LICENSE file. | |
| 4 | 4 | ||
| 5 | 5 | #include "textflag.h" | |
| 6 | - | #include "../abi/abi_arm64.h" | |
| 6 | + | #include "abi_arm64.h" | |
| 7 | 7 | ||
| 8 | 8 | // Called by C code generated by cmd/cgo. | |
| 9 | 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | |
| @@ -3,7 +3,7 @@ | |||||
| 3 | // license that can be found in the LICENSE file. | 3 | // license that can be found in the LICENSE file. | ||
| 4 | 4 | ||||
| 5 | #include "textflag.h" | 5 | #include "textflag.h" | ||
| 6 | - | #include "../abi/abi_arm64.h" | 6 | + | #include "abi_arm64.h" |
| 7 | 7 | ||||
| 8 | // Called by C code generated by cmd/cgo. | 8 | // Called by C code generated by cmd/cgo. | ||
| 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | 9 | // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) | ||
M sys_amd64.s +1 -1
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | //go:build darwin || (!cgo && linux) | |
| 5 | 5 | ||
| 6 | 6 | #include "textflag.h" | |
| 7 | - | #include "internal/abi/abi_amd64.h" | |
| 7 | + | #include "abi_amd64.h" | |
| 8 | 8 | #include "go_asm.h" | |
| 9 | 9 | #include "funcdata.h" | |
| 10 | 10 | ||
| @@ -4,7 +4,7 @@ | |||||
| 4 | //go:build darwin || (!cgo && linux) | 4 | //go:build darwin || (!cgo && linux) | ||
| 5 | 5 | ||||
| 6 | #include "textflag.h" | 6 | #include "textflag.h" | ||
| 7 | - | #include "internal/abi/abi_amd64.h" | 7 | + | #include "abi_amd64.h" |
| 8 | #include "go_asm.h" | 8 | #include "go_asm.h" | ||
| 9 | #include "funcdata.h" | 9 | #include "funcdata.h" | ||
| 10 | 10 | ||||
M sys_arm64.s +0 -1
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | #include "textflag.h" | |
| 7 | 7 | #include "go_asm.h" | |
| 8 | 8 | #include "funcdata.h" | |
| 9 | - | #include "internal/abi/abi_arm64.h" | |
| 10 | 9 | ||
| 11 | 10 | // syscall9X calls a function in libc on behalf of the syscall package. | |
| 12 | 11 | // syscall9X takes a pointer to a struct like: | |
| @@ -6,7 +6,6 @@ | |||||
| 6 | #include "textflag.h" | 6 | #include "textflag.h" | ||
| 7 | #include "go_asm.h" | 7 | #include "go_asm.h" | ||
| 8 | #include "funcdata.h" | 8 | #include "funcdata.h" | ||
| 9 | - | #include "internal/abi/abi_arm64.h" | |||
| 10 | 9 | ||||
| 11 | // syscall9X calls a function in libc on behalf of the syscall package. | 10 | // syscall9X calls a function in libc on behalf of the syscall package. | ||
| 12 | // syscall9X takes a pointer to a struct like: | 11 | // syscall9X takes a pointer to a struct like: | ||
M sys_unix_arm64.s +1 -1
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | #include "textflag.h" | |
| 7 | 7 | #include "go_asm.h" | |
| 8 | 8 | #include "funcdata.h" | |
| 9 | - | #include "internal/abi/abi_arm64.h" | |
| 9 | + | #include "abi_arm64.h" | |
| 10 | 10 | ||
| 11 | 11 | TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 | |
| 12 | 12 | NO_LOCAL_POINTERS | |
| @@ -6,7 +6,7 @@ | |||||
| 6 | #include "textflag.h" | 6 | #include "textflag.h" | ||
| 7 | #include "go_asm.h" | 7 | #include "go_asm.h" | ||
| 8 | #include "funcdata.h" | 8 | #include "funcdata.h" | ||
| 9 | - | #include "internal/abi/abi_arm64.h" | 9 | + | #include "abi_arm64.h" |
| 10 | 10 | ||||
| 11 | TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 | 11 | TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 | ||
| 12 | NO_LOCAL_POINTERS | 12 | NO_LOCAL_POINTERS | ||