Commit 3879ea54 authored by Iskander Sharipov's avatar Iskander Sharipov Committed by Brad Fitzpatrick

runtime: fix Go prototypes in amd64 asm code

Also adds some missing asmdecl comments for funcs with Go proto.

Change-Id: Iabc68e8c0ad936e06ed719e0f030bfc5f6f6e168
Reviewed-on: https://go-review.googlesource.com/127760
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent b0dc5469
...@@ -228,7 +228,7 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 ...@@ -228,7 +228,7 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0
* go-routine * go-routine
*/ */
// void gosave(Gobuf*) // func gosave(buf *gobuf)
// save state in Gobuf; setjmp // save state in Gobuf; setjmp
TEXT runtime·gosave(SB), NOSPLIT, $0-8 TEXT runtime·gosave(SB), NOSPLIT, $0-8
MOVQ buf+0(FP), AX // gobuf MOVQ buf+0(FP), AX // gobuf
...@@ -248,7 +248,7 @@ TEXT runtime·gosave(SB), NOSPLIT, $0-8 ...@@ -248,7 +248,7 @@ TEXT runtime·gosave(SB), NOSPLIT, $0-8
MOVQ BX, gobuf_g(AX) MOVQ BX, gobuf_g(AX)
RET RET
// void gogo(Gobuf*) // func gogo(buf *gobuf)
// restore state from Gobuf; longjmp // restore state from Gobuf; longjmp
TEXT runtime·gogo(SB), NOSPLIT, $16-8 TEXT runtime·gogo(SB), NOSPLIT, $16-8
MOVQ buf+0(FP), BX // gobuf MOVQ buf+0(FP), BX // gobuf
...@@ -560,7 +560,8 @@ TEXT ·publicationBarrier(SB),NOSPLIT,$0-0 ...@@ -560,7 +560,8 @@ TEXT ·publicationBarrier(SB),NOSPLIT,$0-0
// compile barrier. // compile barrier.
RET RET
// void jmpdefer(fn, sp); // func jmpdefer(fv *funcval, argp uintptr)
// argp is a caller SP.
// called from deferreturn. // called from deferreturn.
// 1. pop the caller // 1. pop the caller
// 2. sub 5 bytes from the callers return // 2. sub 5 bytes from the callers return
...@@ -670,7 +671,7 @@ nosave: ...@@ -670,7 +671,7 @@ nosave:
MOVL AX, ret+16(FP) MOVL AX, ret+16(FP)
RET RET
// cgocallback(void (*fn)(void*), void *frame, uintptr framesize, uintptr ctxt) // func cgocallback(fn, frame unsafe.Pointer, framesize, ctxt uintptr)
// Turn the fn into a Go func (by taking its address) and call // Turn the fn into a Go func (by taking its address) and call
// cgocallback_gofunc. // cgocallback_gofunc.
TEXT runtime·cgocallback(SB),NOSPLIT,$32-32 TEXT runtime·cgocallback(SB),NOSPLIT,$32-32
...@@ -686,7 +687,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$32-32 ...@@ -686,7 +687,7 @@ TEXT runtime·cgocallback(SB),NOSPLIT,$32-32
CALL AX CALL AX
RET RET
// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize, uintptr ctxt) // func cgocallback_gofunc(fn, frame, framesize, ctxt uintptr)
// See cgocall.go for more details. // See cgocall.go for more details.
TEXT ·cgocallback_gofunc(SB),NOSPLIT,$16-32 TEXT ·cgocallback_gofunc(SB),NOSPLIT,$16-32
NO_LOCAL_POINTERS NO_LOCAL_POINTERS
...@@ -811,7 +812,8 @@ havem: ...@@ -811,7 +812,8 @@ havem:
// Done! // Done!
RET RET
// void setg(G*); set g. for use by needm. // func setg(gg *g)
// set g. for use by needm.
TEXT runtime·setg(SB), NOSPLIT, $0-8 TEXT runtime·setg(SB), NOSPLIT, $0-8
MOVQ gg+0(FP), BX MOVQ gg+0(FP), BX
#ifdef GOOS_windows #ifdef GOOS_windows
...@@ -866,6 +868,7 @@ done: ...@@ -866,6 +868,7 @@ done:
MOVQ AX, ret+0(FP) MOVQ AX, ret+0(FP)
RET RET
// func aeshash(p unsafe.Pointer, h, s uintptr) uintptr
// hash function using AES hardware instructions // hash function using AES hardware instructions
TEXT runtime·aeshash(SB),NOSPLIT,$0-32 TEXT runtime·aeshash(SB),NOSPLIT,$0-32
MOVQ p+0(FP), AX // ptr to data MOVQ p+0(FP), AX // ptr to data
...@@ -873,6 +876,7 @@ TEXT runtime·aeshash(SB),NOSPLIT,$0-32 ...@@ -873,6 +876,7 @@ TEXT runtime·aeshash(SB),NOSPLIT,$0-32
LEAQ ret+24(FP), DX LEAQ ret+24(FP), DX
JMP runtime·aeshashbody(SB) JMP runtime·aeshashbody(SB)
// func aeshashstr(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·aeshashstr(SB),NOSPLIT,$0-24 TEXT runtime·aeshashstr(SB),NOSPLIT,$0-24
MOVQ p+0(FP), AX // ptr to string struct MOVQ p+0(FP), AX // ptr to string struct
MOVQ 8(AX), CX // length of string MOVQ 8(AX), CX // length of string
...@@ -1211,6 +1215,7 @@ aesloop: ...@@ -1211,6 +1215,7 @@ aesloop:
MOVQ X8, (DX) MOVQ X8, (DX)
RET RET
// func aeshash32(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·aeshash32(SB),NOSPLIT,$0-24 TEXT runtime·aeshash32(SB),NOSPLIT,$0-24
MOVQ p+0(FP), AX // ptr to data MOVQ p+0(FP), AX // ptr to data
MOVQ h+8(FP), X0 // seed MOVQ h+8(FP), X0 // seed
...@@ -1221,6 +1226,7 @@ TEXT runtime·aeshash32(SB),NOSPLIT,$0-24 ...@@ -1221,6 +1226,7 @@ TEXT runtime·aeshash32(SB),NOSPLIT,$0-24
MOVQ X0, ret+16(FP) MOVQ X0, ret+16(FP)
RET RET
// func aeshash64(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·aeshash64(SB),NOSPLIT,$0-24 TEXT runtime·aeshash64(SB),NOSPLIT,$0-24
MOVQ p+0(FP), AX // ptr to data MOVQ p+0(FP), AX // ptr to data
MOVQ h+8(FP), X0 // seed MOVQ h+8(FP), X0 // seed
...@@ -1266,6 +1272,7 @@ DATA masks<>+0xf0(SB)/8, $0xffffffffffffffff ...@@ -1266,6 +1272,7 @@ DATA masks<>+0xf0(SB)/8, $0xffffffffffffffff
DATA masks<>+0xf8(SB)/8, $0x00ffffffffffffff DATA masks<>+0xf8(SB)/8, $0x00ffffffffffffff
GLOBL masks<>(SB),RODATA,$256 GLOBL masks<>(SB),RODATA,$256
// func checkASM() bool
TEXT ·checkASM(SB),NOSPLIT,$0-1 TEXT ·checkASM(SB),NOSPLIT,$0-1
// check that masks<>(SB) and shifts<>(SB) are aligned to 16-byte // check that masks<>(SB) and shifts<>(SB) are aligned to 16-byte
MOVQ $masks<>(SB), AX MOVQ $masks<>(SB), AX
...@@ -1616,6 +1623,7 @@ DEBUG_CALL_FN(debugCall16384<>, 16384) ...@@ -1616,6 +1623,7 @@ DEBUG_CALL_FN(debugCall16384<>, 16384)
DEBUG_CALL_FN(debugCall32768<>, 32768) DEBUG_CALL_FN(debugCall32768<>, 32768)
DEBUG_CALL_FN(debugCall65536<>, 65536) DEBUG_CALL_FN(debugCall65536<>, 65536)
// func debugCallPanicked(val interface{})
TEXT runtime·debugCallPanicked(SB),NOSPLIT,$16-16 TEXT runtime·debugCallPanicked(SB),NOSPLIT,$16-16
// Copy the panic value to the top of stack. // Copy the panic value to the top of stack.
MOVQ val_type+0(FP), AX MOVQ val_type+0(FP), AX
......
...@@ -178,7 +178,7 @@ func goexit(neverCallThisFunction) ...@@ -178,7 +178,7 @@ func goexit(neverCallThisFunction)
// cgocallback_gofunc is not called from go, only from cgocallback, // cgocallback_gofunc is not called from go, only from cgocallback,
// so the arguments will be found via cgocallback's pointer-declared arguments. // so the arguments will be found via cgocallback's pointer-declared arguments.
// See the assembly implementations for more details. // See the assembly implementations for more details.
func cgocallback_gofunc(fv uintptr, frame uintptr, framesize, ctxt uintptr) func cgocallback_gofunc(fv, frame, framesize, ctxt uintptr)
// publicationBarrier performs a store/store barrier (a "publication" // publicationBarrier performs a store/store barrier (a "publication"
// or "export" barrier). Some form of synchronization is required // or "export" barrier). Some form of synchronization is required
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment