ReactOS 0.4.16-dev-1946-g52006dd
thunks.c
Go to the documentation of this file.
1/*
2 * vtbl thunks
3 *
4 * Copyright 2009, 2023 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#if 0
22#pragma makedep arm64ec_x64
23#endif
24
25#define COBJMACROS
26
27#include <stdarg.h>
28
29#include "windef.h"
30#include "winbase.h"
31#include "objbase.h"
32#include "rpcproxy.h"
33#include "cpsf.h"
34#include "ndrtypes.h"
35#include "ndr_stubless.h"
36#include "wine/asm.h"
37
38#define ALL_THUNK_ENTRIES \
39 T(3) T(4) T(5) T(6) T(7) T(8) T(9) T(10) T(11) T(12) T(13) T(14) T(15) \
40 T(16) T(17) T(18) T(19) T(20) T(21) T(22) T(23) T(24) T(25) T(26) T(27) T(28) T(29) T(30) T(31) \
41 T(32) T(33) T(34) T(35) T(36) T(37) T(38) T(39) T(40) T(41) T(42) T(43) T(44) T(45) T(46) T(47) \
42 T(48) T(49) T(50) T(51) T(52) T(53) T(54) T(55) T(56) T(57) T(58) T(59) T(60) T(61) T(62) T(63) \
43 T(64) T(65) T(66) T(67) T(68) T(69) T(70) T(71) T(72) T(73) T(74) T(75) T(76) T(77) T(78) T(79) \
44 T(80) T(81) T(82) T(83) T(84) T(85) T(86) T(87) T(88) T(89) T(90) T(91) T(92) T(93) T(94) T(95) \
45 T(96) T(97) T(98) T(99) T(100) T(101) T(102) T(103) T(104) T(105) T(106) T(107) T(108) T(109) T(110) T(111) \
46 T(112) T(113) T(114) T(115) T(116) T(117) T(118) T(119) T(120) T(121) T(122) T(123) T(124) T(125) T(126) T(127) \
47 T(128) T(129) T(130) T(131) T(132) T(133) T(134) T(135) T(136) T(137) T(138) T(139) T(140) T(141) T(142) T(143) \
48 T(144) T(145) T(146) T(147) T(148) T(149) T(150) T(151) T(152) T(153) T(154) T(155) T(156) T(157) T(158) T(159) \
49 T(160) T(161) T(162) T(163) T(164) T(165) T(166) T(167) T(168) T(169) T(170) T(171) T(172) T(173) T(174) T(175) \
50 T(176) T(177) T(178) T(179) T(180) T(181) T(182) T(183) T(184) T(185) T(186) T(187) T(188) T(189) T(190) T(191) \
51 T(192) T(193) T(194) T(195) T(196) T(197) T(198) T(199) T(200) T(201) T(202) T(203) T(204) T(205) T(206) T(207) \
52 T(208) T(209) T(210) T(211) T(212) T(213) T(214) T(215) T(216) T(217) T(218) T(219) T(220) T(221) T(222) T(223) \
53 T(224) T(225) T(226) T(227) T(228) T(229) T(230) T(231) T(232) T(233) T(234) T(235) T(236) T(237) T(238) T(239) \
54 T(240) T(241) T(242) T(243) T(244) T(245) T(246) T(247) T(248) T(249) T(250) T(251) T(252) T(253) T(254) T(255) \
55 T(256) T(257) T(258) T(259) T(260) T(261) T(262) T(263) T(264) T(265) T(266) T(267) T(268) T(269) T(270) T(271) \
56 T(272) T(273) T(274) T(275) T(276) T(277) T(278) T(279) T(280) T(281) T(282) T(283) T(284) T(285) T(286) T(287) \
57 T(288) T(289) T(290) T(291) T(292) T(293) T(294) T(295) T(296) T(297) T(298) T(299) T(300) T(301) T(302) T(303) \
58 T(304) T(305) T(306) T(307) T(308) T(309) T(310) T(311) T(312) T(313) T(314) T(315) T(316) T(317) T(318) T(319) \
59 T(320) T(321) T(322) T(323) T(324) T(325) T(326) T(327) T(328) T(329) T(330) T(331) T(332) T(333) T(334) T(335) \
60 T(336) T(337) T(338) T(339) T(340) T(341) T(342) T(343) T(344) T(345) T(346) T(347) T(348) T(349) T(350) T(351) \
61 T(352) T(353) T(354) T(355) T(356) T(357) T(358) T(359) T(360) T(361) T(362) T(363) T(364) T(365) T(366) T(367) \
62 T(368) T(369) T(370) T(371) T(372) T(373) T(374) T(375) T(376) T(377) T(378) T(379) T(380) T(381) T(382) T(383) \
63 T(384) T(385) T(386) T(387) T(388) T(389) T(390) T(391) T(392) T(393) T(394) T(395) T(396) T(397) T(398) T(399) \
64 T(400) T(401) T(402) T(403) T(404) T(405) T(406) T(407) T(408) T(409) T(410) T(411) T(412) T(413) T(414) T(415) \
65 T(416) T(417) T(418) T(419) T(420) T(421) T(422) T(423) T(424) T(425) T(426) T(427) T(428) T(429) T(430) T(431) \
66 T(432) T(433) T(434) T(435) T(436) T(437) T(438) T(439) T(440) T(441) T(442) T(443) T(444) T(445) T(446) T(447) \
67 T(448) T(449) T(450) T(451) T(452) T(453) T(454) T(455) T(456) T(457) T(458) T(459) T(460) T(461) T(462) T(463) \
68 T(464) T(465) T(466) T(467) T(468) T(469) T(470) T(471) T(472) T(473) T(474) T(475) T(476) T(477) T(478) T(479) \
69 T(480) T(481) T(482) T(483) T(484) T(485) T(486) T(487) T(488) T(489) T(490) T(491) T(492) T(493) T(494) T(495) \
70 T(496) T(497) T(498) T(499) T(500) T(501) T(502) T(503) T(504) T(505) T(506) T(507) T(508) T(509) T(510) T(511) \
71 T(512) T(513) T(514) T(515) T(516) T(517) T(518) T(519) T(520) T(521) T(522) T(523) T(524) T(525) T(526) T(527) \
72 T(528) T(529) T(530) T(531) T(532) T(533) T(534) T(535) T(536) T(537) T(538) T(539) T(540) T(541) T(542) T(543) \
73 T(544) T(545) T(546) T(547) T(548) T(549) T(550) T(551) T(552) T(553) T(554) T(555) T(556) T(557) T(558) T(559) \
74 T(560) T(561) T(562) T(563) T(564) T(565) T(566) T(567) T(568) T(569) T(570) T(571) T(572) T(573) T(574) T(575) \
75 T(576) T(577) T(578) T(579) T(580) T(581) T(582) T(583) T(584) T(585) T(586) T(587) T(588) T(589) T(590) T(591) \
76 T(592) T(593) T(594) T(595) T(596) T(597) T(598) T(599) T(600) T(601) T(602) T(603) T(604) T(605) T(606) T(607) \
77 T(608) T(609) T(610) T(611) T(612) T(613) T(614) T(615) T(616) T(617) T(618) T(619) T(620) T(621) T(622) T(623) \
78 T(624) T(625) T(626) T(627) T(628) T(629) T(630) T(631) T(632) T(633) T(634) T(635) T(636) T(637) T(638) T(639) \
79 T(640) T(641) T(642) T(643) T(644) T(645) T(646) T(647) T(648) T(649) T(650) T(651) T(652) T(653) T(654) T(655) \
80 T(656) T(657) T(658) T(659) T(660) T(661) T(662) T(663) T(664) T(665) T(666) T(667) T(668) T(669) T(670) T(671) \
81 T(672) T(673) T(674) T(675) T(676) T(677) T(678) T(679) T(680) T(681) T(682) T(683) T(684) T(685) T(686) T(687) \
82 T(688) T(689) T(690) T(691) T(692) T(693) T(694) T(695) T(696) T(697) T(698) T(699) T(700) T(701) T(702) T(703) \
83 T(704) T(705) T(706) T(707) T(708) T(709) T(710) T(711) T(712) T(713) T(714) T(715) T(716) T(717) T(718) T(719) \
84 T(720) T(721) T(722) T(723) T(724) T(725) T(726) T(727) T(728) T(729) T(730) T(731) T(732) T(733) T(734) T(735) \
85 T(736) T(737) T(738) T(739) T(740) T(741) T(742) T(743) T(744) T(745) T(746) T(747) T(748) T(749) T(750) T(751) \
86 T(752) T(753) T(754) T(755) T(756) T(757) T(758) T(759) T(760) T(761) T(762) T(763) T(764) T(765) T(766) T(767) \
87 T(768) T(769) T(770) T(771) T(772) T(773) T(774) T(775) T(776) T(777) T(778) T(779) T(780) T(781) T(782) T(783) \
88 T(784) T(785) T(786) T(787) T(788) T(789) T(790) T(791) T(792) T(793) T(794) T(795) T(796) T(797) T(798) T(799) \
89 T(800) T(801) T(802) T(803) T(804) T(805) T(806) T(807) T(808) T(809) T(810) T(811) T(812) T(813) T(814) T(815) \
90 T(816) T(817) T(818) T(819) T(820) T(821) T(822) T(823) T(824) T(825) T(826) T(827) T(828) T(829) T(830) T(831) \
91 T(832) T(833) T(834) T(835) T(836) T(837) T(838) T(839) T(840) T(841) T(842) T(843) T(844) T(845) T(846) T(847) \
92 T(848) T(849) T(850) T(851) T(852) T(853) T(854) T(855) T(856) T(857) T(858) T(859) T(860) T(861) T(862) T(863) \
93 T(864) T(865) T(866) T(867) T(868) T(869) T(870) T(871) T(872) T(873) T(874) T(875) T(876) T(877) T(878) T(879) \
94 T(880) T(881) T(882) T(883) T(884) T(885) T(886) T(887) T(888) T(889) T(890) T(891) T(892) T(893) T(894) T(895) \
95 T(896) T(897) T(898) T(899) T(900) T(901) T(902) T(903) T(904) T(905) T(906) T(907) T(908) T(909) T(910) T(911) \
96 T(912) T(913) T(914) T(915) T(916) T(917) T(918) T(919) T(920) T(921) T(922) T(923) T(924) T(925) T(926) T(927) \
97 T(928) T(929) T(930) T(931) T(932) T(933) T(934) T(935) T(936) T(937) T(938) T(939) T(940) T(941) T(942) T(943) \
98 T(944) T(945) T(946) T(947) T(948) T(949) T(950) T(951) T(952) T(953) T(954) T(955) T(956) T(957) T(958) T(959) \
99 T(960) T(961) T(962) T(963) T(964) T(965) T(966) T(967) T(968) T(969) T(970) T(971) T(972) T(973) T(974) T(975) \
100 T(976) T(977) T(978) T(979) T(980) T(981) T(982) T(983) T(984) T(985) T(986) T(987) T(988) T(989) T(990) T(991) \
101 T(992) T(993) T(994) T(995) T(996) T(997) T(998) T(999) T(1000) T(1001) T(1002) T(1003) T(1004) T(1005) T(1006) T(1007) \
102 T(1008) T(1009) T(1010) T(1011) T(1012) T(1013) T(1014) T(1015) T(1016) T(1017) T(1018) T(1019) T(1020) T(1021) T(1022) T(1023)
103
104#ifdef __i386__
105
106__ASM_GLOBAL_FUNC( call_stubless_func,
107 "movl 4(%esp),%ecx\n\t" /* This pointer */
108 "movl (%ecx),%ecx\n\t" /* This->lpVtbl */
109 "movl -8(%ecx),%ecx\n\t" /* MIDL_STUBLESS_PROXY_INFO */
110 "movl 8(%ecx),%edx\n\t" /* info->FormatStringOffset */
111 "movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */
112 "addl 4(%ecx),%edx\n\t" /* info->ProcFormatString + offset */
113 "movzbl 1(%edx),%eax\n\t" /* Oi_flags */
114 "andl $0x08,%eax\n\t" /* Oi_HAS_RPCFLAGS */
115 "shrl $1,%eax\n\t"
116 "movzwl 4(%edx,%eax),%eax\n\t" /* arguments size */
117 "pushl %eax\n\t"
118 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
119 "pushl $0\n\t" /* fpu_stack */
120 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
121 "leal 12(%esp),%eax\n\t" /* &This */
122 "pushl %eax\n\t"
123 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
124 "pushl %edx\n\t" /* format string */
125 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
126 "pushl (%ecx)\n\t" /* info->pStubDesc */
127 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
128 "call " __ASM_STDCALL("NdrpClientCall2",16) "\n\t"
129 __ASM_CFI(".cfi_adjust_cfa_offset -16\n\t")
130 "popl %edx\n\t" /* arguments size */
131 __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
132 "movl (%esp),%ecx\n\t" /* return address */
133 "addl %edx,%esp\n\t"
134 "jmp *%ecx" )
135
136#define T(num) \
137 ".balign 4\n\t" \
138 ".globl " __ASM_NAME("ObjectStublessClient" #num) "\n" \
139 __ASM_NAME("ObjectStublessClient" #num) ":\n\t" \
140 "movl $"#num",%eax\n\t" \
141 ".byte 0xe9\n\t" /* jmp */ \
142 ".long " __ASM_NAME("call_stubless_func") "-1f\n" \
143 "1:\n\t"
144
145#elif defined __x86_64__
146
147__ASM_GLOBAL_FUNC( call_stubless_func,
148 "subq $0x38,%rsp\n\t"
149 __ASM_SEH(".seh_stackalloc 0x38\n\t")
150 __ASM_SEH(".seh_endprologue\n\t")
151 __ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
152 "movq %rcx,0x40(%rsp)\n\t"
153 "movq %rdx,0x48(%rsp)\n\t"
154 "movq %r8,0x50(%rsp)\n\t"
155 "movq %r9,0x58(%rsp)\n\t"
156 "leaq 0x40(%rsp),%rdx\n\t" /* args */
157 "movq %xmm1,0x20(%rsp)\n\t"
158 "movq %xmm2,0x28(%rsp)\n\t"
159 "movq %xmm3,0x30(%rsp)\n\t"
160 "leaq 0x18(%rsp),%r8\n\t" /* fpu_regs */
161 "movl %r10d,%ecx\n\t" /* index */
162 "call " __ASM_NAME("ndr_stubless_client_call") "\n\t"
163 "addq $0x38,%rsp\n\t"
164 __ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t")
165 "ret" )
166
167#define T(num) \
168 ".balign 4\n\t" \
169 ".globl " __ASM_NAME("ObjectStublessClient" #num) "\n" \
170 __ASM_NAME("ObjectStublessClient" #num) ":\n\t" \
171 "movl $"#num",%r10d\n\t" \
172 ".byte 0xe9\n\t" /* jmp */ \
173 ".long " __ASM_NAME("call_stubless_func") "-1f\n" \
174 "1:\n\t"
175
176#elif defined __aarch64__
177
178__ASM_GLOBAL_FUNC( call_stubless_func,
179 "stp x29, x30, [sp, #-0x90]!\n\t"
180 ".seh_save_fplr_x 0x90\n\t"
181 "mov x29, sp\n\t"
182 ".seh_set_fp\n\t"
183 ".seh_endprologue\n\t"
184 "stp d0, d1, [sp, #0x10]\n\t"
185 "stp d2, d3, [sp, #0x20]\n\t"
186 "stp d4, d5, [sp, #0x30]\n\t"
187 "stp d6, d7, [sp, #0x40]\n\t"
188 "stp x0, x1, [sp, #0x50]\n\t"
189 "stp x2, x3, [sp, #0x60]\n\t"
190 "stp x4, x5, [sp, #0x70]\n\t"
191 "stp x6, x7, [sp, #0x80]\n\t"
192 "mov w0, w16\n\t" /* index */
193 "add x1, sp, #0x50\n\t" /* args */
194 "add x2, sp, #0x10\n\t" /* fpu_regs */
195 "bl ndr_stubless_client_call\n\t"
196 "ldp x29, x30, [sp], #0x90\n\t"
197 "ret" )
198
199#define T(num) \
200 ".globl ObjectStublessClient" #num "\n" \
201 "ObjectStublessClient" #num ":\n\t" \
202 "mov w16,#"#num"\n\t" \
203 "b call_stubless_func\n\t"
204
205#elif defined __arm__
206
207__ASM_GLOBAL_FUNC( call_stubless_func,
208 "push {r0-r3}\n\t"
209 ".seh_save_regs {r0-r3}\n\t"
210 "push {fp,lr}\n\t"
211 ".seh_save_regs_w {fp,lr}\n\t"
212 "mov fp, sp\n\t"
213 ".seh_save_sp fp\n\t"
214 ".seh_endprologue\n\t"
215 "mov r0, ip\n\t" /* index */
216 "add r1, sp, #8\n\t" /* args */
217 "vpush {s0-s15}\n\t" /* store the s0-s15/d0-d7 arguments */
218 "mov r2, sp\n\t" /* fpu_regs */
219 "bl ndr_stubless_client_call\n\t"
220 "mov sp, fp\n\t"
221 "pop {fp,lr}\n\t"
222 "add sp, #16\n\t"
223 "bx lr" )
224
225#define T(num) \
226 ".globl ObjectStublessClient" #num "\n" \
227 "ObjectStublessClient" #num ":\n\t" \
228 "ldr ip,1f\n\t" \
229 "b.w call_stubless_func\n" \
230 "1:\t.long "#num"\n\t"
231
232#endif /* __i386__ */
233
234__ASM_GLOBAL_FUNC( stubless_thunks, ALL_THUNK_ENTRIES )
235
236#undef T
237
238
239/* The idea here is to replace the first param on the stack
240 ie. This (which will point to cstdstubbuffer_delegating_t)
241 with This->stub_buffer.pvServerObject and then jump to the
242 relevant offset in This->stub_buffer.pvServerObject's vtbl.
243*/
244#ifdef __i386__
245
246#define T(num) \
247 ".balign 4\n\t" \
248 ".globl " __ASM_NAME("NdrProxyForwardingFunction" #num) "\n" \
249 __ASM_NAME("NdrProxyForwardingFunction" #num) ":\n\t" \
250 "mov 4(%esp),%eax\n\t" \
251 "mov 0x10(%eax),%eax\n\t" \
252 "mov %eax,4(%esp)\n\t" \
253 "mov (%eax),%eax\n\t" \
254 ".byte 0xff,0xa0\n\t" /* jmp *offset(%eax) */ \
255 ".long 4*"#num"\n\t"
256
257#elif defined __x86_64__
258
259#define T(num) \
260 ".balign 4\n\t" \
261 ".globl " __ASM_NAME("NdrProxyForwardingFunction" #num) "\n" \
262 __ASM_NAME("NdrProxyForwardingFunction" #num) ":\n\t" \
263 "movq 0x20(%rcx),%rcx\n\t" \
264 "movq (%rcx),%rax\n\t" \
265 ".byte 0xff,0xa0\n\t" /* jmp *offset(%rax) */ \
266 ".long 8*"#num"\n\t"
267
268#elif defined __aarch64__
269
270#define T(num) \
271 ".globl NdrProxyForwardingFunction" #num "\n" \
272 "NdrProxyForwardingFunction" #num ":\n\t" \
273 "ldr x0, [x0, #0x20]\n\t" \
274 "ldr x16, [x0]\n\t" \
275 "mov x17, #"#num"\n\t" \
276 "ldr x16, [x16, x17, lsl #3]\n\t" \
277 "br x16\n\t"
278
279#elif defined __arm__
280
281#define T(num) \
282 ".balign 4\n\t" \
283 ".globl NdrProxyForwardingFunction" #num "\n" \
284 "NdrProxyForwardingFunction" #num ":\n\t" \
285 "ldr r0, [r0, #0x10]\n\t" \
286 "ldr ip, [r0]\n\t" \
287 "ldr pc, [ip, #(4*"#num")]\n\t"
288
289#endif /* __i386__ */
290
292
293#undef T
294
296{
297 *ppv = pUnk;
298 return S_OK;
299}
300
302{
303 return 1;
304}
305
307{
308 return 1;
309}
310
311#define T(num) extern void NdrProxyForwardingFunction##num(void);
313#undef T
314
316{
318 {
319#define T(num) (void *)NdrProxyForwardingFunction##num,
321#undef T
322 }
323};
324
325
326#if defined(__aarch64__) || defined(__arm__)
327static void __attribute__((used)) args_stack_to_regs( void **args, void **regs, void **stack,
329{
330 const NDR_PROC_HEADER_EXTS *ext = (const NDR_PROC_HEADER_EXTS *)(header + 1);
331 unsigned int i, size, count, pos;
332 unsigned char *data;
333
334#ifdef __arm__
335 const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)((const char *)ext + ext->Size);
336
337 for (i = 0; i < header->number_of_params; i++)
338 if (params[i].attr.IsIn && params[i].attr.IsBasetype)
339 {
340 int *arg = (int *)((char *)args + params[i].stack_offset);
341
342 switch (params[i].u.type_format_char)
343 {
344 case FC_BYTE:
345 case FC_USMALL:
346 *arg = (unsigned char)*arg;
347 break;
348 case FC_CHAR:
349 case FC_SMALL:
350 *arg = (signed char)*arg;
351 break;
352 case FC_WCHAR:
353 case FC_USHORT:
354 *arg = (unsigned short)*arg;
355 break;
356 case FC_SHORT:
357 *arg = (short)*arg;
358 break;
359 }
360 }
361#endif
362
363 if (ext->Size < sizeof(*ext) + 3) return;
364 data = (unsigned char *)(ext + 1);
365 size = min( ext->Size - sizeof(*ext) - 3, data[2] );
366 data += 3;
367 for (i = pos = 0; i < size; i++, pos++)
368 {
369 if (data[i] < 0x80) continue;
370 else if (data[i] < 0x94) regs[data[i] - 0x80] = args[pos];
371 else if (data[i] == 0x9d) /* repeat */
372 {
373 if (i + 3 >= size) break;
374 count = data[i + 2] + (data[i + 3] << 8);
375 memcpy( &stack[pos + (signed char)data[i + 1]], &args[pos], count * sizeof(*args) );
376 pos += count - 1;
377 i += 3;
378 }
379 else if (data[i] < 0xa0) continue;
380 else stack[pos + (signed char)data[i]] = args[pos];
381 }
382}
383#endif
384
385
386/* Call a function with the specified arguments, restoring the stack
387 * properly afterwards as we don't know the calling convention of the
388 * function */
389#if defined __i386__ && defined _MSC_VER && defined __REACTOS__ // Wine has removed this :(
390__declspec(naked) LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned int stack_size,
392{
393 __asm
394 {
395 push ebp
396 mov ebp, esp
398 push esi
399 mov eax, [ebp+16] ; Get stack size
400 sub esp, eax ; Make room in stack for arguments
401 and esp, 0xFFFFFFF0
402 mov edi, esp
403 mov ecx, eax
404 mov esi, [ebp+12]
405 shr ecx, 2
406 cld
407 rep movsd ; Copy dword blocks
408 call [ebp+8] ; Call function
409 lea esp, [ebp-8] ; Restore stack
410 pop esi ; Restore registers
411 pop edi
412 pop ebp
413 ret
414 }
415}
416#elif defined __i386__ // remove above, replace here with #ifdef __i386__
418 "pushl %ebp\n\t"
419 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
420 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
421 "movl %esp,%ebp\n\t"
422 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
423 "pushl %edi\n\t" /* Save registers */
424 __ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
425 "pushl %esi\n\t"
426 __ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
427 "movl 16(%ebp), %eax\n\t" /* Get stack size */
428 "subl %eax, %esp\n\t" /* Make room in stack for arguments */
429 "andl $~15, %esp\n\t" /* Make sure stack has 16-byte alignment for Mac OS X */
430 "movl %esp, %edi\n\t"
431 "movl %eax, %ecx\n\t"
432 "movl 12(%ebp), %esi\n\t"
433 "shrl $2, %ecx\n\t" /* divide by 4 */
434 "cld\n\t"
435 "rep; movsl\n\t" /* Copy dword blocks */
436 "call *8(%ebp)\n\t" /* Call function */
437 "leal -8(%ebp), %esp\n\t" /* Restore stack */
438 "popl %esi\n\t" /* Restore registers */
439 __ASM_CFI(".cfi_same_value %esi\n\t")
440 "popl %edi\n\t"
441 __ASM_CFI(".cfi_same_value %edi\n\t")
442 "popl %ebp\n\t"
443 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
444 __ASM_CFI(".cfi_same_value %ebp\n\t")
445 "ret" )
446#elif defined __x86_64__
448 "pushq %rbp\n\t"
449 __ASM_SEH(".seh_pushreg %rbp\n\t")
450 __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
451 __ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
452 "movq %rsp,%rbp\n\t"
453 __ASM_SEH(".seh_setframe %rbp,0\n\t")
454 __ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
455 "pushq %rsi\n\t"
456 __ASM_SEH(".seh_pushreg %rsi\n\t")
457 __ASM_CFI(".cfi_rel_offset %rsi,-8\n\t")
458 "pushq %rdi\n\t"
459 __ASM_SEH(".seh_pushreg %rdi\n\t")
460 __ASM_SEH(".seh_endprologue\n\t")
461 __ASM_CFI(".cfi_rel_offset %rdi,-16\n\t")
462 "movq %rcx,%rax\n\t" /* function to call */
463 "movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */
464 "cmpq %rcx,%r8\n\t"
465 "cmovgq %r8,%rcx\n\t"
466 "subq %rcx,%rsp\n\t"
467 "andq $~15,%rsp\n\t"
468 "movq %r8,%rcx\n\t"
469 "shrq $3,%rcx\n\t"
470 "movq %rsp,%rdi\n\t"
471 "movq %rdx,%rsi\n\t"
472 "rep; movsq\n\t" /* copy arguments */
473 "movq 0(%rsp),%rcx\n\t"
474 "movq 8(%rsp),%rdx\n\t"
475 "movq 16(%rsp),%r8\n\t"
476 "movq 24(%rsp),%r9\n\t"
477 "movq 0(%rsp),%xmm0\n\t"
478 "movq 8(%rsp),%xmm1\n\t"
479 "movq 16(%rsp),%xmm2\n\t"
480 "movq 24(%rsp),%xmm3\n\t"
481 "callq *%rax\n\t"
482 "leaq -16(%rbp),%rsp\n\t" /* restore stack */
483 "popq %rdi\n\t"
484 __ASM_CFI(".cfi_same_value %rdi\n\t")
485 "popq %rsi\n\t"
486 __ASM_CFI(".cfi_same_value %rsi\n\t")
487 __ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
488 "popq %rbp\n\t"
489 __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
490 __ASM_CFI(".cfi_same_value %rbp\n\t")
491 "ret" )
492#elif defined __arm__
494 "push {r4,r5,fp,lr}\n\t"
495 ".seh_save_regs_w {r4,r5,fp,lr}\n\t"
496 "mov fp, sp\n\t"
497 ".seh_save_sp fp\n\t"
498 ".seh_endprologue\n\t"
499 "add r2, r2, #20*4+8+4\n\t"
500 "and r2, r2, #~7\n\t"
501 "sub sp, sp, r2\n\t"
502 "mov r4, r0\n\t" /* func */
503 "mov r0, r1\n\t" /* args */
504 "add r1, sp, #8\n\t" /* regs */
505 "add r2, r1, #20*4\n\t" /* stack */
506 "bl args_stack_to_regs\n\t"
507 "add sp, sp, #8\n\t"
508 "pop {r0-r3}\n\t"
509 "vpop {s0-s15}\n\t"
510 "blx r4\n\t"
511 "mov sp, fp\n\t"
512 "pop {r4,r5,fp,pc}" )
513#elif defined __aarch64__
515 "stp x29, x30, [sp, #-0x20]!\n\t"
516 ".seh_save_fplr_x 0x20\n\t"
517 "stp x19, x20, [sp, #0x10]\n\t"
518 ".seh_save_regp x19, 0x10\n\t"
519 "mov x29, sp\n\t"
520 ".seh_set_fp\n\t"
521 ".seh_endprologue\n\t"
522 "add x9, x2, #16*8+15\n\t"
523 "lsr x9, x9, #4\n\t"
524 "sub sp, sp, x9, lsl #4\n\t"
525 "mov x19, x0\n\t" /* func */
526 "mov x0, x1\n\t" /* args */
527 "mov x1, sp\n\t" /* regs */
528 "add x2, sp, #16*8\n\t" /* stack */
529 "bl args_stack_to_regs\n\t"
530 "ldp x2, x3, [sp, #0x10]\n\t"
531 "ldp x4, x5, [sp, #0x20]\n\t"
532 "ldp x6, x7, [sp, #0x30]\n\t"
533 "ldp d0, d1, [sp, #0x40]\n\t"
534 "ldp d2, d3, [sp, #0x50]\n\t"
535 "ldp d4, d5, [sp, #0x60]\n\t"
536 "ldp d6, d7, [sp, #0x70]\n\t"
537 "ldp x0, x1, [sp], #0x80\n\t"
538 "blr x19\n\t"
539 "mov sp, x29\n\t"
540 "ldp x19, x20, [sp, #0x10]\n\t"
541 "ldp x29, x30, [sp], #0x20\n\t"
542 "ret" )
543#endif
#define __cdecl
Definition: accygwin.h:79
static int used
Definition: adh-main.c:39
#define __attribute__(x)
Definition: wpp_private.h:207
static const WCHAR *const ext[]
Definition: module.c:53
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:126
unsigned char
Definition: typeof.h:29
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
return ret
Definition: mutex.c:146
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition: free_base.cpp:98
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum func
Definition: glext.h:6028
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLfloat * params
Definition: glext.h:5645
GLuint in
Definition: glext.h:9616
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
int registers[NUMREGS]
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
static int blocks
Definition: mkdosfs.c:527
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LPINTERNAL_BSTR Get(const BSTR lpszString)
Definition: vartype.c:4895
#define __ASM_NAME(name)
Definition: config.h:934
#define __ASM_GLOBAL_FUNC(name, code)
Definition: port.h:201
#define min(a, b)
Definition: monoChain.cc:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char *args, unsigned int stack_size, const NDR_PROC_PARTIAL_OIF_HEADER *header)
#define REFIID
Definition: guiddef.h:118
@ FC_USMALL
Definition: ndrtypes.h:138
@ FC_SMALL
Definition: ndrtypes.h:137
@ FC_USHORT
Definition: ndrtypes.h:141
@ FC_CHAR
Definition: ndrtypes.h:136
@ FC_BYTE
Definition: ndrtypes.h:135
@ FC_SHORT
Definition: ndrtypes.h:140
@ FC_WCHAR
Definition: ndrtypes.h:139
LONG(__RPC_API * SERVER_ROUTINE)(void)
Definition: rpcndr.h:444
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
Definition: thunks.c:295
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
Definition: thunks.c:306
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
Definition: thunks.c:301
#define ALL_THUNK_ENTRIES
Definition: thunks.c:38
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
Definition: match.c:390
Definition: cookie.c:202
Definition: format.c:80
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw edi esi edx edi
Definition: synth_sse3d.h:185
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
Definition: synth_sse3d.h:85
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw edi esi edx esi movl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm1 paddd mm5 psrad mm1 psrad mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi subl esi addl edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm1 psrad mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:266
uint32_t ULONG
Definition: typedefs.h:59
static int Save(const char **args)
Definition: vfdcmd.c:1851
#define WINAPI
Definition: msvc.h:6
#define __ASM_CFI(str)
Definition: asm.h:39
#define __ASM_SEH(str)
Definition: asm.h:45
#define __ASM_STDCALL(name, args)
Definition: asm.h:33