fix ARMv7 data processing instructions
PATCH 1/1 fix ARMv7 data processing instructions
This is a revised version of the "fix ARMv7 MOV R15, xxx operation" patch I sent here last Friday. This patch should fix the behavior of all affected commands as far as I know. I put the patch as an attachment here as well in case the formatting gets abused in transit.
---
target-arm/op_helper.c +1 -1
@@ -307,7 +307,7 @@ void HELPER(set_user_reg)(uint32_t regno, uint32_t val)uint32_t HELPER (add_cc )(uint32_t a,uint32_t b) {uint32_t result; - result =T0 +T1 ; + result = a + b; env->NF = env->ZF = result; env->CF = result < a; env->VF = (a ^ b ^-1 ) & (a ^ result);
target-arm/translate.c +82 -59
251 lines not on this page · raw message
Any further comments? Or perhaps import the patch? I made a small performance optimization in the new store_reg_bx macro by performing the simpler comparison first and the the little bit more expensive comparison only if the first comparison is true. At least I have encountered no problems in OMAP2 and OMAP3 emulation so far; instead the guest code which doesn't run without the patch in OMAP3 now works.
Juha
Quoted 4 lines · Riihimaki Juha (Nokia-D/Helsinki)
This is a revised version of the "fix ARMv7 MOV R15, xxx operation" patch I sent here last Friday. This patch should fix the behavior of all affected commands as far as I know. I put the patch as an attachment here as well in case the formatting gets abused in transit.
Quoted 6 lines · Juha Riihimäki
Any further comments? Or perhaps import the patch? I made a small performance optimization in the new
store_reg_bxmacro by performing the simpler comparison first and the the little bit more expensive comparison only if the first comparison is true. At least I have encountered no problems in OMAP2 and OMAP3 emulation so far; instead the guest code which doesn't run without the patch in OMAP3 now works.
I didn't take a close look at your patch, so I only have a cosmetic comment :) Wouldn't it be better to use a static inline function instead of a macro for store_reg_bx? At least I find it better looking and should not degrade performance.
Laurent
Quoted 9 lines · ext Laurent Desnogues
Quoted 6 lines · Juha Riihimäki
Any further comments? Or perhaps import the patch? I made a small performance optimization in the new
store_reg_bxmacro by performing the simpler comparison first and the the little bit more expensive comparison only if the first comparison is true. At least I have encountered no problems in OMAP2 and OMAP3 emulation so far; instead the guest code which doesn't run without the patch in OMAP3 now works.
Quoted 4 lines
I didn't take a close look at your patch, so I only have a cosmetic comment :) Wouldn't it be better to use a static inline function instead of a macro for
store_reg_bx? At least I find it better looking and should not degrade performance.
The reason I used a macro was because the ENABLE_ARCH_7 macro would not work unless one extra parameter is added to the function to pass the "env" pointer. But that is also possible if you think it is better.
Juha
Quoted 1 line · Juha Riihimäki
Any further comments? Or perhaps import the patch?
It looks like you've got several changes all mixed together, including bugfixes, cleanups and new features. Please divide into logically separate patches.
Paul
Quoted 6 lines · ext Paul Brook
Quoted 1 line · Juha Riihimäki
Any further comments? Or perhaps import the patch?
It looks like you've got several changes all mixed together, including bugfixes, cleanups and new features. Please divide into logically separate patches.
Yes, there are three logical parts, I have separated them here and included as separate attachments that can be applied separately in the numerical order:
i) A bug fix patch (diff1) which makes the add_cc helper function use its parameters instead of the temporary variables. This is required for the other patches to work properly. This bug was also reported by Torbjörn Andersson on this list couple of days ago.
ii) A patch (diff2) to get rid of global temporary variable usage cpu_T[x] in the ARM data processing instructions. I suppose this is valid since the cpu_T[x] variables are tagged with a "FIXME: These should be removed" comment in the beginning of the file. In order to accomplish this I introduced a new function, gen_add_carry, to replace the existing gen_adc_T0_T1 usage. I also modified the behavior of an existing function, gen_exception_return, which was only used within the ARM data processing instructions handling so the change had no effect on other code.
iii) A patch (diff3) to add support for the ARMv7 behavior in the ARM data processing instructions when destination register is R15.
Is this better?
Juha
cover fix ARMv7 data processing instructions
Time passes... if there are no further comments I'd very much like to see this patch set integrated to avoid having to maintain delta code for an obvious defect fix. Since the helper function was already corrected in svn commit 7034, only the other two patches are relevant today. In order to avoid writing new code that uses deprecated methods and/or variables, this fix has been divided into two parts: the first patch modernizes relevant parts of target-arm/translate.c and the second patch provides the actual defect fix and should be applied after the first patch. For this version of the patch set I have also converted the new macro store_reg_bx into a static function as suggested by Laurent Desnogues earlier.
Juha
Quoted 39 lines · Juha Riihimäki
Quoted 7 lines · ext Paul Brook
Quoted 1 line · Juha Riihimäki
Any further comments? Or perhaps import the patch?
It looks like you've got several changes all mixed together, including bugfixes, cleanups and new features. Please divide into logically separate
patches.Yes, there are three logical parts, I have separated them here and included as separate attachments that can be applied separately in the numerical order:
i) A bug fix patch (diff1) which makes the
add_cchelper function use its parameters instead of the temporary variables. This is required for the other patches to work properly. This bug was also reported by Torbjörn Andersson on this list couple of days ago.ii) A patch (diff2) to get rid of global temporary variable usage cpu_T[x] in the ARM data processing instructions. I suppose this is valid since the cpu_T[x] variables are tagged with a "FIXME: These should be removed" comment in the beginning of the file. In order to accomplish this I introduced a new function,
gen_add_carry, to replace the existinggen_adc_T0_T1usage. I also modified the behavior of an existing function,gen_exception_return, which was only used within the ARM data processing instructions handling so the change had no effect on other code.iii) A patch (diff3) to add support for the ARMv7 behavior in the ARM data processing instructions when destination register is R15.
Is this better?
Juha
<diff1><diff2><diff3>