Commit 0eb91425f355be19939507d4d4d056bdad12c9dd

Anthony Green 2022-08-31T20:46:24

Change comment style

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
diff --git a/src/x86/sysv_intel.S b/src/x86/sysv_intel.S
index 3cafd71..c47d4dd 100644
--- a/src/x86/sysv_intel.S
+++ b/src/x86/sysv_intel.S
@@ -1,9 +1,9 @@
 /* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 2017  Anthony Green
+   sysv.S - Copyright (c) 2017, 2022  Anthony Green
           - Copyright (c) 2013  The Written Word, Inc.
           - Copyright (c) 1996,1998,2001-2003,2005,2008,2010  Red Hat, Inc.
-   
-   X86 Foreign Function Interface 
+
+   X86 Foreign Function Interface
 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
@@ -29,11 +29,11 @@
 #ifndef __x86_64__
 #ifdef _MSC_VER
 
-#define LIBFFI_ASM	
+#define LIBFFI_ASM
 #include <fficonfig.h>
 #include <ffi.h>
 #include <ffi_cfi.h>
-#include "internal.h" 
+#include "internal.h"
 
 #define C2(X, Y)  X ## Y
 #define C1(X, Y)  C2(X, Y)
@@ -89,8 +89,8 @@ L(UW0):
 	   perspective of the unwind info, it hasn't moved.  */
 	mov 	ebp, ecx
 L(UW1):
-	// cfi_def_cfa(%ebp, 8)
-	// cfi_rel_offset(%ebp, 0)
+	/* cfi_def_cfa(%ebp, 8) */
+	/* cfi_rel_offset(%ebp, 0) */
 
 	mov 	esp, edx		/* set outgoing argument stack */
 	mov 	eax, [20+R_EAX*4+ebp]	/* set register arguments */
@@ -102,7 +102,7 @@ L(UW1):
 	mov	    ecx, [12+ebp]		/* load return type code */
 	mov 	[ebp+8], ebx		/* preserve %ebx */
 L(UW2):
-	// cfi_rel_offset(%ebx, 8)
+	/* cfi_rel_offset(%ebx, 8) */
 
 	and 	ecx, X86_RET_TYPE_MASK
 	lea 	ebx, [L(store_table) + ecx * 8]
@@ -148,13 +148,13 @@ L(e1):
 	mov	    esp, ebp
 	pop 	ebp
 L(UW3):
-	// cfi_remember_state
-	// cfi_def_cfa(%esp, 4)
-	// cfi_restore(%ebx)
-	// cfi_restore(%ebp)
+	/* cfi_remember_state */
+	/* cfi_def_cfa(%esp, 4) */
+	/* cfi_restore(%ebx) */
+	/* cfi_restore(%ebp) */
 	ret
 L(UW4):
-	// cfi_restore_state
+	/* cfi_restore_state */
 
 E(L(store_table), X86_RET_STRUCTPOP)
 	jmp	    L(e1)
@@ -174,7 +174,7 @@ E(L(store_table), X86_RET_UNUSED15)
 	int 3
 
 L(UW5):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(@ffi_call_i386@8)
 
 /* The inner helper is declared as
@@ -242,10 +242,10 @@ ALIGN 16
 PUBLIC ffi_go_closure_EAX
 ffi_go_closure_EAX PROC C
 L(UW6):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub	esp, closure_FS
 L(UW7):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 	FFI_CLOSURE_SAVE_REGS
 	mov     edx, [eax+4]			/* copy cif */
 	mov 	ecx, [eax +8]			/* copy fun */
@@ -254,17 +254,17 @@ L(UW7):
 	mov 	[esp+closure_CF+36], eax	/* closure is user_data */
 	jmp	L(do_closure_i386)
 L(UW8):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_go_closure_EAX)
 
 ALIGN 16
 PUBLIC ffi_go_closure_ECX
 ffi_go_closure_ECX PROC C
 L(UW9):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub 	esp, closure_FS
 L(UW10):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 	FFI_CLOSURE_SAVE_REGS
 	mov 	edx, [ecx+4]			/* copy cif */
 	mov 	eax, [ecx+8]			/* copy fun */
@@ -273,7 +273,7 @@ L(UW10):
 	mov 	[esp+closure_CF+36], ecx	/* closure is user_data */
 	jmp	L(do_closure_i386)
 L(UW11):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_go_closure_ECX)
 
 /* The closure entry points are reached from the ffi_closure trampoline.
@@ -283,10 +283,10 @@ ALIGN 16
 PUBLIC ffi_closure_i386
 ffi_closure_i386 PROC C
 L(UW12):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub	    esp, closure_FS
 L(UW13):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 
 	FFI_CLOSURE_SAVE_REGS
 	FFI_CLOSURE_COPY_TRAMP_DATA
@@ -331,17 +331,17 @@ E(L(load_table2), X86_RET_VOID)
 L(e2):
 	add 	esp, closure_FS
 L(UW16):
-	// cfi_adjust_cfa_offset(-closure_FS)
+	/* cfi_adjust_cfa_offset(-closure_FS) */
 	ret
 L(UW17):
-	// cfi_adjust_cfa_offset(closure_FS)
+	/* cfi_adjust_cfa_offset(closure_FS) */
 E(L(load_table2), X86_RET_STRUCTPOP)
 	add 	esp, closure_FS
 L(UW18):
-	// cfi_adjust_cfa_offset(-closure_FS)
+	/* cfi_adjust_cfa_offset(-closure_FS) */
 	ret	4
 L(UW19):
-	// cfi_adjust_cfa_offset(closure_FS)
+	/* cfi_adjust_cfa_offset(closure_FS) */
 E(L(load_table2), X86_RET_STRUCTARG)
 	jmp	L(e2)
 E(L(load_table2), X86_RET_STRUCT_1B)
@@ -358,17 +358,17 @@ E(L(load_table2), X86_RET_UNUSED15)
 	int 3
 
 L(UW20):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_closure_i386)
 
 ALIGN 16
 PUBLIC	ffi_go_closure_STDCALL
 ffi_go_closure_STDCALL PROC C
 L(UW21):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub 	esp, closure_FS
 L(UW22):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 	FFI_CLOSURE_SAVE_REGS
 	mov 	edx, [ecx+4]			/* copy cif */
 	mov 	eax, [ecx+8]			/* copy fun */
@@ -377,7 +377,7 @@ L(UW22):
 	mov 	[esp+closure_CF+36], ecx	/* closure is user_data */
 	jmp	L(do_closure_STDCALL)
 L(UW23):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_go_closure_STDCALL)
 
 /* For REGISTER, we have no available parameter registers, and so we
@@ -387,19 +387,19 @@ ALIGN 16
 PUBLIC ffi_closure_REGISTER
 ffi_closure_REGISTER PROC C
 L(UW24):
-	// cfi_startproc
-	// cfi_def_cfa(%esp, 8)
-	// cfi_offset(%eip, -8)
+	/* cfi_startproc */
+	/* cfi_def_cfa(%esp, 8) */
+	/* cfi_offset(%eip, -8) */
 	sub 	esp, closure_FS-4
 L(UW25):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 	FFI_CLOSURE_SAVE_REGS
 	mov	ecx, [esp+closure_FS-4] 	/* load retaddr */
 	mov	eax, [esp+closure_FS]		/* load closure */
 	mov	[esp+closure_FS], ecx		/* move retaddr */
 	jmp	L(do_closure_REGISTER)
 L(UW26):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_closure_REGISTER)
 
 /* For STDCALL (and others), we need to pop N bytes of arguments off
@@ -410,10 +410,10 @@ ALIGN 16
 PUBLIC ffi_closure_STDCALL
 ffi_closure_STDCALL PROC C
 L(UW27):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub 	esp, closure_FS
 L(UW28):
-	// cfi_def_cfa_offset(closure_FS + 4)
+	/* cfi_def_cfa_offset(closure_FS + 4) */
 
 	FFI_CLOSURE_SAVE_REGS
 
@@ -504,7 +504,7 @@ E(L(load_table3), X86_RET_UNUSED15)
 	int 3
 
 L(UW31):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_closure_STDCALL)
 
 #if !FFI_NO_RAW_API
@@ -515,13 +515,13 @@ ALIGN 16
 PUBLIC ffi_closure_raw_SYSV
 ffi_closure_raw_SYSV PROC C
 L(UW32):
-	// cfi_startproc
+	/* cfi_startproc */
 	sub 	esp, raw_closure_S_FS
 L(UW33):
-	// cfi_def_cfa_offset(raw_closure_S_FS + 4)
+	/* cfi_def_cfa_offset(raw_closure_S_FS + 4) */
 	mov 	[esp+raw_closure_S_FS-4], ebx
 L(UW34):
-	// cfi_rel_offset(%ebx, raw_closure_S_FS-4)
+	/* cfi_rel_offset(%ebx, raw_closure_S_FS-4) */
 
 	mov 	edx, [eax+FFI_TRAMPOLINE_SIZE+8]	/* load cl->user_data */
 	mov 	[esp+12], edx
@@ -535,16 +535,16 @@ L(UW34):
 
 	mov 	eax, [ebx+20]			/* load cif->flags */
 	and 	eax, X86_RET_TYPE_MASK
-// #ifdef __PIC__
-// 	call	__x86.get_pc_thunk.bx
-// L(pc4):
-// 	lea 	ecx, L(load_table4)-L(pc4)(%ebx, %eax, 8), %ecx
-// #else
+/* #ifdef __PIC__ */
+/* 	call	__x86.get_pc_thunk.bx */
+/* L(pc4): */
+/* 	lea 	ecx, L(load_table4)-L(pc4)(%ebx, %eax, 8), %ecx */
+/* #else */
 	lea 	ecx, [L(load_table4)+eax+8]
-// #endif
+/* #endif */
 	mov 	ebx, [esp+raw_closure_S_FS-4]
 L(UW35):
-	// cfi_restore(%ebx)
+	/* cfi_restore(%ebx) */
 	mov 	eax, [esp+16]				/* Optimistic load */
 	jmp	    dword ptr [ecx]
 
@@ -581,17 +581,17 @@ E(L(load_table4), X86_RET_VOID)
 L(e4):
 	add 	esp, raw_closure_S_FS
 L(UW36):
-	// cfi_adjust_cfa_offset(-raw_closure_S_FS)
+	/* cfi_adjust_cfa_offset(-raw_closure_S_FS) */
 	ret
 L(UW37):
-	// cfi_adjust_cfa_offset(raw_closure_S_FS)
+	/* cfi_adjust_cfa_offset(raw_closure_S_FS) */
 E(L(load_table4), X86_RET_STRUCTPOP)
 	add 	esp, raw_closure_S_FS
 L(UW38):
-	// cfi_adjust_cfa_offset(-raw_closure_S_FS)
+	/* cfi_adjust_cfa_offset(-raw_closure_S_FS) */
 	ret	4
 L(UW39):
-	// cfi_adjust_cfa_offset(raw_closure_S_FS)
+	/* cfi_adjust_cfa_offset(raw_closure_S_FS) */
 E(L(load_table4), X86_RET_STRUCTARG)
 	jmp	L(e4)
 E(L(load_table4), X86_RET_STRUCT_1B)
@@ -608,7 +608,7 @@ E(L(load_table4), X86_RET_UNUSED15)
 	int 3
 
 L(UW40):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_closure_raw_SYSV)
 
 #define raw_closure_T_FS	(16+16+8)
@@ -617,26 +617,26 @@ ALIGN 16
 PUBLIC ffi_closure_raw_THISCALL
 ffi_closure_raw_THISCALL PROC C
 L(UW41):
-	// cfi_startproc
+	/* cfi_startproc */
 	/* Rearrange the stack such that %ecx is the first argument.
 	   This means moving the return address.  */
 	pop 	edx
 L(UW42):
-	// cfi_def_cfa_offset(0)
-	// cfi_register(%eip, %edx)
+	/* cfi_def_cfa_offset(0) */
+	/* cfi_register(%eip, %edx) */
 	push	ecx
 L(UW43):
-	// cfi_adjust_cfa_offset(4)
+	/* cfi_adjust_cfa_offset(4) */
 	push 	edx
 L(UW44):
-	// cfi_adjust_cfa_offset(4)
-	// cfi_rel_offset(%eip, 0)
+	/* cfi_adjust_cfa_offset(4) */
+	/* cfi_rel_offset(%eip, 0) */
 	sub 	esp, raw_closure_T_FS
 L(UW45):
-	// cfi_adjust_cfa_offset(raw_closure_T_FS)
+	/* cfi_adjust_cfa_offset(raw_closure_T_FS) */
 	mov 	[esp+raw_closure_T_FS-4], ebx
 L(UW46):
-	// cfi_rel_offset(%ebx, raw_closure_T_FS-4)
+	/* cfi_rel_offset(%ebx, raw_closure_T_FS-4) */
 
 	mov 	edx, [eax+FFI_TRAMPOLINE_SIZE+8]	/* load cl->user_data */
 	mov 	[esp+12], edx
