diff options
Diffstat (limited to 'src/vm_x86.dasc')
-rw-r--r-- | src/vm_x86.dasc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index 58266196..f31e595b 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc | |||
@@ -222,6 +222,9 @@ | |||
222 | |.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--). | 222 | |.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--). |
223 | |.macro saveregs_ | 223 | |.macro saveregs_ |
224 | | push rbx; push r15; push r14 | 224 | | push rbx; push r15; push r14 |
225 | |.if NO_UNWIND | ||
226 | | push r13; push r12 | ||
227 | |.endif | ||
225 | | sub rsp, CFRAME_SPACE | 228 | | sub rsp, CFRAME_SPACE |
226 | |.endmacro | 229 | |.endmacro |
227 | |.macro saveregs | 230 | |.macro saveregs |
@@ -229,15 +232,28 @@ | |||
229 | |.endmacro | 232 | |.endmacro |
230 | |.macro restoreregs | 233 | |.macro restoreregs |
231 | | add rsp, CFRAME_SPACE | 234 | | add rsp, CFRAME_SPACE |
235 | |.if NO_UNWIND | ||
236 | | pop r12; pop r13 | ||
237 | |.endif | ||
232 | | pop r14; pop r15; pop rbx; pop rbp | 238 | | pop r14; pop r15; pop rbx; pop rbp |
233 | |.endmacro | 239 | |.endmacro |
234 | | | 240 | | |
235 | |//----- 16 byte aligned, | 241 | |//----- 16 byte aligned, |
242 | |.if NO_UNWIND | ||
243 | |.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter. | ||
244 | |.define SAVE_R4, aword [rsp+aword*10] | ||
245 | |.define SAVE_R3, aword [rsp+aword*9] | ||
246 | |.define SAVE_R2, aword [rsp+aword*8] | ||
247 | |.define SAVE_R1, aword [rsp+aword*7] | ||
248 | |.define SAVE_RU2, aword [rsp+aword*6] | ||
249 | |.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves. | ||
250 | |.else | ||
236 | |.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter. | 251 | |.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter. |
237 | |.define SAVE_R4, aword [rsp+aword*8] | 252 | |.define SAVE_R4, aword [rsp+aword*8] |
238 | |.define SAVE_R3, aword [rsp+aword*7] | 253 | |.define SAVE_R3, aword [rsp+aword*7] |
239 | |.define SAVE_R2, aword [rsp+aword*6] | 254 | |.define SAVE_R2, aword [rsp+aword*6] |
240 | |.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves. | 255 | |.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves. |
256 | |.endif | ||
241 | |.define SAVE_CFRAME, aword [rsp+aword*4] | 257 | |.define SAVE_CFRAME, aword [rsp+aword*4] |
242 | |.define SAVE_PC, dword [rsp+dword*7] | 258 | |.define SAVE_PC, dword [rsp+dword*7] |
243 | |.define SAVE_L, dword [rsp+dword*6] | 259 | |.define SAVE_L, dword [rsp+dword*6] |
@@ -5422,6 +5438,10 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
5422 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ | 5438 | "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ |
5423 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ | 5439 | "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ |
5424 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ | 5440 | "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ |
5441 | #if LJ_NO_UNWIND | ||
5442 | "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */ | ||
5443 | "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */ | ||
5444 | #endif | ||
5425 | #else | 5445 | #else |
5426 | "\t.long .Lbegin\n" | 5446 | "\t.long .Lbegin\n" |
5427 | "\t.long %d\n" | 5447 | "\t.long %d\n" |
@@ -5457,6 +5477,7 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
5457 | "\t.align " SZPTR "\n" | 5477 | "\t.align " SZPTR "\n" |
5458 | ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); | 5478 | ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); |
5459 | #endif | 5479 | #endif |
5480 | #if !LJ_NO_UNWIND | ||
5460 | #if (defined(__sun__) && defined(__svr4__)) | 5481 | #if (defined(__sun__) && defined(__svr4__)) |
5461 | #if LJ_64 | 5482 | #if LJ_64 |
5462 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n"); | 5483 | fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n"); |
@@ -5545,7 +5566,9 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
5545 | "\t.align " SZPTR "\n" | 5566 | "\t.align " SZPTR "\n" |
5546 | ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); | 5567 | ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); |
5547 | #endif | 5568 | #endif |
5569 | #endif | ||
5548 | break; | 5570 | break; |
5571 | #if !LJ_NO_UNWIND | ||
5549 | /* Mental note: never let Apple design an assembler. | 5572 | /* Mental note: never let Apple design an assembler. |
5550 | ** Or a linker. Or a plastic case. But I digress. | 5573 | ** Or a linker. Or a plastic case. But I digress. |
5551 | */ | 5574 | */ |
@@ -5679,6 +5702,7 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
5679 | fprintf(ctx->fp, ".subsections_via_symbols\n"); | 5702 | fprintf(ctx->fp, ".subsections_via_symbols\n"); |
5680 | } | 5703 | } |
5681 | break; | 5704 | break; |
5705 | #endif | ||
5682 | default: /* Difficult for other modes. */ | 5706 | default: /* Difficult for other modes. */ |
5683 | break; | 5707 | break; |
5684 | } | 5708 | } |