@@ -3033,6 +3033,119 @@ bool DebuggerController::ComputeExprValue(const LowLevelILInstruction &instr, in
3033
3033
value &= sizeMask;
3034
3034
return true ;
3035
3035
}
3036
+ case LLIL_MUL:
3037
+ {
3038
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_MUL>(), left))
3039
+ return false ;
3040
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_MUL>(), right))
3041
+ return false ;
3042
+ value = left * right;
3043
+ value &= sizeMask;
3044
+ return true ;
3045
+ }
3046
+ case LLIL_MULU_HI:
3047
+ {
3048
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_MULU_HI>(), left))
3049
+ return false ;
3050
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_MULU_HI>(), right))
3051
+ return false ;
3052
+ auto result = left * right;
3053
+ value = result >> (instr.size * 8 );
3054
+ value &= sizeMask;
3055
+ return true ;
3056
+ }
3057
+ case LLIL_MULS_HI:
3058
+ {
3059
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_MULS_HI>(), left))
3060
+ return false ;
3061
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_MULS_HI>(), right))
3062
+ return false ;
3063
+ // Sign extend operands for signed multiplication
3064
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3065
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3066
+ auto result = leftSigned * rightSigned;
3067
+ value = result >> (instr.size * 8 );
3068
+ value &= sizeMask;
3069
+ return true ;
3070
+ }
3071
+ case LLIL_DIVU:
3072
+ {
3073
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_DIVU>(), left))
3074
+ return false ;
3075
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_DIVU>(), right))
3076
+ return false ;
3077
+ if (right == 0 )
3078
+ return false ; // Division by zero
3079
+ value = left / right;
3080
+ value &= sizeMask;
3081
+ return true ;
3082
+ }
3083
+ case LLIL_DIVS:
3084
+ {
3085
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_DIVS>(), left))
3086
+ return false ;
3087
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_DIVS>(), right))
3088
+ return false ;
3089
+ if (right == 0 )
3090
+ return false ; // Division by zero
3091
+ // Sign extend operands for signed division
3092
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3093
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3094
+ auto result = leftSigned / rightSigned;
3095
+ value = result & sizeMask;
3096
+ return true ;
3097
+ }
3098
+ case LLIL_MODU:
3099
+ {
3100
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_MODU>(), left))
3101
+ return false ;
3102
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_MODU>(), right))
3103
+ return false ;
3104
+ if (right == 0 )
3105
+ return false ; // Division by zero
3106
+ value = left % right;
3107
+ value &= sizeMask;
3108
+ return true ;
3109
+ }
3110
+ case LLIL_MODS:
3111
+ {
3112
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_MODS>(), left))
3113
+ return false ;
3114
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_MODS>(), right))
3115
+ return false ;
3116
+ if (right == 0 )
3117
+ return false ; // Division by zero
3118
+ // Sign extend operands for signed modulo
3119
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3120
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3121
+ auto result = leftSigned % rightSigned;
3122
+ value = result & sizeMask;
3123
+ return true ;
3124
+ }
3125
+ case LLIL_ROL:
3126
+ {
3127
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_ROL>(), left))
3128
+ return false ;
3129
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_ROL>(), right))
3130
+ return false ;
3131
+ auto shift = GetActualShift (right, instr.size );
3132
+ auto bits = instr.size * 8 ;
3133
+ shift %= bits; // Normalize rotation amount
3134
+ value = ((left << shift) | (left >> (bits - shift))) & sizeMask;
3135
+ return true ;
3136
+ }
3137
+ case LLIL_ROR:
3138
+ {
3139
+ if (!ComputeExprValue (instr.GetLeftExpr <LLIL_ROR>(), left))
3140
+ return false ;
3141
+ if (!ComputeExprValue (instr.GetRightExpr <LLIL_ROR>(), right))
3142
+ return false ;
3143
+ auto shift = GetActualShift (right, instr.size );
3144
+ auto bits = instr.size * 8 ;
3145
+ shift %= bits; // Normalize rotation amount
3146
+ value = ((left >> shift) | (left << (bits - shift))) & sizeMask;
3147
+ return true ;
3148
+ }
3036
3149
case LLIL_NEG:
3037
3150
{
3038
3151
if (!ComputeExprValue (instr.GetSourceExpr <LLIL_NEG>(), left))
@@ -3163,6 +3276,33 @@ bool DebuggerController::ComputeExprValue(const LowLevelILInstruction &instr, in
3163
3276
value = GetValueFromComparison (instr.operation , left, right, instr.size );
3164
3277
return true ;
3165
3278
3279
+ case LLIL_CALL:
3280
+ {
3281
+ // For CALL operations, we compute the destination address
3282
+ // The actual function call would be executed by the debugger, not here
3283
+ if (!ComputeExprValue (instr.GetDestExpr <LLIL_CALL>(), left))
3284
+ return false ;
3285
+ value = left;
3286
+ return true ;
3287
+ }
3288
+ case LLIL_TAILCALL:
3289
+ {
3290
+ // For TAILCALL operations, we compute the destination address
3291
+ if (!ComputeExprValue (instr.GetDestExpr <LLIL_TAILCALL>(), left))
3292
+ return false ;
3293
+ value = left;
3294
+ return true ;
3295
+ }
3296
+ case LLIL_IF:
3297
+ {
3298
+ // For IF operations, we evaluate the condition and return 0 or 1
3299
+ if (!ComputeExprValue (instr.GetConditionExpr <LLIL_IF>(), left))
3300
+ return false ;
3301
+ // Convert to boolean (0 or 1)
3302
+ value = (left != 0 ) ? 1 : 0 ;
3303
+ return true ;
3304
+ }
3305
+
3166
3306
default :
3167
3307
break ;
3168
3308
}
@@ -3485,6 +3625,95 @@ bool DebuggerController::ComputeExprValue(const MediumLevelILInstruction &instr,
3485
3625
value &= sizeMask;
3486
3626
return true ;
3487
3627
}
3628
+ case MLIL_MUL:
3629
+ {
3630
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_MUL>(), left))
3631
+ return false ;
3632
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_MUL>(), right))
3633
+ return false ;
3634
+ value = left * right;
3635
+ value &= sizeMask;
3636
+ return true ;
3637
+ }
3638
+ case MLIL_MULU_HI:
3639
+ {
3640
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_MULU_HI>(), left))
3641
+ return false ;
3642
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_MULU_HI>(), right))
3643
+ return false ;
3644
+ auto result = left * right;
3645
+ value = result >> (instr.size * 8 );
3646
+ value &= sizeMask;
3647
+ return true ;
3648
+ }
3649
+ case MLIL_MULS_HI:
3650
+ {
3651
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_MULS_HI>(), left))
3652
+ return false ;
3653
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_MULS_HI>(), right))
3654
+ return false ;
3655
+ // Sign extend operands for signed multiplication
3656
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3657
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3658
+ auto result = leftSigned * rightSigned;
3659
+ value = result >> (instr.size * 8 );
3660
+ value &= sizeMask;
3661
+ return true ;
3662
+ }
3663
+ case MLIL_DIVU:
3664
+ {
3665
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_DIVU>(), left))
3666
+ return false ;
3667
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_DIVU>(), right))
3668
+ return false ;
3669
+ if (right == 0 )
3670
+ return false ; // Division by zero
3671
+ value = left / right;
3672
+ value &= sizeMask;
3673
+ return true ;
3674
+ }
3675
+ case MLIL_DIVS:
3676
+ {
3677
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_DIVS>(), left))
3678
+ return false ;
3679
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_DIVS>(), right))
3680
+ return false ;
3681
+ if (right == 0 )
3682
+ return false ; // Division by zero
3683
+ // Sign extend operands for signed division
3684
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3685
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3686
+ auto result = leftSigned / rightSigned;
3687
+ value = result & sizeMask;
3688
+ return true ;
3689
+ }
3690
+ case MLIL_MODU:
3691
+ {
3692
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_MODU>(), left))
3693
+ return false ;
3694
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_MODU>(), right))
3695
+ return false ;
3696
+ if (right == 0 )
3697
+ return false ; // Division by zero
3698
+ value = left % right;
3699
+ value &= sizeMask;
3700
+ return true ;
3701
+ }
3702
+ case MLIL_MODS:
3703
+ {
3704
+ if (!ComputeExprValue (instr.GetLeftExpr <MLIL_MODS>(), left))
3705
+ return false ;
3706
+ if (!ComputeExprValue (instr.GetRightExpr <MLIL_MODS>(), right))
3707
+ return false ;
3708
+ if (right == 0 )
3709
+ return false ; // Division by zero
3710
+ // Sign extend operands for signed modulo
3711
+ auto leftSigned = SignExtend (left, instr.size , 64 );
3712
+ auto rightSigned = SignExtend (right, instr.size , 64 );
3713
+ auto result = leftSigned % rightSigned;
3714
+ value = result & sizeMask;
3715
+ return true ;
3716
+ }
3488
3717
case MLIL_NEG:
3489
3718
{
3490
3719
if (!ComputeExprValue (instr.GetSourceExpr <MLIL_NEG>(), left))
@@ -3595,6 +3824,32 @@ bool DebuggerController::ComputeExprValue(const MediumLevelILInstruction &instr,
3595
3824
value = GetValueFromComparison (instr.operation , left, right, instr.size );
3596
3825
return true ;
3597
3826
3827
+ case MLIL_CALL:
3828
+ {
3829
+ // For CALL operations, we compute the destination address
3830
+ if (!ComputeExprValue (instr.GetDestExpr <MLIL_CALL>(), left))
3831
+ return false ;
3832
+ value = left;
3833
+ return true ;
3834
+ }
3835
+ case MLIL_TAILCALL:
3836
+ {
3837
+ // For TAILCALL operations, we compute the destination address
3838
+ if (!ComputeExprValue (instr.GetDestExpr <MLIL_TAILCALL>(), left))
3839
+ return false ;
3840
+ value = left;
3841
+ return true ;
3842
+ }
3843
+ case MLIL_IF:
3844
+ {
3845
+ // For IF operations, we evaluate the condition and return 0 or 1
3846
+ if (!ComputeExprValue (instr.GetConditionExpr <MLIL_IF>(), left))
3847
+ return false ;
3848
+ // Convert to boolean (0 or 1)
3849
+ value = (left != 0 ) ? 1 : 0 ;
3850
+ return true ;
3851
+ }
3852
+
3598
3853
default :
3599
3854
return false ;
3600
3855
}
@@ -3790,6 +4045,70 @@ bool DebuggerController::ComputeExprValue(const HighLevelILInstruction &instr, i
3790
4045
value &= sizeMask;
3791
4046
return true ;
3792
4047
}
4048
+ case HLIL_MUL:
4049
+ {
4050
+ if (!ComputeExprValue (instr.GetLeftExpr <HLIL_MUL>(), left))
4051
+ return false ;
4052
+ if (!ComputeExprValue (instr.GetRightExpr <HLIL_MUL>(), right))
4053
+ return false ;
4054
+ value = left * right;
4055
+ value &= sizeMask;
4056
+ return true ;
4057
+ }
4058
+ case HLIL_DIVU:
4059
+ {
4060
+ if (!ComputeExprValue (instr.GetLeftExpr <HLIL_DIVU>(), left))
4061
+ return false ;
4062
+ if (!ComputeExprValue (instr.GetRightExpr <HLIL_DIVU>(), right))
4063
+ return false ;
4064
+ if (right == 0 )
4065
+ return false ; // Division by zero
4066
+ value = left / right;
4067
+ value &= sizeMask;
4068
+ return true ;
4069
+ }
4070
+ case HLIL_DIVS:
4071
+ {
4072
+ if (!ComputeExprValue (instr.GetLeftExpr <HLIL_DIVS>(), left))
4073
+ return false ;
4074
+ if (!ComputeExprValue (instr.GetRightExpr <HLIL_DIVS>(), right))
4075
+ return false ;
4076
+ if (right == 0 )
4077
+ return false ; // Division by zero
4078
+ // Sign extend operands for signed division
4079
+ auto leftSigned = SignExtend (left, instr.size , 64 );
4080
+ auto rightSigned = SignExtend (right, instr.size , 64 );
4081
+ auto result = leftSigned / rightSigned;
4082
+ value = result & sizeMask;
4083
+ return true ;
4084
+ }
4085
+ case HLIL_MODU:
4086
+ {
4087
+ if (!ComputeExprValue (instr.GetLeftExpr <HLIL_MODU>(), left))
4088
+ return false ;
4089
+ if (!ComputeExprValue (instr.GetRightExpr <HLIL_MODU>(), right))
4090
+ return false ;
4091
+ if (right == 0 )
4092
+ return false ; // Division by zero
4093
+ value = left % right;
4094
+ value &= sizeMask;
4095
+ return true ;
4096
+ }
4097
+ case HLIL_MODS:
4098
+ {
4099
+ if (!ComputeExprValue (instr.GetLeftExpr <HLIL_MODS>(), left))
4100
+ return false ;
4101
+ if (!ComputeExprValue (instr.GetRightExpr <HLIL_MODS>(), right))
4102
+ return false ;
4103
+ if (right == 0 )
4104
+ return false ; // Division by zero
4105
+ // Sign extend operands for signed modulo
4106
+ auto leftSigned = SignExtend (left, instr.size , 64 );
4107
+ auto rightSigned = SignExtend (right, instr.size , 64 );
4108
+ auto result = leftSigned % rightSigned;
4109
+ value = result & sizeMask;
4110
+ return true ;
4111
+ }
3793
4112
case HLIL_NEG:
3794
4113
{
3795
4114
if (!ComputeExprValue (instr.GetSourceExpr <HLIL_NEG>(), left))
@@ -3900,6 +4219,32 @@ bool DebuggerController::ComputeExprValue(const HighLevelILInstruction &instr, i
3900
4219
value = GetValueFromComparison (instr.operation , left, right, instr.size );
3901
4220
return true ;
3902
4221
4222
+ case HLIL_CALL:
4223
+ {
4224
+ // For CALL operations, we compute the destination address
4225
+ if (!ComputeExprValue (instr.GetDestExpr <HLIL_CALL>(), left))
4226
+ return false ;
4227
+ value = left;
4228
+ return true ;
4229
+ }
4230
+ case HLIL_TAILCALL:
4231
+ {
4232
+ // For TAILCALL operations, we compute the destination address
4233
+ if (!ComputeExprValue (instr.GetDestExpr <HLIL_TAILCALL>(), left))
4234
+ return false ;
4235
+ value = left;
4236
+ return true ;
4237
+ }
4238
+ case HLIL_IF:
4239
+ {
4240
+ // For IF operations, we evaluate the condition and return 0 or 1
4241
+ if (!ComputeExprValue (instr.GetConditionExpr <HLIL_IF>(), left))
4242
+ return false ;
4243
+ // Convert to boolean (0 or 1)
4244
+ value = (left != 0 ) ? 1 : 0 ;
4245
+ return true ;
4246
+ }
4247
+
3903
4248
default :
3904
4249
return false ;
3905
4250
}
0 commit comments