sourcepawn/vm/jit/x86/opcode_helpers.cpp
changeset 86 c7e9bbc9ab44
parent 85 3d72f3c86730
child 87 06e62d38fb55
     1.1 --- a/sourcepawn/vm/jit/x86/opcode_helpers.cpp	Thu Sep 21 02:58:59 2006 +0000
     1.2 +++ b/sourcepawn/vm/jit/x86/opcode_helpers.cpp	Thu Sep 21 05:04:51 2006 +0000
     1.3 @@ -85,7 +85,7 @@
     1.4  
     1.5  	/* by now, everything is set up, so we can call into the plugin */
     1.6  	//call ecx
     1.7 -	IA32_Call_Rm(jit, REG_ECX);
     1.8 +	IA32_Call_Reg(jit, REG_ECX);
     1.9  
    1.10  	/* if the code flow gets to here, there was a normal return */
    1.11  	//mov ebp, [esi+8]		- get retval pointer
    1.12 @@ -133,6 +133,39 @@
    1.13  	return offs_return;
    1.14  }
    1.15  
    1.16 +void Write_BreakDebug(JitWriter *jit)
    1.17 +{
    1.18 +	//push ecx
    1.19 +	//mov ecx, [esi+ctx]
    1.20 +	//cmp [ecx+dbreak], 0
    1.21 +	//jnz :nocall
    1.22 +	IA32_Push_Reg(jit, AMX_REG_TMP);
    1.23 +	IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_INFO, AMX_INFO_CONTEXT);
    1.24 +	IA32_Cmp_Rm_Imm32_Disp8(jit, AMX_REG_TMP, offsetof(sp_context_t, dbreak), 0);
    1.25 +	jitoffs_t jmp = IA32_Jump_Cond_Imm8(jit, CC_NZ, 0);
    1.26 +
    1.27 +	//pushad
    1.28 +	IA32_Pushad(jit);
    1.29 +
    1.30 +	//push [esi+frm]
    1.31 +	//push [ecx+context]
    1.32 +	//mov ecx, [ecx+dbreak]
    1.33 +	//call ecx
    1.34 +	//add esp, 8
    1.35 +	//popad
    1.36 +	IA32_Push_Rm_Disp8(jit, AMX_REG_INFO, AMX_INFO_FRAME);
    1.37 +	IA32_Push_Rm_Disp8(jit, AMX_REG_TMP, offsetof(sp_context_t, context));
    1.38 +	IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_TMP, AMX_REG_TMP, offsetof(sp_context_t, dbreak));
    1.39 +	IA32_Call_Reg(jit, AMX_REG_TMP);
    1.40 +	IA32_Add_Rm_Imm8(jit, REG_ESP, 4*2, MOD_REG);
    1.41 +	IA32_Popad(jit);
    1.42 +
    1.43 +	//:nocall
    1.44 +	IA32_Send_Jump8_Here(jit, jmp);
    1.45 +	IA32_Add_Rm_Imm8(jit, REG_ESP, 4*1, MOD_REG);
    1.46 +	IA32_Return(jit);
    1.47 +}
    1.48 +
    1.49  void Write_Error(JitWriter *jit, int error)
    1.50  {
    1.51  	CompData *data = (CompData *)jit->data;