1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:50:05 -07:00

liblink: make GO_ARGS the default for functions beginning with ·

If there is a leading ·, assume there is a Go prototype and
attach the Go prototype information to the function.
If the function is not called from Go and does not need a
Go prototype, it can be made file-local instead (using name<>(SB)).

This fixes the current BSD build failures, by giving functions like
sync/atomic.StoreUint32 argument stack map information.

Fixes #8753.

LGTM=khr, iant
R=golang-codereviews, iant, khr, bradfitz
CC=golang-codereviews, r, rlh
https://golang.org/cl/142150043
This commit is contained in:
Russ Cox 2014-09-16 17:39:55 -04:00
parent f1abe0d06b
commit 653fb6d872
25 changed files with 42 additions and 112 deletions

View File

@ -125,7 +125,7 @@ static LSym *rdsym(Link*, Biobuf*, char*);
void
writeobj(Link *ctxt, Biobuf *b)
{
int flag;
int flag, found;
Hist *h;
LSym *s, *text, *etext, *curtext, *data, *edata;
Plist *pl;
@ -252,6 +252,27 @@ writeobj(Link *ctxt, Biobuf *b)
}
}
// Add reference to Go arguments for C or assembly functions without them.
for(s = text; s != nil; s = s->next) {
if(strncmp(s->name, "\"\".", 3) != 0)
continue;
found = 0;
for(p = s->text; p != nil; p = p->link) {
if(p->as == ctxt->arch->AFUNCDATA && p->from.type == ctxt->arch->D_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) {
found = 1;
break;
}
}
if(!found) {
p = appendp(ctxt, s->text);
p->as = ctxt->arch->AFUNCDATA;
p->from.type = ctxt->arch->D_CONST;
p->from.offset = FUNCDATA_ArgsPointerMaps;
p->to.type = ctxt->arch->D_EXTERN;
p->to.sym = linklookup(ctxt, smprint("%s.args_stackmap", s->name), s->version);
}
}
// Turn functions into machine code images.
for(s = text; s != nil; s = s->next) {
mkfwd(s);

View File

@ -646,15 +646,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8
GO_ARGS
TEXT ·asmcgocall(SB),NOSPLIT,$0-8
MOVL fn+0(FP), AX
MOVL arg+4(FP), BX
CALL asmcgocall<>(SB)
RET
TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12
GO_ARGS
TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12
MOVL fn+0(FP), AX
MOVL arg+4(FP), BX
CALL asmcgocall<>(SB)
@ -714,8 +712,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$12-12
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize)
// See cgocall.c for more details.
TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$12-12
GO_ARGS
TEXT ·cgocallback_gofunc(SB),NOSPLIT,$12-12
NO_LOCAL_POINTERS
// If g is nil, Go did not create the current thread.

View File

@ -623,15 +623,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
TEXT runtime·asmcgocall(SB),NOSPLIT,$0-16
GO_ARGS
TEXT ·asmcgocall(SB),NOSPLIT,$0-16
MOVQ fn+0(FP), AX
MOVQ arg+8(FP), BX
CALL asmcgocall<>(SB)
RET
TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-20
GO_ARGS
TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-20
MOVQ fn+0(FP), AX
MOVQ arg+8(FP), BX
CALL asmcgocall<>(SB)
@ -700,8 +698,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$24-24
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize)
// See cgocall.c for more details.
TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$8-24
GO_ARGS
TEXT ·cgocallback_gofunc(SB),NOSPLIT,$8-24
NO_LOCAL_POINTERS
// If g is nil, Go did not create the current thread.

View File

