Skip to content

Commit

Permalink
Fix build with -DDEBUG
Browse files Browse the repository at this point in the history
If DEBUG is not defined, the compiler doesn't look at the arguments to
dprintf().  This has led to dprintf() bitrotting over time, referring
to variables that no longer exist, or by the wrong type, etc.

Here, I've tried to fix all the dprintf() calls to the best of my
ability, by comparing them to nearby calls that do compile, and
looking through the git history to understand the original intent.

Signed-off-by: Alyssa Ross <[email protected]>
  • Loading branch information
alyssais authored and marcan committed Nov 14, 2023
1 parent f297951 commit 8bdfdb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/adt.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int adt_get_reg(const void *adt, int *path, const char *prop, int idx, u64 *padd
u32 pa_cells = 2;
ADT_GETPROP(adt, parent, "#address-cells", &pa_cells);

dprintf(" translate range to address-cells=%d size-cells=%d\n", pa_cells, ps_cells);
dprintf(" translate range to address-cells=%d\n", pa_cells);

if (pa_cells < 1 || pa_cells > 2 || s_cells > 2)
return ADT_ERR_BADNCELLS;
Expand Down
14 changes: 7 additions & 7 deletions src/hv_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ u64 hv_pt_walk(u64 addr)

u64 l1d = hv_Ltop[idx];

dprintf(" l1d = 0x%lx\n", l2d);
dprintf(" l1d = 0x%lx\n", l1d);

if (!L1_IS_TABLE(l1d)) {
dprintf(" result: 0x%lx\n", l1d);
Expand Down Expand Up @@ -871,7 +871,7 @@ bool hv_pa_write(struct exc_info *ctx, u64 addr, u64 *val, int width)
write64(addr + 8 * i, val[i]);
break;
default:
dprintf("HV: unsupported write width %ld\n", width);
dprintf("HV: unsupported write width %d\n", width);
exc_guard = GUARD_OFF;
return false;
}
Expand Down Expand Up @@ -918,7 +918,7 @@ bool hv_pa_read(struct exc_info *ctx, u64 addr, u64 *val, int width)
val[3] = read64(addr + 24);
break;
default:
dprintf("HV: unsupported read width %ld\n", width);
dprintf("HV: unsupported read width %d\n", width);
exc_guard = GUARD_OFF;
return false;
}
Expand Down Expand Up @@ -982,8 +982,8 @@ static bool hv_emulate_rw_aligned(struct exc_info *ctx, u64 pte, u64 vaddr, u64
hv_hook_t *hook = (hv_hook_t *)target;
if (!hook(ctx, ipa, val, true, width))
return false;
dprintf("HV: SPTE_HOOK[W] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, far, ipa,
1 << width, hook, wval);
dprintf("HV: SPTE_HOOK[W] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, ipa,
paddr, 1 << width, hook, val);
break;
}
case SPTE_PROXY_HOOK_RW:
Expand Down Expand Up @@ -1021,8 +1021,8 @@ static bool hv_emulate_rw_aligned(struct exc_info *ctx, u64 pte, u64 vaddr, u64
hv_hook_t *hook = (hv_hook_t *)target;
if (!hook(ctx, ipa, val, false, width))
return false;
dprintf("HV: SPTE_HOOK[R] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, far, ipa,
1 << width, hook, val);
dprintf("HV: SPTE_HOOK[R] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, ipa,
paddr, 1 << width, hook, val);
break;
}
case SPTE_PROXY_HOOK_RW:
Expand Down

0 comments on commit 8bdfdb7

Please sign in to comment.