Skip to content

Commit 02aa98d

Browse files
committed
CHB:ARM:fix isindex and update cmds
1 parent 60ec1ff commit 02aa98d

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

CodeHawk/CHB/bchlibarm32/bCHARMOperand.ml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -458,18 +458,21 @@ object (self:'a)
458458
TR.tprop
459459
(floc#env#mk_global_variable dw#to_numerical)
460460
(__FILE__ ^ ":" ^ (string_of_int __LINE__))
461-
| ARMOffsetAddress (r, align, offset, isadd, _iswback, _isindex, size) ->
461+
| ARMOffsetAddress (r, align, offset, isadd, _iswback, isindex, size) ->
462462
(match offset with
463463
| ARMImmOffset _ ->
464464
let rvar = env#mk_arm_register_variable r in
465465
let numoffset_r =
466-
match (offset, isadd) with
467-
| (ARMImmOffset i, true) -> Ok (mkNumerical i)
468-
| (ARMImmOffset i, false) -> Ok (mkNumerical i)#neg
469-
| _ ->
470-
Error [__FILE__ ^ ":" ^ (string_of_int __LINE__) ^ ": "
471-
^ "Immediate offset not yet implemented for offset "
472-
^ (arm_memory_offset_to_string offset)] in
466+
if isindex then
467+
match (offset, isadd) with
468+
| (ARMImmOffset i, true) -> Ok (mkNumerical i)
469+
| (ARMImmOffset i, false) -> Ok (mkNumerical i)#neg
470+
| _ ->
471+
Error [__FILE__ ^ ":" ^ (string_of_int __LINE__) ^ ": "
472+
^ "Immediate offset not yet implemented for offset "
473+
^ (arm_memory_offset_to_string offset)]
474+
else
475+
Ok numerical_zero in
473476
TR.tbind
474477
~msg:(__FILE__ ^ ":" ^ (string_of_int __LINE__))
475478
(fun memoff ->
@@ -1131,22 +1134,22 @@ let arm_sp_deref ?(with_offset=0) (mode:arm_operand_mode_t) =
11311134
if with_offset >= 0 then
11321135
let offset = ARMImmOffset with_offset in
11331136
mk_arm_offset_address_op
1134-
ARSP offset ~isadd:true ~iswback:false ~isindex:false mode
1137+
ARSP offset ~isadd:true ~iswback:false ~isindex:true mode
11351138
else
11361139
let offset = ARMImmOffset (-with_offset) in
11371140
mk_arm_offset_address_op
1138-
ARSP offset ~isadd:false ~iswback:false ~isindex:false mode
1141+
ARSP offset ~isadd:false ~iswback:false ~isindex:true mode
11391142

11401143

11411144
let arm_reg_deref ?(with_offset=0) (reg: arm_reg_t) (mode:arm_operand_mode_t) =
11421145
if with_offset >= 0 then
11431146
let offset = ARMImmOffset with_offset in
11441147
mk_arm_offset_address_op
1145-
reg offset ~isadd:true ~iswback:false ~isindex:false mode
1148+
reg offset ~isadd:true ~iswback:false ~isindex:true mode
11461149
else
11471150
let offset = ARMImmOffset (-with_offset) in
11481151
mk_arm_offset_address_op
1149-
reg offset ~isadd:false ~iswback:false ~isindex:false mode
1152+
reg offset ~isadd:false ~iswback:false ~isindex:true mode
11501153

11511154

11521155
let equal_register_lists (op1: arm_operand_int) (op2: arm_operand_int): bool =

CodeHawk/CHB/bchlibarm32/bCHARMOperand.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
66
7-
Copyright (c) 2021-2024 Aarno Labs, LLC
7+
Copyright (c) 2021-2025 Aarno Labs, LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
1010
of this software and associated documentation files (the "Software"), to deal

CodeHawk/CHB/bchlibarm32/bCHTranslateARMToCHIF.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
66
7-
Copyright (c) 2021-2024 Aarno Labs LLC
7+
Copyright (c) 2021-2025 Aarno Labs LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
1010
of this software and associated documentation files (the "Software"), to deal
@@ -1751,7 +1751,7 @@ let translate_arm_instruction
17511751
~use:usevars
17521752
~usehigh:usehigh
17531753
ctxtiaddr in
1754-
let cmds = defcmds @ cmds @ updatecmds in
1754+
let cmds = defcmds @ cmds in
17551755
(match c with
17561756
| ACCAlways -> default cmds
17571757
| _ -> make_conditional_commands c cmds)

CodeHawk/CHB/bchlibarm32/bCHTranslateARMToCHIF.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
66
7-
Copyright (c) 2021-2024 Aarno Labs LLC
7+
Copyright (c) 2021-2025 Aarno Labs LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
1010
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)