diff --git a/framework/source/chip_jit_instructions.c b/framework/source/chip_jit_instructions.c index cbff4b963dc2fe4f47102df090e44d0a743e1242..6c5129a33a2f0c4c5e8475eca2745a4231151cdf 100644 --- a/framework/source/chip_jit_instructions.c +++ b/framework/source/chip_jit_instructions.c @@ -639,7 +639,7 @@ static inline void emit_ret_block_ptr(uint8_t** top, cpssp_t* cpssp, uint16_t pc void * next_ptr = jit_get_block_ptr(cpssp->jit, pc_position); if (next_ptr != NULL) { emit_mov_ir(top, QWORD, RAX, (uint64_t)next_ptr); - printf("direct call to %#x \n", pc_position* 2); + DEBUG("direct call to %#x \n", pc_position* 2); } else { emit_mov_ir(top, QWORD, RAX, (uint64_t)NULL); diff --git a/framework/source/chip_jit_logic.c b/framework/source/chip_jit_logic.c index 9593936aef4c7605aa9b3f05687119dfeabab4b1..3ecba6a77f469ef69ef400be5c76f4bffb83a058 100644 --- a/framework/source/chip_jit_logic.c +++ b/framework/source/chip_jit_logic.c @@ -692,13 +692,6 @@ static inline bool emit_instruction(uint8_t **top, uint16_t instruction, cpssp_t emit_mov_ir(top, WORD, RSI, addr); emit_call(top, &jmp); emit_ret_block_ptr(top, cpssp, addr); - // void * next_ptr = jit_get_block_ptr(cpssp->jit, addr); - // if (next_ptr != NULL) { - // printf("direct call to %#x \n", addr* 2); - // assert(0); - // emit_call_c(top, cpssp, &chip_handle_signals); - // emit_call(top, next_ptr); - // } return true; // postion in instructions,these are 2 bytes wide // uint16_t pos = flash_pop_w(cpssp); @@ -720,8 +713,7 @@ static inline bool emit_instruction(uint8_t **top, uint16_t instruction, cpssp_t emit_mov_ir(top, QWORD, RDI, (uint64_t)cpssp); emit_mov_ir(top, WORD, RSI, addr); emit_call(top, &call); - emit_mov_ir(top, QWORD, RAX, (uint64_t)NULL); - + emit_ret_block_ptr(top, cpssp, addr); return true; // postion in instructions, these are 2 bytes wide // jump to target address @@ -1220,8 +1212,7 @@ static inline bool emit_instruction(uint8_t **top, uint16_t instruction, cpssp_t emit_set_pc(top, cpssp, RBX, *instr_ptr); // do actual jump emit_call_c_c(top, cpssp, offset, &rjmp); - emit_mov_ir(top, QWORD, RAX, (uint64_t)NULL); - //rjmp(cpssp, offset); + emit_ret_block_ptr(top, cpssp, (uint16_t)(*instr_ptr + offset)); return true; break; } @@ -1232,9 +1223,9 @@ static inline bool emit_instruction(uint8_t **top, uint16_t instruction, cpssp_t emit_set_pc(top, cpssp, RBX, *instr_ptr); // do actual call emit_call_c_c(top, cpssp, offset, &rcall); - //rcall(cpssp, offset); - emit_mov_ir(top, QWORD, RAX, (uint64_t)NULL); + emit_ret_block_ptr(top, cpssp, (uint16_t)(*instr_ptr + offset)); return true; + //rcall(cpssp, offset); break; } case 14: {