comparison dyncallback/dyncall_callback_x64.S @ 165:572aff021627

- file name/layout cleanup, removed "-att" from x64 .S filenames, as unnecessary and also misleading - some "I'm bored"-whitespace-cleanup
author cslag
date Thu, 05 Jan 2017 10:35:12 +0100
parents 3e629dc19168
children d5705f226298
comparison
equal deleted inserted replaced
164:2d330a60c44f 165:572aff021627
22 22
23 */ 23 */
24 24
25 25
26 26
27 #include "../portasm/portasm-x64-att.S" 27 #include "../portasm/portasm-x64.S"
28 28
29 /* structure sizes */ 29 /* structure sizes */
30 30
31 SET(DCThunk_size,24) 31 SET(DCThunk_size,24)
32 SET(DCArgs_size_win64,80) 32 SET(DCArgs_size_win64,80)
56 #define ASCII_f 102 56 #define ASCII_f 102
57 #define ASCII_d 100 57 #define ASCII_d 100
58 58
59 GLOBAL(dcCallback_x64_sysv) 59 GLOBAL(dcCallback_x64_sysv)
60 BEGIN_PROC(dcCallback_x64_sysv) 60 BEGIN_PROC(dcCallback_x64_sysv)
61 61
62 PUSH(RBP) 62 PUSH(RBP)
63 MOV(RSP,RBP) 63 MOV(RSP,RBP)
64 64
65 /* initialize DCArgs */ 65 /* initialize DCArgs */
66 66
67 /* float parameters (8 registers spill to DCArgs) */ 67 /* float parameters (8 registers spill to DCArgs) */
68 68
69 SUB(LIT(8*8),RSP) 69 SUB(LIT(8*8),RSP)
70 70
71 MOVSD(XMM7, QWORD(RSP,8*7)) /* struct offset 120: float parameter 7 */ 71 MOVSD(XMM7, QWORD(RSP,8*7)) /* struct offset 120: float parameter 7 */
72 MOVSD(XMM6, QWORD(RSP,8*6)) /* struct offset 112: float parameter 6 */ 72 MOVSD(XMM6, QWORD(RSP,8*6)) /* struct offset 112: float parameter 6 */
73 MOVSD(XMM5, QWORD(RSP,8*5)) /* struct offset 104: float parameter 5 */ 73 MOVSD(XMM5, QWORD(RSP,8*5)) /* struct offset 104: float parameter 5 */
74 MOVSD(XMM4, QWORD(RSP,8*4)) /* struct offset 96: float parameter 4 */ 74 MOVSD(XMM4, QWORD(RSP,8*4)) /* struct offset 96: float parameter 4 */
93 93
94 LEA(QWORD(RBP,FRAME_arg0_sysv),RDX) /* struct offset 0: stack pointer */ 94 LEA(QWORD(RBP,FRAME_arg0_sysv),RDX) /* struct offset 0: stack pointer */
95 PUSH(RDX) 95 PUSH(RDX)
96 96
97 MOV(RSP,RSI) /* arg 1 RSI : DCArgs* */ 97 MOV(RSP,RSI) /* arg 1 RSI : DCArgs* */
98 98
99 /* initialize DCValue */ 99 /* initialize DCValue */
100 100
101 PUSH(LIT(0)) /* struct offset 0: return value (max long long) */ 101 PUSH(LIT(0)) /* struct offset 0: return value (max long long) */
102 102
103 /* call handler( *ctx, *args, *value, *userdata) */ 103 /* call handler( *ctx, *args, *value, *userdata) */
119 119
120 END_PROC(dcCallback_x64_sysv) 120 END_PROC(dcCallback_x64_sysv)
121 121
122 GLOBAL(dcCallback_x64_win64) 122 GLOBAL(dcCallback_x64_win64)
123 BEGIN_PROC(dcCallback_x64_win64) 123 BEGIN_PROC(dcCallback_x64_win64)
124 124
125 PUSH(RBP) 125 PUSH(RBP)
126 MOV(RSP,RBP) 126 MOV(RSP,RBP)
127 127
128 /* initialize DCArgs */ 128 /* initialize DCArgs */
129 129
130 /* float parameters (4 registers spill to DCArgs) */ 130 /* float parameters (4 registers spill to DCArgs) */
131 131
132 SUB(LIT(4*8),RSP) 132 SUB(LIT(4*8),RSP)
133 133
134 MOVSD(XMM3, QWORD(RSP,8*3)) /* struct offset 72: float parameter 3 */ 134 MOVSD(XMM3, QWORD(RSP,8*3)) /* struct offset 72: float parameter 3 */
135 MOVSD(XMM2, QWORD(RSP,8*2)) /* struct offset 64: float parameter 2 */ 135 MOVSD(XMM2, QWORD(RSP,8*2)) /* struct offset 64: float parameter 2 */
136 MOVSD(XMM1, QWORD(RSP,8*1)) /* struct offset 56: float parameter 1 */ 136 MOVSD(XMM1, QWORD(RSP,8*1)) /* struct offset 56: float parameter 1 */
137 MOVSD(XMM0, QWORD(RSP,8*0)) /* struct offset 48: float parameter 0 */ 137 MOVSD(XMM0, QWORD(RSP,8*0)) /* struct offset 48: float parameter 0 */
172 172
173 MOV(RBP,RSP) 173 MOV(RBP,RSP)
174 POP(RBP) 174 POP(RBP)
175 RET() 175 RET()
176 176
177 END_PROC(dcCallback_x64_win64) 177 END_PROC(dcCallback_x64_win64)
178 178
179 END_ASM 179 END_ASM
180 180