From: Anthony Martin Date: Thu, 28 Aug 2014 23:02:15 +0000 (-0700) Subject: runtime: fix Plan 9 build for new C calling convention X-Git-Tag: go1.4beta1~643 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b3de7f28a8c111043013cc539421021a32176c33;p=gostls13.git runtime: fix Plan 9 build for new C calling convention LGTM=0intro, rsc R=rsc, 0intro CC=golang-codereviews https://golang.org/cl/132320043 --- diff --git a/src/pkg/runtime/sys_plan9_386.s b/src/pkg/runtime/sys_plan9_386.s index e40721d342..43fb367ed9 100644 --- a/src/pkg/runtime/sys_plan9_386.s +++ b/src/pkg/runtime/sys_plan9_386.s @@ -217,28 +217,29 @@ TEXT runtime·setfpmasks(SB),NOSPLIT,$0 #define ERRMAX 128 /* from os_plan9.h */ -// func errstr() String +// void errstr(int8 *buf, int32 len) +TEXT errstr<>(SB),NOSPLIT,$0 + MOVL $41, AX + INT $64 + RET + +// func errstr() string // Only used by package syscall. // Grab error string due to a syscall made // in entersyscall mode, without going // through the allocator (issue 4994). // See ../syscall/asm_plan9_386.s:/·Syscall/ -TEXT runtime·errstr(SB),NOSPLIT,$0 +TEXT runtime·errstr(SB),NOSPLIT,$8-8 get_tls(AX) MOVL g(AX), BX MOVL g_m(BX), BX MOVL m_errstr(BX), CX - MOVL CX, ret_base+0(FP) - MOVL $ERRMAX, ret_len+4(FP) - MOVL $41, AX - INT $64 - - // syscall requires caller-save - MOVL ret_base+0(FP), CX - - // push the argument - PUSHL CX + MOVL CX, 0(SP) + MOVL $ERRMAX, 4(SP) + CALL errstr<>(SB) CALL runtime·findnull(SB) - POPL CX + MOVL 4(SP), AX MOVL AX, ret_len+4(FP) + MOVL 0(SP), AX + MOVL AX, ret_base+0(FP) RET diff --git a/src/pkg/runtime/sys_plan9_amd64.s b/src/pkg/runtime/sys_plan9_amd64.s index d83a57e2ac..ea0bd57b20 100644 --- a/src/pkg/runtime/sys_plan9_amd64.s +++ b/src/pkg/runtime/sys_plan9_amd64.s @@ -212,28 +212,29 @@ TEXT runtime·setfpmasks(SB),NOSPLIT,$8 #define ERRMAX 128 /* from os_plan9.h */ -// func errstr() String +// void errstr(int8 *buf, int32 len) +TEXT errstr<>(SB),NOSPLIT,$0 + MOVQ $41, BP + SYSCALL + RET + +// func errstr() string // Only used by package syscall. // Grab error string due to a syscall made // in entersyscall mode, without going // through the allocator (issue 4994). -// See ../syscall/asm_plan9_386.s:/·Syscall/ -TEXT runtime·errstr(SB),NOSPLIT,$0 +// See ../syscall/asm_plan9_amd64.s:/·Syscall/ +TEXT runtime·errstr(SB),NOSPLIT,$16-16 get_tls(AX) MOVQ g(AX), BX MOVQ g_m(BX), BX MOVQ m_errstr(BX), CX - MOVQ CX, ret_base+0(FP) - MOVQ $ERRMAX, ret_len+8(FP) - MOVQ $41, BP - SYSCALL - - // syscall requires caller-save - MOVQ ret_base+0(FP), CX - - // push the argument - PUSHQ CX + MOVQ CX, 0(SP) + MOVQ $ERRMAX, 8(SP) + CALL errstr<>(SB) CALL runtime·findnull(SB) - POPQ CX + MOVQ 8(SP), AX MOVQ AX, ret_len+8(FP) + MOVQ 0(SP), AX + MOVQ AX, ret_base+0(FP) RET