aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r--src/buildvm_x86.dasc30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index b9dddd1f..f19ecbc0 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -213,18 +213,16 @@
213| 213|
214|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--). 214|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
215|.macro saveregs 215|.macro saveregs
216| push rbp; push rbx; push r15; push r14; push r13; push r12 216| push rbp; push rbx; push r15; push r14
217| sub rsp, CFRAME_SPACE 217| sub rsp, CFRAME_SPACE
218|.endmacro 218|.endmacro
219|.macro restoreregs 219|.macro restoreregs
220| add rsp, CFRAME_SPACE 220| add rsp, CFRAME_SPACE
221| pop r12; pop r13; pop r14; pop r15; pop rbx; pop rbp 221| pop r14; pop r15; pop rbx; pop rbp
222|.endmacro 222|.endmacro
223| 223|
224|//----- 16 byte aligned, 224|//----- 16 byte aligned,
225|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter. 225|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
226|.define SAVE_R6, aword [rsp+aword*10]
227|.define SAVE_R5, aword [rsp+aword*9]
228|.define SAVE_R4, aword [rsp+aword*8] 226|.define SAVE_R4, aword [rsp+aword*8]
229|.define SAVE_R3, aword [rsp+aword*7] 227|.define SAVE_R3, aword [rsp+aword*7]
230|.define SAVE_R2, aword [rsp+aword*6] 228|.define SAVE_R2, aword [rsp+aword*6]
@@ -621,10 +619,10 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
621 | mov eax, CARG2d // Error return status for vm_pcall. 619 | mov eax, CARG2d // Error return status for vm_pcall.
622 | mov rsp, CARG1 620 | mov rsp, CARG1
623 |.else 621 |.else
624 | mov ecx, [esp+4] 622 | mov eax, FCARG2 // Error return status for vm_pcall.
625 | mov eax, [esp+8] // Error return status for vm_pcall. 623 | mov esp, FCARG1
626 | mov esp, ecx
627 |.endif 624 |.endif
625 |->vm_unwind_c_eh: // Landing pad for external unwinder.
628 | mov L:RB, SAVE_L 626 | mov L:RB, SAVE_L
629 | mov GL:RB, L:RB->glref 627 | mov GL:RB, L:RB->glref
630 | mov dword GL:RB->vmstate, ~LJ_VMST_C 628 | mov dword GL:RB->vmstate, ~LJ_VMST_C
@@ -636,10 +634,10 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
636 | and CARG1, CFRAME_RAWMASK 634 | and CARG1, CFRAME_RAWMASK
637 | mov rsp, CARG1 635 | mov rsp, CARG1
638 |.else 636 |.else
639 | mov ecx, [esp+4] 637 | and FCARG1, CFRAME_RAWMASK
640 | and ecx, CFRAME_RAWMASK 638 | mov esp, FCARG1
641 | mov esp, ecx
642 |.endif 639 |.endif
640 |->vm_unwind_ff_eh: // Landing pad for external unwinder.
643 | mov L:RB, SAVE_L 641 | mov L:RB, SAVE_L
644 | mov RAa, -8 // Results start at BASE+RA = BASE-8. 642 | mov RAa, -8 // Results start at BASE+RA = BASE-8.
645 | mov RD, 1+1 // Really 1+2 results, incr. later. 643 | mov RD, 1+1 // Really 1+2 results, incr. later.
@@ -718,7 +716,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
718 | mov L:RB, SAVE_L 716 | mov L:RB, SAVE_L
719 | mov RA, INARG_BASE // Caveat: overlaps SAVE_CFRAME! 717 | mov RA, INARG_BASE // Caveat: overlaps SAVE_CFRAME!
720 |.endif 718 |.endif
721 | mov PC, FRAME_C 719 | mov PC, FRAME_CP
722 | xor RD, RD 720 | xor RD, RD
723 | lea KBASEa, [esp+CFRAME_RESUME] 721 | lea KBASEa, [esp+CFRAME_RESUME]
724 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table. 722 | mov DISPATCH, L:RB->glref // Setup pointer to dispatch table.
@@ -4689,7 +4687,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
4689 | movsd FOR_IDX, xmm0 4687 | movsd FOR_IDX, xmm0
4690 | test RB, RB; js >3 4688 | test RB, RB; js >3
4691 } else { 4689 } else {
4692 | jl >3 4690 | jl >3
4693 } 4691 }
4694 | ucomisd xmm1, xmm0 4692 | ucomisd xmm1, xmm0
4695 |1: 4693 |1:
@@ -4876,8 +4874,6 @@ static void emit_asm_debug(BuildCtx *ctx)
4876 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 4874 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4877 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 4875 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4878 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 4876 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4879 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4880 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4881#else 4877#else
4882 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 4878 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
4883 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 4879 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
@@ -4919,8 +4915,6 @@ static void emit_asm_debug(BuildCtx *ctx)
4919 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 4915 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4920 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 4916 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4921 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 4917 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4922 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4923 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4924#else 4918#else
4925 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 4919 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
4926 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 4920 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
@@ -4971,8 +4965,6 @@ static void emit_asm_debug(BuildCtx *ctx)
4971 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 4965 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4972 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 4966 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4973 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 4967 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4974 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4975 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4976#else 4968#else
4977 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 4969 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
4978 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 4970 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */