From 1c9088beca341765f5260a1ae6f3289b494d4eb8 Mon Sep 17 00:00:00 2001 From: pcpa Date: Mon, 3 Dec 2012 14:27:27 -0200 Subject: Update code to build and pass test cases in the arm port. * configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct implementation of the arm backend port to build and pass the current test cases. Tested on armv7 with softfp abi. * lib/jit_disasm.c: Rename and change prototype of static disassemble function as in the arm backend it is required to access state information stored in the jit_state_t object. * check/3to2.tst, check/add.tst: Correct test case code assuming JIT_RO and JIT_RET are the same, and even if they are the same, the logic was incorrect because it must always call jit_retval* to fetch a function call return before any other instruction. The arm backend hash a special condition if jit_retval is not called, because "r0" is not JIT_R0, but is JIT_RET and *also* the first argument for a called function, so JIT_RET must be only used as an argument to jit_retval. * TODO: New file listing important tasks to be resolved. --- lib/jit_disasm.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'lib/jit_disasm.c') diff --git a/lib/jit_disasm.c b/lib/jit_disasm.c index 625419b..c0a5079 100644 --- a/lib/jit_disasm.c +++ b/lib/jit_disasm.c @@ -29,8 +29,9 @@ disasm_compare_symbols(const void *ap, const void *bp); static void disasm_print_address(bfd_vma addr, struct disassemble_info *info); +#define disassemble(u, v) _disassemble(_jit, u, v) static void -disassemble(jit_pointer_t code, jit_int32_t length); +_disassemble(jit_state_t *_jit, jit_pointer_t code, jit_int32_t length); #endif /* @@ -238,19 +239,20 @@ disasm_print_address(bfd_vma addr, struct disassemble_info *info) } static void -disassemble(jit_pointer_t code, jit_int32_t length) +_disassemble(jit_state_t *_jit, jit_pointer_t code, jit_int32_t length) { - int bytes; + int bytes; #if __arm__ - jit_data_info_t *data_info; - jit_int32_t data_offset; + jit_int32_t offset; + jit_bool_t data_info; + jit_int32_t data_offset; #endif - bfd_vma pc = (jit_uword_t)code; - bfd_vma end = (jit_uword_t)code + length; - char buffer[address_buffer_length]; + bfd_vma pc = (jit_uword_t)code; + bfd_vma end = (jit_uword_t)code + length; + char buffer[address_buffer_length]; #if __arm__ - data_info = _jit->data_info; + data_info = 1; data_offset = 0; #endif disasm_info.buffer = code; @@ -260,16 +262,16 @@ disassemble(jit_pointer_t code, jit_int32_t length) #if __arm__ again: if (data_info) { - while (data_info.ptr[data_offset].code < pc) { + while (_jit->data_info.ptr[data_offset].code < pc) { data_offset += 2; - if (data_offset>= data_info.length) { - data_info = NULL; + if (data_offset>= _jit->data_info.length) { + data_info = 0; goto again; } } - if (pc == data_info.ptr[data_offset].code) { - line = data_info.ptr[data_offset].length; - for (; line>= 4; line -= 4, pc += 4) { + if (pc == _jit->data_info.ptr[data_offset].code) { + offset = _jit->data_info.ptr[data_offset].length; + for (; offset>= 4; offset -= 4, pc += 4) { bytes = sprintf(buffer, address_buffer_format, pc); (*disasm_info.fprintf_func)(disasm_stream, "%*c0x%s\t.data\t0x%08x\n", -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /