Skip to content

Commit

Permalink
m1n1.adt: fix padding in DAPFT8110B definition
Browse files Browse the repository at this point in the history
When I tried to use the proxyclient shell, I got:
"Exception parsing /device-tree/arm-io/dart-dcp.dapf-instance-0 value […]"

I laid out the hex dump in a text editor, and added line breaks every
56 bytes (the former size of DAPFT8110B):

0000703b020000000080713b0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000
40723b020000000080723b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000
003b020000007f73073b02000000200000000000000000000000000000000000000000000000000000000000000000030100000000000028
3d020000000040283d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000080003d
020000000380003d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000e03f02
000000ffffef3f0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000c0403e0200
0000ffff403e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000433e020000
00ff3f433e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000783d02000000
03417a3d0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000003c3b0200000000
003e3b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000403c02000000ffff
473c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000103c020000004f0c10
3c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000703d020000000341723d
02000000200000000000000000000000000000000000000000000000000000000000000000030100000000

Looking at the patterns shared by all struct instances
(r0h = 3, r0l = 1, for example), each row appeared to be shifted one
byte to the left compared to its predecessor.  This suggests that
DAPFT8110B has only three extra bytes of padding compared to
DAPFT8110.

Removing the one byte of unknown data in the DAPFT8110B fixed the
problem, allowing me to start the shell.

Signed-off-by: Alyssa Ross <[email protected]>
  • Loading branch information
alyssais committed Oct 27, 2023
1 parent 9a277fa commit 987f065
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion proxyclient/m1n1/adt.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@
"unk3" / Hex(Int8ul),
"r0h" / Hex(Int8ul),
"r0l" / Hex(Int8ul),
"unk4" / Hex(Int8ul),
"pad" / Hex(Int32ul),
)

Expand Down
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
12 changes: 6 additions & 6 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,7 +1021,7 @@ 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,
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;
}
Expand Down

0 comments on commit 987f065

Please sign in to comment.