@ -480,15 +480,13 @@ TEXT gosave<>(SB),NOSPLIT,$0
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
// See cgocall.c for more details.
TEXT runtime·asmcgocall(SB),NOSPLIT,$0-8
GO_ARGS
TEXT ·asmcgocall(SB),NOSPLIT,$0-8
MOVW fn+0(FP), R1
MOVW arg+4(FP), R0
BL asmcgocall<>(SB)
RET
TEXT runtime·asmcgocall_errno(SB),NOSPLIT,$0-12
GO_ARGS
TEXT ·asmcgocall_errno(SB),NOSPLIT,$0-12
MOVW fn+0(FP), R1
MOVW arg+4(FP), R0
BL asmcgocall<>(SB)
@ -551,8 +549,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$12-12
// cgocallback_gofunc(void (*fn)(void*), void *frame, uintptr framesize)
// See cgocall.c for more details.
TEXT runtime·cgocallback_gofunc(SB),NOSPLIT,$8-12
GO_ARGS
TEXT ·cgocallback_gofunc(SB),NOSPLIT,$8-12
NO_LOCAL_POINTERS
// Load m and g from thread-local storage.

View File

@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI

View File

@ -17,7 +17,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -67,7 +65,6 @@ ok6:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -89,7 +86,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX

View File

@ -14,7 +14,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-32
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -39,7 +38,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-44
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -67,7 +65,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -98,7 +95,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-32
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-44
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI

View File

@ -15,7 +15,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-64
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -39,7 +38,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-88
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -63,7 +61,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-112
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 16(SP), DI
@ -97,7 +94,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-64
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -118,7 +114,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX

View File

@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI

View File

@ -23,7 +23,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -47,7 +46,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -71,7 +69,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 16(SP), DI
@ -105,7 +102,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -126,7 +122,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX

View File

@ -14,7 +14,6 @@
// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, errno uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@ -37,7 +36,6 @@ error:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@ -64,7 +62,6 @@ error6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
@ -91,7 +88,6 @@ error9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
@ -111,7 +107,6 @@ errorr:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2

View File

@ -16,7 +16,6 @@
// Trap # in AX, args in BX CX DX SI DI, return in AX
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
@ -42,7 +41,6 @@ ok:
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
@ -69,7 +67,6 @@ ok6:
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
MOVL 12(SP), CX
@ -92,7 +89,6 @@ ok1:
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX
MOVL 12(SP), CX
@ -119,7 +115,6 @@ ok2:
// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0.
TEXT ·socketcall(SB),NOSPLIT,$0-36
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number
@ -144,7 +139,6 @@ oksock:
// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0.
TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
GO_ARGS
MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number
LEAL 8(SP), CX // pointer to call arguments
@ -170,7 +164,6 @@ oksock1:
// Underlying system call is
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
TEXT ·seek(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL $SYS__LLSEEK, AX // syscall entry
MOVL 4(SP), BX // fd

View File

@ -18,7 +18,6 @@
// would pass 4th arg in CX, not R10.
TEXT ·Syscall(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -44,7 +43,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI
MOVQ 24(SP), SI
@ -70,7 +68,6 @@ ok6:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -93,7 +90,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -116,7 +112,6 @@ ok2:
RET
TEXT ·gettimeofday(SB),NOSPLIT,$0-16
GO_ARGS
MOVQ 8(SP), DI
MOVQ $0, SI
MOVQ runtime·__vdso_gettimeofday_sym(SB), AX

View File

@ -14,7 +14,6 @@
// func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 4(SP), R7
MOVW 8(SP), R0
@ -46,7 +45,6 @@ ok:
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually Syscall5 but the rest of the code expects it to be named Syscall6.
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
@ -78,7 +76,6 @@ ok6:
// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually RawSyscall5 but the rest of the code expects it to be named RawSyscall6.
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
MOVW 12(SP), R1
@ -111,7 +108,6 @@ ok2:
// Underlying system call is
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
TEXT ·seek(SB),NOSPLIT,$0-32
GO_ARGS
BL runtime·entersyscall(SB)
MOVW $SYS__LLSEEK, R7 // syscall entry
MOVW 4(SP), R0 // fd
@ -139,7 +135,6 @@ okseek:
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0
MOVW 12(SP), R1

View File

@ -17,7 +17,6 @@
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$12-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), BX

View File

@ -17,7 +17,6 @@
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), DI

View File

@ -17,7 +17,6 @@
MOVW $(0x10000 + ((code)<<5)), R8; B (R8)
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
BL runtime·entersyscall(SB)
MOVW trap+0(FP), R8
MOVW a1+4(FP), R0

