Skip to content

Commit 8bdfdb7

Browse files
alyssaismarcan
authored andcommitted
Fix build with -DDEBUG
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]>
1 parent f297951 commit 8bdfdb7

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/adt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ int adt_get_reg(const void *adt, int *path, const char *prop, int idx, u64 *padd
320320
u32 pa_cells = 2;
321321
ADT_GETPROP(adt, parent, "#address-cells", &pa_cells);
322322

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

325325
if (pa_cells < 1 || pa_cells > 2 || s_cells > 2)
326326
return ADT_ERR_BADNCELLS;

src/hv_vm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ u64 hv_pt_walk(u64 addr)
445445

446446
u64 l1d = hv_Ltop[idx];
447447

448-
dprintf(" l1d = 0x%lx\n", l2d);
448+
dprintf(" l1d = 0x%lx\n", l1d);
449449

450450
if (!L1_IS_TABLE(l1d)) {
451451
dprintf(" result: 0x%lx\n", l1d);
@@ -871,7 +871,7 @@ bool hv_pa_write(struct exc_info *ctx, u64 addr, u64 *val, int width)
871871
write64(addr + 8 * i, val[i]);
872872
break;
873873
default:
874-
dprintf("HV: unsupported write width %ld\n", width);
874+
dprintf("HV: unsupported write width %d\n", width);
875875
exc_guard = GUARD_OFF;
876876
return false;
877877
}
@@ -918,7 +918,7 @@ bool hv_pa_read(struct exc_info *ctx, u64 addr, u64 *val, int width)
918918
val[3] = read64(addr + 24);
919919
break;
920920
default:
921-
dprintf("HV: unsupported read width %ld\n", width);
921+
dprintf("HV: unsupported read width %d\n", width);
922922
exc_guard = GUARD_OFF;
923923
return false;
924924
}
@@ -982,8 +982,8 @@ static bool hv_emulate_rw_aligned(struct exc_info *ctx, u64 pte, u64 vaddr, u64
982982
hv_hook_t *hook = (hv_hook_t *)target;
983983
if (!hook(ctx, ipa, val, true, width))
984984
return false;
985-
dprintf("HV: SPTE_HOOK[W] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, far, ipa,
986-
1 << width, hook, wval);
985+
dprintf("HV: SPTE_HOOK[W] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, ipa,
986+
paddr, 1 << width, hook, val);
987987
break;
988988
}
989989
case SPTE_PROXY_HOOK_RW:
@@ -1021,8 +1021,8 @@ static bool hv_emulate_rw_aligned(struct exc_info *ctx, u64 pte, u64 vaddr, u64
10211021
hv_hook_t *hook = (hv_hook_t *)target;
10221022
if (!hook(ctx, ipa, val, false, width))
10231023
return false;
1024-
dprintf("HV: SPTE_HOOK[R] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, far, ipa,
1025-
1 << width, hook, val);
1024+
dprintf("HV: SPTE_HOOK[R] @0x%lx 0x%lx -> 0x%lx (w=%d) @%p: 0x%lx\n", elr, ipa,
1025+
paddr, 1 << width, hook, val);
10261026
break;
10271027
}
10281028
case SPTE_PROXY_HOOK_RW:

0 commit comments

Comments
 (0)