xref: /reactos/dll/win32/rpcrt4/msvc.S (revision 50cf16b3)
1
2#include <asm.inc>
3
4#ifdef _M_IX86
5.code32
6
7EXTERN _ndr_client_call:PROC
8
9PUBLIC _call_stubless_func
10_call_stubless_func:
11
12    mov ecx,[esp+4]        /* This Pointer */
13    mov ecx,[ecx]          /* This->lpVtbl */
14    mov ecx,[ecx-8]        /* MIDL_STUBLESS_PROXY_INFO */
15    mov edx,[ecx+8]        /* Info->FormatStringOffset */
16    mov edx,[edx+eax*2]    /* FormatStringOffset[index] */
17    and edx, 0000FFFFh
18    add edx,[ecx+4]        /* info->ProcFormatString + offset */
19    mov eax, [edx+8]       /* arguments size */
20    and eax, 0000FFFFh
21    push eax
22    lea eax, [esp+8]       /* &This */
23    push eax
24    push edx               /* format string */
25    push [ecx]             /* info->pstubdesc */
26    call _ndr_client_call
27    lea esp, [esp+12]
28    pop edx                /* arguments size */
29    mov ecx, [esp]         /* return address */
30    add esp, edx
31    jmp ecx
32#else
33.code64
34
35EXTERN ndr_client_call:PROC
36
37PUBLIC call_stubless_func
38FUNC call_stubless_func
39    mov [rsp + 8], rcx
40    .SAVEREG rcx, 8
41    mov [rsp + 10h], rdx
42    .SAVEREG rdx, 10h
43    mov [rsp + 18h], r8
44    .SAVEREG r8, 18h
45    mov [rsp + 20h], r9
46    .SAVEREG r9, 20h
47    sub rsp, 38h
48    .ALLOCSTACK 38h
49    .ENDPROLOG
50
51    lea r8, [rsp +38h + 8]   /* &This */
52    mov rcx, [rcx]           /* This->lpVtbl */
53    mov rcx, [rcx - 10h]     /* MIDL_STUBLESS_PROXY_INFO */
54    mov rdx, [rcx + 10h]     /* info->FormatStringOffset */
55    movzx rdx, word ptr [rdx+r10*2] /* FormatStringOffset[index] */
56    add rdx, [rcx + 8]       /* info->ProcFormatString + offset */
57    mov rcx, [rcx]           /* info->pStubDesc */
58
59    movaps [rsp + 20h], xmm1
60    movaps [rsp + 28h], xmm2
61    movaps [rsp + 30h], xmm3
62    lea r9, [rsp + 18h]      /* fpu_args */
63    call ndr_client_call
64    add rsp, 38h
65    ret
66ENDFUNC
67
68PUBLIC call_server_func
69FUNC call_server_func
70    push rbp
71    .PUSHREG rbp
72    mov rbp, rsp
73    push rsi
74    .PUSHREG rsi
75    push rdi
76    .PUSHREG rdi
77    .ENDPROLOG
78
79    mov rax, rcx   /* function to call */
80    mov rcx, 32    /* allocate max(32,stack_size) bytes of stack space */
81    cmp r8, rcx
82    cmovg rcx, r8
83    sub rsp, rcx
84    and rsp, NOT 15
85    mov rcx, r8
86    shr rcx, 3
87    mov rdi, rsp
88    mov rsi, rdx
89    rep movsq       /* copy arguments */
90    mov rcx, [rsp]
91    mov rdx, [rsp + 8]
92    mov r8, [rsp + 16]
93    mov r9, [rsp + 24]
94    movd xmm0, rcx
95    movd xmm1, rdx
96    movd xmm2, r8
97    movd xmm3, r9
98    call rax
99
100    lea rsp, [rbp - 16] /* restore stack */
101    pop rdi
102    pop rsi
103    pop rbp
104    ret
105ENDFUNC
106
107
108PUBLIC NdrClientCall2
109FUNC NdrClientCall2
110    mov [rsp + 18h], r8
111    .SAVEREG r8, 18h
112    mov [rsp + 20h], r9
113    .SAVEREG r9, 20h
114    sub rsp, 28h
115    .ALLOCSTACK 28h
116    .ENDPROLOG
117
118    lea r8, [rsp + 28h + 18h]
119    xor r9, r9
120    call ndr_client_call
121
122    add rsp, 28h
123    ret
124ENDFUNC
125
126EXTERN ndr_async_client_call:PROC
127PUBLIC NdrAsyncClientCall
128FUNC NdrAsyncClientCall
129    mov [rsp + 18h], r8
130    .SAVEREG r8, 18h
131    mov [rsp + 20h], r9
132    .SAVEREG r9, 20h
133    sub rsp, 28h
134    .ALLOCSTACK 28h
135    .ENDPROLOG
136
137    lea r8, [rsp + 28h + 18h]
138    call ndr_async_client_call
139
140    add rsp, 28h
141    ret
142ENDFUNC
143
144#endif
145
146END
147