Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Error when building the kernel for NSLU2: Function pmap_vac_me_user in pmap.c

I received the following error while building the kernel for the NSLU2.
#   compile  NSLU2_ALL/pmap.o
/home/hayford/net60/src/../tools/bin/armeb--netbsdelf-gcc -ffreestanding -fno-zero-initialized-in-bss -mcpu=xscale -mbig-endian -O2 -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -fno-strict-aliasing -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Werror -mcpu=xscale -mbig-endian -DIXP425_NPE_MICROCODE -I. -I/home/hayford/net60/src/sys/../common/include -I/home/hayford/net60/src/sys/arch -I/home/hayford/net60/src/sys -nostdinc -DKERNEL_BASE_EXT=0xc0000000 -DCONSPEED=115200 -DCONUNIT=0 -DDIAGNOSTIC -DDEBUG -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -I/home/hayford/net60/src/sys/lib/libkern/../../../common/lib/libc/quad -I/home/hayford/net60/src/sys/lib/libkern/../../../common/lib/libc/string -I/home/hayford/net60/src/sys/lib/libkern/../../../common/lib/libc/arch/arm/string -c /home/hayford/net60/src/sys/arch/arm/arm32/pmap.c
cc1: warnings being treated as errors
/home/hayford/net60/src/sys/arch/arm/arm32/pmap.c: In function 'pmap_vac_me_user': /home/hayford/net60/src/sys/arch/arm/arm32/pmap.c:1677: warning: 'npv' may be used uninitialized in this function

The code in question is:

static void
pmap_vac_me_user(struct vm_page *pg, pmap_t pm, vaddr_t va)
    pmap_t kpmap = pmap_kernel();
The following is line 1677:
    struct pv_entry *pv, *npv;
    struct l2_bucket *l2b;
    pt_entry_t *ptep, pte;
    u_int entries = 0;
    u_int writable = 0;
    u_int cacheable_entries = 0;
    u_int kern_cacheable = 0;
    u_int other_writable = 0;

     * Count mappings and writable mappings in this pmap.
     * Include kernel mappings as part of our own.
     * Keep a pointer to the first one.
    SLIST_FOREACH(pv, &pg->mdpage.pvh_list, pv_link) {
        /* Count mappings in the same pmap */
        if (pm == pv->pv_pmap || kpmap == pv->pv_pmap) {
            if (entries++ == 0)
                npv = pv;

            /* Cacheable mappings */
            if ((pv->pv_flags & PVF_NC) == 0) {
                if (kpmap == pv->pv_pmap)

            /* Writable mappings */
            if (pv->pv_flags & PVF_WRITE)
        } else
        if (pv->pv_flags & PVF_WRITE)
            other_writable = 1;

     * Enable or disable caching as necessary.
     * Note: the first entry might be part of the kernel pmap,
     * so we can't assume this is indicative of the state of the
     * other (maybe non-kpmap) entries.
    if ((entries > 1 && writable) ||
        (entries > 0 && pm == kpmap && other_writable)) {
        if (cacheable_entries == 0)

This is probably the line that is causing the problem.
        for (pv = npv; pv; pv = SLIST_NEXT(pv, pv_link)) {
            if ((pm != pv->pv_pmap && kpmap != pv->pv_pmap) ||
                (pv->pv_flags & PVF_NC))
It appears to me that the warning is valid, since npv may not be set to anything. The header line for the file is

/*    $NetBSD: pmap.c,v 1.183 2008/08/06 19:13:45 matt Exp $    */


Home | Main Index | Thread Index | Old Index