Wanted: A better way to implement MIPS unaligned instructions
Hello All,
I am currently trying to implement TCG versions of the MIPS [ls][dw][lr] set of instructions. I believe I can't use a helper function for load/store type instructions. The appended patch uses TCG directly, but the resulting translation is excessively complicated. Is there a better way to do this?
Thiemo
target-mips/op.c +0 -35
@@ -30,41 +30,6 @@#ifndef CALL_FROM_TB1 #define CALL_FROM_TB1 (func, arg0) func(arg0)#endif -#ifndef CALL_FROM_TB1_CONST16 -#define CALL_FROM_TB1_CONST16 (func, arg0) CALL_FROM_TB1(func, arg0) -#endif -#ifndef CALL_FROM_TB2 -#define CALL_FROM_TB2 (func, arg0, arg1) func(arg0, arg1) -#endif -#ifndef CALL_FROM_TB2_CONST16 -#define CALL_FROM_TB2_CONST16 (func, arg0, arg1) \ - CALL_FROM_TB2(func, arg0, arg1) -#endif -#ifndef CALL_FROM_TB3 -#define CALL_FROM_TB3 (func, arg0, arg1, arg2) func(arg0, arg1, arg2) -#endif -#ifndef CALL_FROM_TB4 -#define CALL_FROM_TB4 (func, arg0, arg1, arg2, arg3) \ - func(arg0, arg1, arg2, arg3) -#endif - -/* Load and store */ -#define MEMSUFFIX _raw -#include "op_mem.c" -#undef MEMSUFFIX -#if !defined(CONFIG_USER_ONLY ) -#define MEMSUFFIX _user -#include "op_mem.c" -#undef MEMSUFFIX - -#define MEMSUFFIX _super -#include "op_mem.c" -#undef MEMSUFFIX - -#define MEMSUFFIX _kernel -#include "op_mem.c" -#undef MEMSUFFIX -#endif /* 64 bits arithmetic */ #if TARGET_LONG_BITS >HOST_LONG_BITS
target-mips/op_mem.c deleted +0 -269
269 lines not on this page · raw message
target-mips/translate.c +489 -40
580 lines not on this page · raw message
exec-all.h +1 -1
@@ -30,7 +30,7 @@struct TranslationBlock ;/* XXX: make safe guess about sizes */ -#define MAX_OP_PER_INSTR 64 +#define MAX_OP_PER_INSTR 256/* A Call op needs up to 6 + 2N parameters (N = number of arguments). */ #define MAX_OPC_PARAM 10#define OPC_BUF_SIZE 512
Quoted 7 lines · Thiemo Seufer
Hello All,
I am currently trying to implement TCG versions of the MIPS [ls][dw][lr] set of instructions. I believe I can't use a helper function for load/store type instructions. The appended patch uses TCG directly, but the resulting translation is excessively complicated. Is there a better way to do this?
A simpler solution is to use the same code as before in an helper. Helpers are perfectly usable in this case provided the cpu state is saved before calling them.
When the helper solution will work, it will be possible to optimize it by directly accessing the QEMU TLB cache to do word accesses and to generate the correct exception.
Fabrice.