Text file src/internal/runtime/syscall/windows/asm_windows_386.s

     1  // Copyright 2025 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  #include "go_asm.h"
     6  #include "textflag.h"
     7  
     8  TEXT ·StdCall<ABIInternal>(SB),NOSPLIT,$0
     9  	JMP	·asmstdcall(SB)
    10  
    11  TEXT ·asmstdcall(SB),NOSPLIT,$0
    12  	MOVL	fn+0(FP), BX
    13  	MOVL	SP, BP	// save stack pointer
    14  
    15  	// SetLastError(0).
    16  	MOVL	$0, 0x34(FS)
    17  
    18  	MOVL	StdCallInfo_N(BX), CX
    19  
    20  	// Fast version, do not store args on the stack.
    21  	CMPL	CX, $0
    22  	JE	docall
    23  
    24  	// Copy args to the stack.
    25  	MOVL	CX, AX
    26  	SALL	$2, AX
    27  	SUBL	AX, SP			// room for args
    28  	MOVL	SP, DI
    29  	MOVL	StdCallInfo_Args(BX), SI
    30  	CLD
    31  	REP; MOVSL
    32  
    33  docall:
    34  	// Call stdcall or cdecl function.
    35  	// DI SI BP BX are preserved, SP is not
    36  	CALL	StdCallInfo_Fn(BX)
    37  	MOVL	BP, SP
    38  
    39  	// Return result.
    40  	MOVL	fn+0(FP), BX
    41  	MOVL	AX, StdCallInfo_R1(BX)
    42  	MOVL	DX, StdCallInfo_R2(BX)
    43  
    44  	// GetLastError().
    45  	MOVL	0x34(FS), AX
    46  	MOVL	AX, StdCallInfo_Err(BX)
    47  
    48  	RET
    49  

View as plain text