@@ -650,16 +650,16 @@ L(UW46):
 
 	mov 	eax, [ebx+20]				/* load cif->flags */
 	and 	eax, X86_RET_TYPE_MASK
-// #ifdef __PIC__
-// 	call	__x86.get_pc_thunk.bx
-// L(pc5):
-// 	leal	L(load_table5)-L(pc5)(%ebx, %eax, 8), %ecx
-// #else
+/* #ifdef __PIC__ */
+/* 	call	__x86.get_pc_thunk.bx */
+/* L(pc5): */
+/* 	leal	L(load_table5)-L(pc5)(%ebx, %eax, 8), %ecx */
+/* #else */
 	lea 	ecx, [L(load_table5)+eax*8]
-//#endif
+/*#endif */
 	mov 	ebx, [esp+raw_closure_T_FS-4]
 L(UW47):
-	// cfi_restore(%ebx)
+	/* cfi_restore(%ebx) */
 	mov 	eax, [esp+16]				/* Optimistic load */
 	jmp	    DWORD PTR [ecx]
 
@@ -696,18 +696,18 @@ E(L(load_table5), X86_RET_VOID)
 L(e5):
 	add 	esp, raw_closure_T_FS
 L(UW48):
-	// cfi_adjust_cfa_offset(-raw_closure_T_FS)
+	/* cfi_adjust_cfa_offset(-raw_closure_T_FS) */
 	/* Remove the extra %ecx argument we pushed.  */
 	ret	4
 L(UW49):
-	// cfi_adjust_cfa_offset(raw_closure_T_FS)
+	/* cfi_adjust_cfa_offset(raw_closure_T_FS) */
 E(L(load_table5), X86_RET_STRUCTPOP)
 	add 	esp, raw_closure_T_FS
 L(UW50):
-	// cfi_adjust_cfa_offset(-raw_closure_T_FS)
+	/* cfi_adjust_cfa_offset(-raw_closure_T_FS) */
 	ret	8
 L(UW51):
-	// cfi_adjust_cfa_offset(raw_closure_T_FS)
+	/* cfi_adjust_cfa_offset(raw_closure_T_FS) */
 E(L(load_table5), X86_RET_STRUCTARG)
 	jmp	L(e5)
 E(L(load_table5), X86_RET_STRUCT_1B)
@@ -724,7 +724,7 @@ E(L(load_table5), X86_RET_UNUSED15)
 	int 3
 
 L(UW52):
-	// cfi_endproc
+	/* cfi_endproc */
 ENDF(ffi_closure_raw_THISCALL)
 
 #endif /* !FFI_NO_RAW_API */
@@ -743,20 +743,20 @@ ENDF(ffi_closure_raw_THISCALL)
 # define COMDAT(X)
 #endif
 
-// #if defined(__PIC__)
-// 	COMDAT(C(__x86.get_pc_thunk.bx))
-// C(__x86.get_pc_thunk.bx):
-// 	movl	(%esp), %ebx
-// 	ret
-// ENDF(C(__x86.get_pc_thunk.bx))
-// # if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
-// 	COMDAT(C(__x86.get_pc_thunk.dx))
-// C(__x86.get_pc_thunk.dx):
-// 	movl	(%esp), %edx
-// 	ret
-// ENDF(C(__x86.get_pc_thunk.dx))
-// #endif /* DARWIN || HIDDEN */
-// #endif /* __PIC__ */
+/* #if defined(__PIC__) */
+/* 	COMDAT(C(__x86.get_pc_thunk.bx)) */
+/* C(__x86.get_pc_thunk.bx): */
+/* 	movl	(%esp), %ebx */
+/* 	ret */
+/* ENDF(C(__x86.get_pc_thunk.bx)) */
+/* # if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE */
+/* 	COMDAT(C(__x86.get_pc_thunk.dx)) */
+/* C(__x86.get_pc_thunk.dx): */
+/* 	movl	(%esp), %edx */
+/* 	ret */
+/* ENDF(C(__x86.get_pc_thunk.dx)) */
+/* #endif /* DARWIN || HIDDEN */ */
+/* #endif /* __PIC__ */ */
 
 #if 0
 /* Sadly, OSX cctools-as doesn't understand .cfi directives at all.  */
@@ -992,4 +992,4 @@ L(EFDE9):
 #endif
 #endif
 
-END
\ No newline at end of file
+END