sourcepawn/jit/x86/opcode_helpers.cpp
changeset 241 5444b56b5ba6
parent 238 43c7cb6914a8
child 350 1e4e30f7d6ca
     1.1 --- a/sourcepawn/jit/x86/opcode_helpers.cpp	Mon Jan 01 01:09:53 2007 +0000
     1.2 +++ b/sourcepawn/jit/x86/opcode_helpers.cpp	Mon Jan 01 03:23:57 2007 +0000
     1.3 @@ -127,24 +127,26 @@
     1.4  
     1.5  void Write_BreakDebug(JitWriter *jit)
     1.6  {
     1.7 -	//push ecx
     1.8 +	//push edi
     1.9 +	//mov edi, ecx
    1.10  	//mov ecx, [esi+ctx]
    1.11  	//cmp [ecx+dbreak], 0
    1.12  	//jnz :nocall
    1.13 -	IA32_Push_Reg(jit, AMX_REG_TMP);
    1.14 +	IA32_Push_Reg(jit, REG_EDI);
    1.15 +	IA32_Mov_Reg_Rm(jit, REG_EDI, REG_ECX, MOD_REG);
    1.16  	IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_INFO, AMX_INFO_CONTEXT);
    1.17  	IA32_Cmp_Rm_Disp8_Imm8(jit, AMX_REG_TMP, offsetof(sp_context_t, dbreak), 0);
    1.18 -	jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_NZ, 0);
    1.19 +	jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_Z, 0);
    1.20  
    1.21 +	/* NOTE, Hack! PUSHAD pushes EDI last which still has the CIP */
    1.22  	//pushad
    1.23 -	IA32_Pushad(jit);
    1.24 -
    1.25  	//push [esi+frm]
    1.26  	//push ctx
    1.27  	//mov ecx, [ecx+dbreak]
    1.28  	//call ecx
    1.29  	//add esp, 8
    1.30  	//popad
    1.31 +	IA32_Pushad(jit);
    1.32  	IA32_Push_Rm_Disp8(jit, AMX_REG_INFO, AMX_INFO_FRAME); //:TODO: move to regs and push? and dont disp for 0
    1.33  	IA32_Push_Reg(jit, AMX_REG_TMP);
    1.34  	IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_TMP, offsetof(sp_context_t, dbreak));
    1.35 @@ -153,8 +155,10 @@
    1.36  	IA32_Popad(jit);
    1.37  
    1.38  	//:nocall
    1.39 +	//pop edi
    1.40 +	//ret
    1.41 +	IA32_Pop_Reg(jit, REG_EDI);
    1.42  	IA32_Send_Jump8_Here(jit, jmp);
    1.43 -	IA32_Add_Rm_Imm8(jit, REG_ESP, 4*1, MOD_REG);
    1.44  	IA32_Return(jit);
    1.45  }
    1.46