purego: use R10 instead of R12 (#65)
R12 is callee-saved but we aren't saving it. Use R10 since it is caller saved. This a back port of commit 382f4c69b85482e885511dd001710fd145469a76 Closes #64
- commit
- 5378e2e5b9a7622c02c41d64ca196d52ccadcc9c
- author
- TotallyGamerJet · · 2022-11-09 13:42 UTC
- committer
- GitHub · · 2022-11-09 13:42 UTC
- parent
- 786906f
- signature
- GPG Unverified
4AEE18F83AFDEB23The key is unknown - refs
- tag: v0.1.1
1 file · +4 -4
M sys_darwin_amd64.s +4 -4
| @@ -88,7 +88,7 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||
| 88 | 88 | MOVQ 0(SP), AX | |
| 89 | 89 | ADDQ $8, SP | |
| 90 | 90 | ||
| 91 | - | MOVQ 0(SP), R12 // get the return SP so that we can align register args with stack args | |
| 91 | + | MOVQ 0(SP), R10 // get the return SP so that we can align register args with stack args | |
| 92 | 92 | ||
| 93 | 93 | // make space for first six arguments below the frame | |
| 94 | 94 | ADJSP $6*8, SP | |
| @@ -100,7 +100,7 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||
| 100 | 100 | MOVQ R9, 48(SP) | |
| 101 | 101 | LEAQ 8(SP), R8 // R8 = address of args vector | |
| 102 | 102 | ||
| 103 | - | MOVQ R12, 0(SP) // push the stack pointer below registers | |
| 103 | + | MOVQ R10, 0(SP) // push the stack pointer below registers | |
| 104 | 104 | ||
| 105 | 105 | // determine index into runtime·cbs table | |
| 106 | 106 | MOVQ $callbackasm(SB), DX | |
| @@ -139,10 +139,10 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||
| 139 | 139 | ||
| 140 | 140 | POP_REGS_HOST_TO_ABI0() | |
| 141 | 141 | ||
| 142 | - | MOVQ 0(SP), R12 // get the SP back | |
| 142 | + | MOVQ 0(SP), R10 // get the SP back | |
| 143 | 143 | ||
| 144 | 144 | ADJSP $-6*8, SP // remove arguments | |
| 145 | 145 | ||
| 146 | - | MOVQ R12, 0(SP) | |
| 146 | + | MOVQ R10, 0(SP) | |
| 147 | 147 | ||
| 148 | 148 | RET | |
| @@ -88,7 +88,7 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||||
| 88 | MOVQ 0(SP), AX | 88 | MOVQ 0(SP), AX | ||
| 89 | ADDQ $8, SP | 89 | ADDQ $8, SP | ||
| 90 | 90 | ||||
| 91 | - | MOVQ 0(SP), R12 // get the return SP so that we can align register args with stack args | 91 | + | MOVQ 0(SP), R10 // get the return SP so that we can align register args with stack args |
| 92 | 92 | ||||
| 93 | // make space for first six arguments below the frame | 93 | // make space for first six arguments below the frame | ||
| 94 | ADJSP $6*8, SP | 94 | ADJSP $6*8, SP | ||
| @@ -100,7 +100,7 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||||
| 100 | MOVQ R9, 48(SP) | 100 | MOVQ R9, 48(SP) | ||
| 101 | LEAQ 8(SP), R8 // R8 = address of args vector | 101 | LEAQ 8(SP), R8 // R8 = address of args vector | ||
| 102 | 102 | ||||
| 103 | - | MOVQ R12, 0(SP) // push the stack pointer below registers | 103 | + | MOVQ R10, 0(SP) // push the stack pointer below registers |
| 104 | 104 | ||||
| 105 | // determine index into runtime·cbs table | 105 | // determine index into runtime·cbs table | ||
| 106 | MOVQ $callbackasm(SB), DX | 106 | MOVQ $callbackasm(SB), DX | ||
| @@ -139,10 +139,10 @@ TEXT callbackasm1(SB), NOSPLIT, $0 | |||||
| 139 | 139 | ||||
| 140 | POP_REGS_HOST_TO_ABI0() | 140 | POP_REGS_HOST_TO_ABI0() | ||
| 141 | 141 | ||||
| 142 | - | MOVQ 0(SP), R12 // get the SP back | 142 | + | MOVQ 0(SP), R10 // get the SP back |
| 143 | 143 | ||||
| 144 | ADJSP $-6*8, SP // remove arguments | 144 | ADJSP $-6*8, SP // remove arguments | ||
| 145 | 145 | ||||
| 146 | - | MOVQ R12, 0(SP) | 146 | + | MOVQ R10, 0(SP) |
| 147 | 147 | ||||
| 148 | RET | 148 | RET | ||