Author: mhorne
Date: Tue Sep  8 13:21:13 2020
New Revision: 365455
URL: https://svnweb.freebsd.org/changeset/base/365455

Log:
  RISC-V: fix some mismatched format specifiers
  
  RISC-V is currently built with -Wno-format, which is how these went
  undetected. Address them now before re-enabling those warnings.
  
  Differential Revision:        https://reviews.freebsd.org/D26319

Modified:
  head/sys/dev/xilinx/axidma.c
  head/sys/riscv/riscv/db_disasm.c
  head/sys/riscv/riscv/intr_machdep.c
  head/sys/riscv/riscv/pmap.c
  head/sys/riscv/riscv/sbi.c
  head/sys/riscv/riscv/trap.c

Modified: head/sys/dev/xilinx/axidma.c
==============================================================================
--- head/sys/dev/xilinx/axidma.c        Tue Sep  8 12:38:34 2020        
(r365454)
+++ head/sys/dev/xilinx/axidma.c        Tue Sep  8 13:21:13 2020        
(r365455)
@@ -363,7 +363,7 @@ axidma_desc_alloc(struct axidma_softc *sc, struct xdma
        chan->mem_vaddr = kva_alloc(chan->mem_size);
        pmap_kenter_device(chan->mem_vaddr, chan->mem_size, chan->mem_paddr);
 
-       device_printf(sc->dev, "Allocated chunk %lx %d\n",
+       device_printf(sc->dev, "Allocated chunk %lx %lu\n",
            chan->mem_paddr, chan->mem_size);
 
        for (i = 0; i < nsegments; i++) {

Modified: head/sys/riscv/riscv/db_disasm.c
==============================================================================
--- head/sys/riscv/riscv/db_disasm.c    Tue Sep  8 12:38:34 2020        
(r365454)
+++ head/sys/riscv/riscv/db_disasm.c    Tue Sep  8 13:21:13 2020        
(r365455)
@@ -416,7 +416,7 @@ oprint(struct riscv_op *op, vm_offset_t loc, int insn)
                                imm |= ((insn >> 12) & 0x1) << 5;
                                if (imm & (1 << 5))
                                        imm |= (0x7ffffff << 5); /* sign ext */
-                               db_printf("0x%lx", imm);
+                               db_printf("0x%x", imm);
                                break;
                        case 'o':
                                imm = ((insn >> 2) & 0x1f) << 0;
@@ -524,7 +524,7 @@ oprint(struct riscv_op *op, vm_offset_t loc, int insn)
                        imm = (insn >> 12) & 0xfffff;
                        if (imm & (1 << 20))
                                imm |= (0xfff << 20);   /* sign extend */
-                       db_printf("0x%lx", imm);
+                       db_printf("0x%x", imm);
                        break;
                case 'j':
                        /* imm[11:0] << 20 */

Modified: head/sys/riscv/riscv/intr_machdep.c
==============================================================================
--- head/sys/riscv/riscv/intr_machdep.c Tue Sep  8 12:38:34 2020        
(r365454)
+++ head/sys/riscv/riscv/intr_machdep.c Tue Sep  8 13:21:13 2020        
(r365455)
@@ -73,9 +73,9 @@ struct intc_irqsrc isrcs[INTC_NIRQS];
 static void
 riscv_mask_irq(void *source)
 {
-       uintptr_t irq;
+       int irq;
 
-       irq = (uintptr_t)source;
+       irq = (int)(uintptr_t)source;
 
        switch (irq) {
        case IRQ_TIMER_SUPERVISOR:
@@ -95,9 +95,9 @@ riscv_mask_irq(void *source)
 static void
 riscv_unmask_irq(void *source)
 {
-       uintptr_t irq;
+       int irq;
 
-       irq = (uintptr_t)source;
+       irq = (int)(uintptr_t)source;
 
        switch (irq) {
        case IRQ_TIMER_SUPERVISOR:

Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c Tue Sep  8 12:38:34 2020        (r365454)
+++ head/sys/riscv/riscv/pmap.c Tue Sep  8 13:21:13 2020        (r365455)
@@ -590,7 +590,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart,
                if (physmap[i + 1] > max_pa)
                        max_pa = physmap[i + 1];
        }
-       printf("physmap_idx %lx\n", physmap_idx);
+       printf("physmap_idx %u\n", physmap_idx);
        printf("min_pa %lx\n", min_pa);
        printf("max_pa %lx\n", max_pa);
 

Modified: head/sys/riscv/riscv/sbi.c
==============================================================================
--- head/sys/riscv/riscv/sbi.c  Tue Sep  8 12:38:34 2020        (r365454)
+++ head/sys/riscv/riscv/sbi.c  Tue Sep  8 13:21:13 2020        (r365455)
@@ -104,7 +104,7 @@ sbi_print_version(void)
 
        switch (sbi_impl_id) {
        case (SBI_IMPL_ID_BBL):
-               printf("SBI: Berkely Boot Loader %u\n", sbi_impl_version);
+               printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
                break;
        case (SBI_IMPL_ID_OPENSBI):
                major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
@@ -112,7 +112,7 @@ sbi_print_version(void)
                printf("SBI: OpenSBI v%u.%u\n", major, minor);
                break;
        default:
-               printf("SBI: Unrecognized Implementation: %u\n", sbi_impl_id);
+               printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);
                break;
        }
 

Modified: head/sys/riscv/riscv/trap.c
==============================================================================
--- head/sys/riscv/riscv/trap.c Tue Sep  8 12:38:34 2020        (r365454)
+++ head/sys/riscv/riscv/trap.c Tue Sep  8 13:21:13 2020        (r365455)
@@ -306,7 +306,7 @@ do_trap_supervisor(struct trapframe *frame)
                break;
        default:
                dump_regs(frame);
-               panic("Unknown kernel exception %x trap value %lx\n",
+               panic("Unknown kernel exception %lx trap value %lx\n",
                    exception, frame->tf_stval);
        }
 }
@@ -375,7 +375,7 @@ do_trap_user(struct trapframe *frame)
                break;
        default:
                dump_regs(frame);
-               panic("Unknown userland exception %x, trap value %lx\n",
+               panic("Unknown userland exception %lx, trap value %lx\n",
                    exception, frame->tf_stval);
        }
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to