mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
bitfield support in address mode -> value mode evaluation path
This commit is contained in:
+15
-1
@@ -4219,7 +4219,7 @@ df_value_mode_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_
|
|||||||
TG_Key type_key = eval.type_key;
|
TG_Key type_key = eval.type_key;
|
||||||
TG_Kind type_kind = tg_kind_from_key(type_key);
|
TG_Kind type_kind = tg_kind_from_key(type_key);
|
||||||
U64 type_byte_size = tg_byte_size_from_graph_rdi_key(graph, rdi, type_key);
|
U64 type_byte_size = tg_byte_size_from_graph_rdi_key(graph, rdi, type_key);
|
||||||
if(!tg_key_match(type_key, tg_key_zero()) && type_byte_size <= 8)
|
if(!tg_key_match(type_key, tg_key_zero()) && type_byte_size <= sizeof(U64)*2)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
Rng1U64 vaddr_range = r1u64(eval.offset, eval.offset + type_byte_size);
|
Rng1U64 vaddr_range = r1u64(eval.offset, eval.offset + type_byte_size);
|
||||||
@@ -4231,6 +4231,20 @@ df_value_mode_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_
|
|||||||
MemoryCopy(eval.imm_u128, data.str, Min(data.size, sizeof(U64)*2));
|
MemoryCopy(eval.imm_u128, data.str, Min(data.size, sizeof(U64)*2));
|
||||||
eval.mode = EVAL_EvalMode_Value;
|
eval.mode = EVAL_EvalMode_Value;
|
||||||
|
|
||||||
|
// rjf: mask&shift, for bitfields
|
||||||
|
if(type_kind == TG_Kind_Bitfield && type_byte_size <= sizeof(U64))
|
||||||
|
{
|
||||||
|
TG_Type *type = tg_type_from_graph_rdi_key(scratch.arena, graph, rdi, type_key);
|
||||||
|
U64 valid_bits_mask = 0;
|
||||||
|
for(U64 idx = 0; idx < type->count; idx += 1)
|
||||||
|
{
|
||||||
|
valid_bits_mask |= (1<<idx);
|
||||||
|
}
|
||||||
|
eval.imm_u64 = eval.imm_u64 >> type->off;
|
||||||
|
eval.imm_u64 = eval.imm_u64 & valid_bits_mask;
|
||||||
|
eval.type_key = type->direct_type_key;
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: manually sign-extend
|
// rjf: manually sign-extend
|
||||||
switch(type_kind)
|
switch(type_kind)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1151,8 +1151,11 @@ tg_lhs_string_from_key(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, TG_Key ke
|
|||||||
|
|
||||||
case TG_Kind_Bitfield:
|
case TG_Kind_Bitfield:
|
||||||
{
|
{
|
||||||
TG_Key direct = tg_direct_from_graph_rdi_key(graph, rdi, key);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
tg_lhs_string_from_key(arena, graph, rdi, direct, out, prec, skip_return);
|
TG_Type *type = tg_type_from_graph_rdi_key(scratch.arena, graph, rdi, key);
|
||||||
|
tg_lhs_string_from_key(arena, graph, rdi, type->direct_type_key, out, prec, skip_return);
|
||||||
|
str8_list_pushf(arena, out, ": %I64u", type->count);
|
||||||
|
scratch_end(scratch);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case TG_Kind_Modifier:
|
case TG_Kind_Modifier:
|
||||||
@@ -1280,11 +1283,8 @@ tg_rhs_string_from_key(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, TG_Key ke
|
|||||||
|
|
||||||
case TG_Kind_Bitfield:
|
case TG_Kind_Bitfield:
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
TG_Key direct = tg_direct_from_graph_rdi_key(graph, rdi, key);
|
||||||
TG_Type *type = tg_type_from_graph_rdi_key(scratch.arena, graph, rdi, key);
|
tg_rhs_string_from_key(arena, graph, rdi, direct, out, prec);
|
||||||
tg_rhs_string_from_key(arena, graph, rdi, type->direct_type_key, out, prec);
|
|
||||||
str8_list_pushf(arena, out, ": %I64u", type->count);
|
|
||||||
scratch_end(scratch);
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case TG_Kind_Modifier:
|
case TG_Kind_Modifier:
|
||||||
|
|||||||
Reference in New Issue
Block a user