Skip to content

Commit 2c39c39

Browse files
committed
sw/boot/zsl.c: fix printf format specifiers
1 parent 8a4f0fc commit 2c39c39

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

sw/boot/zsl.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ static inline void load_part_or_spin(void *priv, const uint64_t *pguid, void *co
3939
else if (part_idx < 0)
4040
printf("[ZSL] No %s", name);
4141
else {
42-
printf("[ZSL] Copy %s (part %d, LBA %d-%d) to 0x%lx... ", name, part_idx, lba_begin,
42+
printf("[ZSL] Copy %s (part %ld, LBA %ld-%ld) to 0x%p... ", name, part_idx, lba_begin,
4343
lba_end, dst);
4444
grread(priv, dst, 0x200 * lba_begin, 0x200 * (lba_end - lba_begin + 1));
4545
printf("OK\r\n");
4646
return;
4747
}
4848
// Catch
49-
printf(" with at most %d sectors and type GUID 0x%llx%llx", max_lbas, pguid[1], pguid[0]);
49+
printf(" with at most %ld sectors and type GUID 0x%lx%lx", max_lbas, pguid[1], pguid[0]);
5050
while (1) wfi();
5151
}
5252

@@ -65,13 +65,13 @@ int main(void) {
6565
// Print boot-critical cat, and also parameters
6666
printf(" /\\___/\\ Boot mode: %d\r\n"
6767
"( o o ) Real-time clock: %d Hz\r\n"
68-
"( =^= ) System clock: %d Hz\r\n"
69-
"( ) Read global ptr: 0x%08x\r\n"
70-
"( P ) Read pointer: 0x%08x\r\n"
71-
"( U # L ) Read argument: 0x%08x\r\n"
68+
"( =^= ) System clock: %ld Hz\r\n"
69+
"( ) Read global ptr: 0x%p\r\n"
70+
"( P ) Read pointer: 0x%p\r\n"
71+
"( U # L ) Read argument: 0x%p\r\n"
7272
"( P )\r\n"
7373
"( ))))))))))\r\n\r\n",
74-
bootmode, rtc_freq, core_freq, rgp, read, priv);
74+
bootmode, rtc_freq, core_freq, rgp, (void *)(uintptr_t)read, priv);
7575

7676
// If this is a GPT disk boot, load payload and device tree
7777
if (read & 1) {
@@ -82,7 +82,8 @@ int main(void) {
8282

8383
// Launch payload
8484
payload_t fw = __BOOT_ZSL_FW;
85-
printf("[ZSL] Launch firmware at %lx with device tree at %lx\r\n", fw, __BOOT_ZSL_DTB);
85+
printf("[ZSL] Launch firmware at %p with device tree at %p\r\n", (void *)(uintptr_t)fw,
86+
__BOOT_ZSL_DTB);
8687
fencei();
8788
return fw(0, (uintptr_t)__BOOT_ZSL_DTB, 0);
8889
}
@@ -94,8 +95,8 @@ void trap_vector() {
9495
"csrr %3, mie; csrr %4, mstatus; csrr %5, mtval"
9596
: "=r"(mcause), "=r"(mepc), "=r"(mip), "=r"(mie), "=r"(mstatus), "=r"(mtval));
9697
printf("\r\n==== [ZSL] trap encountered ====\r\n"
97-
" mcause: 0x%016x\r\n mepc: 0x%016x\r\n mip: 0x%016x\r\n"
98-
" mie: 0x%016x\r\n mstatus: 0x%016x\r\n mtval: 0x%016x\r\n"
98+
" mcause: 0x%016lx\r\n mepc: 0x%016lx\r\n mip: 0x%016lx\r\n"
99+
" mie: 0x%016lx\r\n mstatus: 0x%016lx\r\n mtval: 0x%016lx\r\n"
99100
"================================\r\n",
100101
mcause, mepc, mip, mie, mstatus, mtval);
101102
while (1) wfi();

0 commit comments

Comments
 (0)