View File

@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI

View File

@ -18,7 +18,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -66,7 +64,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -99,7 +96,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX

View File

@ -14,7 +14,6 @@
// func Syscall9(trap int32, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int32)
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@ -37,7 +36,6 @@ error:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@ -63,7 +61,6 @@ error6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
BL runtime·entersyscall(SB)
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
@ -89,7 +86,6 @@ error9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
MOVW 8(FP), R2 // a2
@ -109,7 +105,6 @@ errorr:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVW 0(FP), R0 // sigcall num
MOVW 4(FP), R1 // a1
MOVW 8(FP), R2 // a2

View File

@ -17,7 +17,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-28
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -70,7 +68,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -101,7 +98,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -123,7 +119,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI

View File

@ -18,7 +18,6 @@
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -42,7 +41,6 @@ ok:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -66,7 +64,6 @@ ok6:
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-104
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
@ -99,7 +96,6 @@ ok9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
@ -120,7 +116,6 @@ ok1:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX

View File

@ -19,7 +19,6 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-32
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -55,7 +54,6 @@ copyresult3:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-44
GO_ARGS
CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
@ -94,7 +92,6 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -110,7 +107,6 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-28
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
GO_ARGS
MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
@ -132,7 +128,6 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
TEXT ·seek(SB),NOSPLIT,$0-36
GO_ARGS
LEAL newoffset+24(SP), AX
MOVL AX, placeholder+4(SP)
@ -164,7 +159,6 @@ copyresult6:
//func exit(code int)
// Import runtime·exit for cleanly exiting.
TEXT ·exit(SB),NOSPLIT,$4-4
GO_ARGS
NO_LOCAL_POINTERS
MOVL code+0(FP), AX
MOVL AX, 0(SP)

View File

@ -18,7 +18,6 @@
//func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-64
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
@ -54,7 +53,6 @@ copyresult3:
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-88
GO_ARGS
CALL runtime·entersyscall(SB)
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
@ -93,7 +91,6 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
GO_ARGS
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
LEAQ 16(SP), SI
@ -109,7 +106,6 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
GO_ARGS
MOVQ 8(SP), BP // syscall entry
// slide args down on top of system call number
LEAQ 16(SP), SI
@ -131,7 +127,6 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
TEXT ·seek(SB),NOSPLIT,$0-56
GO_ARGS
LEAQ newoffset+40(SP), AX
MOVQ AX, placeholder+8(SP)
@ -162,7 +157,6 @@ copyresult6:
//func exit(code int)
// Import runtime·exit for cleanly exiting.
TEXT ·exit(SB),NOSPLIT,$8-8
GO_ARGS
NO_LOCAL_POINTERS
MOVQ code+0(FP), AX
MOVQ AX, 0(SP)

View File

@ -12,6 +12,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
@ -190,7 +191,6 @@ func main() {
return
}
defer os.RemoveAll(dir)
ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte("package main\nfunc main()\n"), 0666)
tests = strings.Replace(tests, "\t", " ", -1)
tests = commentRE.ReplaceAllString(tests, "")
@ -230,6 +230,9 @@ TestCases:
continue
}
var gobuf bytes.Buffer
fmt.Fprintf(&gobuf, "package main\n")
var buf bytes.Buffer
if goarch == "arm" {
fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n")
@ -277,11 +280,17 @@ TestCases:
body = callRE.ReplaceAllString(body, "CALL ·$1(SB);")
body = callindRE.ReplaceAllString(body, "CALL REGISTER;")
fmt.Fprintf(&gobuf, "func %s()\n", name)
fmt.Fprintf(&buf, "TEXT ·%s(SB)%s,$%d-0\n\t%s\n\tRET\n\n", name, nosplit, size, body)
}
}
ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666)
if err := ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666); err != nil {
log.Fatal(err)
}
if err := ioutil.WriteFile(filepath.Join(dir, "main.go"), gobuf.Bytes(), 0666); err != nil {
log.Fatal(err)
}
cmd := exec.Command("go", "build")
cmd.Dir = dir