NetBSD Problem Report #39266

From www@NetBSD.org  Fri Aug  1 18:05:44 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 0FF9363B99B
	for <gnats-bugs@gnats.netbsd.org>; Fri,  1 Aug 2008 18:05:44 +0000 (UTC)
Message-Id: <20080801180543.A4D5C63B975@narn.NetBSD.org>
Date: Fri,  1 Aug 2008 18:05:43 +0000 (UTC)
From: xtraeme@gmail.com
Reply-To: xtraeme@gmail.com
To: gnats-bugs@NetBSD.org
Subject: NetBSD/amd64 doesn't build with -Wextra
X-Send-Pr-Version: www-1.0

>Number:         39266
>Category:       port-amd64
>Synopsis:       NetBSD/amd64 doesn't build with -Wextra
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 01 18:10:00 +0000 2008
>Closed-Date:    Fri Sep 05 13:41:44 +0000 2008
>Last-Modified:  Fri Sep 05 13:41:44 +0000 2008
>Originator:     Juan RP
>Release:        Latest and greatest
>Organization:
Not NetBSD
>Environment:
NetBSD sasha 4.99.71 NetBSD 4.99.71 (MASTER) #5: Thu Jul 31 22:05:45 CEST 2008  juan@sasha:/home/juan/build/obj/sys/arch/amd64/compile/MASTER amd64
>Description:
After looking at Makefile.kern.inc more deeply, I've found the following:

.  if ${MACHINE} == "i386" || ...
CWARNFLAGS+=    -Wextra -Wno-unused-parameter
.  endif
. endif
.endif

Only i386, sparc64 and prep are built with -Wextra. Therefore I've made a set of patches to allow building all the amd64 kernels with -Wextra.

INSTALL, GENERIC, XEN2_DOM{0,U} and INSTALL_XEN3_DOMU are compile tested.

>How-To-Repeat:

>Fix:
Apply the following patch:

-----------------
START OF PATCHES
-----------------

Index: arch/amd64/amd64/db_trace.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/db_trace.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 db_trace.c
--- arch/amd64/amd64/db_trace.c 2 Jul 2008 19:49:58 -0000       1.13
+++ arch/amd64/amd64/db_trace.c 1 Aug 2008 17:44:56 -0000
@@ -52,30 +52,30 @@ static int db_x86_64_regop(const struct 
  * Machine register set.
  */
 const struct db_variable db_regs[] = {
-       { "ds",         dbreg(ds),     db_x86_64_regop },
-       { "es",         dbreg(es),     db_x86_64_regop },
-       { "fs",         dbreg(fs),     db_x86_64_regop },
-       { "gs",         dbreg(gs),     db_x86_64_regop },
-       { "rdi",        dbreg(rdi),    db_x86_64_regop },
-       { "rsi",        dbreg(rsi),    db_x86_64_regop },
-       { "rbp",        dbreg(rbp),    db_x86_64_regop },
-       { "rbx",        dbreg(rbx),    db_x86_64_regop },
-       { "rdx",        dbreg(rdx),    db_x86_64_regop },
-       { "rcx",        dbreg(rcx),    db_x86_64_regop },
-       { "rax",        dbreg(rax),    db_x86_64_regop },
-       { "r8",         dbreg(r8),     db_x86_64_regop },
-       { "r9",         dbreg(r9),     db_x86_64_regop },
-       { "r10",        dbreg(r10),    db_x86_64_regop },
-       { "r11",        dbreg(r11),    db_x86_64_regop },
-       { "r12",        dbreg(r12),    db_x86_64_regop },
-       { "r13",        dbreg(r13),    db_x86_64_regop },
-       { "r14",        dbreg(r14),    db_x86_64_regop },
-       { "r15",        dbreg(r15),    db_x86_64_regop },
-       { "rip",        dbreg(rip),    db_x86_64_regop },
-       { "cs",         dbreg(cs),     db_x86_64_regop },
-       { "rflags",     dbreg(rflags), db_x86_64_regop },
-       { "rsp",        dbreg(rsp),    db_x86_64_regop },
-       { "ss",         dbreg(ss),     db_x86_64_regop },
+       { "ds",         dbreg(ds),     db_x86_64_regop, NULL },
+       { "es",         dbreg(es),     db_x86_64_regop, NULL },
+       { "fs",         dbreg(fs),     db_x86_64_regop, NULL },
+       { "gs",         dbreg(gs),     db_x86_64_regop, NULL },
+       { "rdi",        dbreg(rdi),    db_x86_64_regop, NULL },
+       { "rsi",        dbreg(rsi),    db_x86_64_regop, NULL },
+       { "rbp",        dbreg(rbp),    db_x86_64_regop, NULL },
+       { "rbx",        dbreg(rbx),    db_x86_64_regop, NULL },
+       { "rdx",        dbreg(rdx),    db_x86_64_regop, NULL },
+       { "rcx",        dbreg(rcx),    db_x86_64_regop, NULL },
+       { "rax",        dbreg(rax),    db_x86_64_regop, NULL },
+       { "r8",         dbreg(r8),     db_x86_64_regop, NULL },
+       { "r9",         dbreg(r9),     db_x86_64_regop, NULL },
+       { "r10",        dbreg(r10),    db_x86_64_regop, NULL },
+       { "r11",        dbreg(r11),    db_x86_64_regop, NULL },
+       { "r12",        dbreg(r12),    db_x86_64_regop, NULL },
+       { "r13",        dbreg(r13),    db_x86_64_regop, NULL },
+       { "r14",        dbreg(r14),    db_x86_64_regop, NULL },
+       { "r15",        dbreg(r15),    db_x86_64_regop, NULL },
+       { "rip",        dbreg(rip),    db_x86_64_regop, NULL },
+       { "cs",         dbreg(cs),     db_x86_64_regop, NULL },
+       { "rflags",     dbreg(rflags), db_x86_64_regop, NULL },
+       { "rsp",        dbreg(rsp),    db_x86_64_regop, NULL },
+       { "ss",         dbreg(ss),     db_x86_64_regop, NULL },
 };
 const struct db_variable * const db_eregs =
        db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
Index: arch/amd64/amd64/mem.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/mem.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 mem.c
--- arch/amd64/amd64/mem.c      13 Feb 2008 12:48:11 -0000      1.13
+++ arch/amd64/amd64/mem.c      1 Aug 2008 17:44:56 -0000
@@ -108,7 +108,7 @@ dev_type_mmap(mmmmap);

 const struct cdevsw mem_cdevsw = {
        nullopen, nullclose, mmrw, mmrw, mmioctl,
-       nostop, notty, nopoll, mmmmap, nokqfilter
+       nostop, notty, nopoll, mmmmap, nokqfilter, D_OTHER
 };

 int check_pa_acc(paddr_t, vm_prot_t);
Index: arch/xen/include/hypervisor.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/hypervisor.h,v
retrieving revision 1.25
diff -b -u -p -r1.25 hypervisor.h
--- arch/xen/include/hypervisor.h       14 Apr 2008 13:38:03 -0000      1.25
+++ arch/xen/include/hypervisor.h       1 Aug 2008 17:45:12 -0000
@@ -128,7 +128,7 @@ extern union start_info_union start_info
 #define xen_start_info (start_info_union.start_info)

 /* For use in guest OSes. */
-volatile extern shared_info_t *HYPERVISOR_shared_info;
+extern volatile shared_info_t *HYPERVISOR_shared_info;

 /* hypervisor.c */
 struct intrframe;
Index: arch/xen/x86/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/intr.c,v
retrieving revision 1.20
diff -b -u -p -r1.20 intr.c
--- arch/xen/x86/intr.c 3 Jul 2008 14:02:25 -0000       1.20
+++ arch/xen/x86/intr.c 1 Aug 2008 17:45:13 -0000
@@ -131,11 +131,11 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
 #include "ioapic.h"
 #include "opt_mpbios.h"
 /* for x86/i8259.c */
-struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0}};
+struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0,0}};
 #if NIOAPIC > 0
 /* for x86/ioapic.c */
-struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0}};
-struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0}};
+struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
+struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};

 #include <machine/i82093var.h>
 int irq2vect[256] = {0};
Index: arch/xen/x86/x86_xpmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/x86_xpmap.c,v
retrieving revision 1.8
diff -b -u -p -r1.8 x86_xpmap.c
--- arch/xen/x86/x86_xpmap.c    14 Apr 2008 13:38:03 -0000      1.8
+++ arch/xen/x86/x86_xpmap.c    1 Aug 2008 17:45:13 -0000
@@ -819,11 +819,13 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
                                pte[pl1_pi(page)] |= PG_RW;
                        }

-                       if ((page  >= old_pgd && page < old_pgd + (old_count * PAGE_SIZE)) || page >= new_pgd)
+                       if ((page  >= old_pgd && page < old_pgd + (old_count * PAGE_SIZE))
+                           || page >= new_pgd) {
                                __PRINTK(("va 0x%lx pa 0x%lx "
                                    "entry 0x%" PRIx64 " -> L1[0x%x]\n",
                                    page, page - KERNBASE,
                                    (int64_t)pte[pl1_pi(page)], pl1_pi(page)));
+                       }
                        page += PAGE_SIZE;
                }

Index: arch/xen/xen/xenevt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xenevt.c,v
retrieving revision 1.28
diff -b -u -p -r1.28 xenevt.c
--- arch/xen/xen/xenevt.c       7 Jun 2008 20:07:42 -0000       1.28
+++ arch/xen/xen/xenevt.c       1 Aug 2008 17:45:14 -0000
@@ -95,7 +95,7 @@ dev_type_read(xenevtread);
 dev_type_mmap(xenevtmmap);
 const struct cdevsw xenevt_cdevsw = {
        xenevtopen, nullclose, xenevtread, nowrite, noioctl,
-       nostop, notty, nopoll, xenevtmmap, nokqfilter,
+       nostop, notty, nopoll, xenevtmmap, nokqfilter, D_OTHER
 };

 /* minor numbers */
@@ -387,7 +387,7 @@ xenevt_fclose(struct file *fp)
        for (i = 0; i < NR_EVENT_CHANNELS; i++ ) {
                if (devevent[i] == d) {
 #ifdef XEN3
-                       evtchn_op_t op = { 0 };
+                       evtchn_op_t op = { .cmd = 0 };
                        int error;
 #endif
                        hypervisor_mask_event(i);
@@ -519,7 +519,7 @@ xenevt_fioctl(struct file *fp, u_long cm
 {
        struct xenevt_d *d = fp->f_data;
 #ifdef XEN3
-       evtchn_op_t op = { 0 };
+       evtchn_op_t op = { .cmd = 0 };
        int error;
 #else
        u_int *arg = addr;
Index: arch/xen/xen/xengnt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xengnt.c,v
retrieving revision 1.7
diff -b -u -p -r1.7 xengnt.c
--- arch/xen/xen/xengnt.c       27 Apr 2008 19:28:45 -0000      1.7
+++ arch/xen/xen/xengnt.c       1 Aug 2008 17:45:14 -0000
@@ -171,7 +171,7 @@ xengnt_get_entry()
        grant_ref_t entry;
        int s = splvm();
        static struct timeval xengnt_nonmemtime;
-       const static struct timeval xengnt_nonmemintvl = {5,0};
+       static const struct timeval xengnt_nonmemintvl = {5,0};

        if (last_gnt_entry == 0) {
                if (xengnt_more_entries()) {
Index: arch/xen/xenbus/xenbus_client.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_client.c,v
retrieving revision 1.8
diff -b -u -p -r1.8 xenbus_client.c
--- arch/xen/xenbus/xenbus_client.c     15 Dec 2007 00:39:24 -0000      1.8
+++ arch/xen/xenbus/xenbus_client.c     1 Aug 2008 17:45:15 -0000
@@ -241,8 +241,12 @@ xenbus_alloc_evtchn(struct xenbus_device
 {
        evtchn_op_t op = {
                .cmd = EVTCHNOP_alloc_unbound,
-               .u.alloc_unbound.dom = DOMID_SELF,
-               .u.alloc_unbound.remote_dom = dev->xbusd_otherend_id };
+               .u.alloc_unbound = {
+                       .dom = DOMID_SELF,
+                       .remote_dom = dev->xbusd_otherend_id,
+                       .port = 0
+               }
+       };

        int err = HYPERVISOR_event_channel_op(&op);
        if (err)
Index: arch/xen/xenbus/xenbus_probe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_probe.c,v
retrieving revision 1.21
diff -b -u -p -r1.21 xenbus_probe.c
--- arch/xen/xenbus/xenbus_probe.c      2 Jun 2008 20:54:59 -0000       1.21
+++ arch/xen/xenbus/xenbus_probe.c      1 Aug 2008 17:45:15 -0000
@@ -525,7 +525,7 @@ xenbus_probe_init(void *unused)
 #if defined(DOM0OPS)
                vaddr_t page;
                paddr_t ma;
-               evtchn_op_t op = { 0 };
+               evtchn_op_t op = { .cmd = 0 };
                int ret;

                /* Allocate page. */
Index: compat/linux/arch/amd64/linux_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_machdep.c,v
retrieving revision 1.30
diff -b -u -p -r1.30 linux_machdep.c
--- compat/linux/arch/amd64/linux_machdep.c     11 May 2008 17:13:43 -0000      1.30
+++ compat/linux/arch/amd64/linux_machdep.c     1 Aug 2008 17:45:16 -0000
@@ -473,10 +473,10 @@ linux_sys_rt_sigreturn(struct lwp *l, co
         * And the stack
         */
        uctx.uc_stack.ss_flags = 0;
-       if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK);
+       if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK)
                uctx.uc_stack.ss_flags = SS_ONSTACK;

-       if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE);
+       if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE)
                uctx.uc_stack.ss_flags = SS_DISABLE;

        uctx.uc_stack.ss_sp = luctx->luc_stack.ss_sp;
Index: compat/linux32/common/linux32_exec.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_exec.c,v
retrieving revision 1.13
diff -b -u -p -r1.13 linux32_exec.c
--- compat/linux32/common/linux32_exec.c        28 Apr 2008 20:23:44 -0000      1.13
+++ compat/linux32/common/linux32_exec.c        1 Aug 2008 17:45:17 -0000
@@ -116,6 +116,9 @@ const struct emul emul_linux32 = {
        NULL,
        NULL,
        netbsd32_vm_default_addr,
+       NULL,
+       0,
+       NULL
 };

 static void
---------------
END OF PATCHES
---------------

Don't forget to match "x86_64" into the if conditional on Makefile.kern.inc after applying the patch!

>Release-Note:

>Audit-Trail:
From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: kern/39266: NetBSD/amd64 doesn't build with -Wextra
Date: Fri, 01 Aug 2008 14:52:27 -0400

 xtraeme@gmail.com wrote:
 > Index: compat/linux/arch/amd64/linux_machdep.c
 > ===================================================================
 > RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_machdep.c,v
 > retrieving revision 1.30
 > diff -b -u -p -r1.30 linux_machdep.c
 > --- compat/linux/arch/amd64/linux_machdep.c     11 May 2008 17:13:43 -0000      1.30
 > +++ compat/linux/arch/amd64/linux_machdep.c     1 Aug 2008 17:45:16 -0000
 > @@ -473,10 +473,10 @@ linux_sys_rt_sigreturn(struct lwp *l, co
 >          * And the stack
 >          */
 >         uctx.uc_stack.ss_flags = 0;
 > -       if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK);
 > +       if (luctx->luc_stack.ss_flags & LINUX_SS_ONSTACK)
 >                 uctx.uc_stack.ss_flags = SS_ONSTACK;
 >  
 > -       if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE);
 > +       if (luctx->luc_stack.ss_flags & LINUX_SS_DISABLE)
 >                 uctx.uc_stack.ss_flags = SS_DISABLE;
 >  
 >         uctx.uc_stack.ss_sp = luctx->luc_stack.ss_sp;

 A modified version of the above has been checked in. You need to |= the 
 native stack ss_flags as well.

 Cheers,
 Jared

From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/39266: NetBSD/amd64 doesn't build with -Wextra
Date: Fri, 1 Aug 2008 21:31:32 +0200

 2008/8/1 Jared D. McNeill <jmcneill@invisible.ca>:

 >  A modified version of the above has been checked in. You need to |= the
 >  native stack ss_flags as well.

 Good catch.

 My change was only required for -Wextra... glad that this found
 another bug too.

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@NetBSD.org
Responsible-Changed-When: Fri, 05 Sep 2008 11:13:04 +0000
Responsible-Changed-Why:
I'll handle this PR.


State-Changed-From-To: open->feedback
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 05 Sep 2008 11:13:04 +0000
State-Changed-Why:
Your patch doesn't apply anymore unfortunately. Can you please send me an
updated version?


From: Juan RP <xtraeme@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-amd64/39266 (NetBSD/amd64 doesn't build with -Wextra)
Date: Fri, 5 Sep 2008 13:30:06 +0200

 Please apply this one as well (to enable -Wextra):

 Index: Makefile.kern.inc
 ===================================================================
 RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
 retrieving revision 1.115
 diff -b -u -p -r1.115 Makefile.kern.inc
 --- Makefile.kern.inc   5 Sep 2008 11:03:53 -0000       1.115
 +++ Makefile.kern.inc   5 Sep 2008 11:28:35 -0000
 @@ -76,7 +76,8 @@ CWARNFLAGS+=  -Wno-unreachable-code
  CWARNFLAGS+=   -Wno-sign-compare
  . if (defined(HAVE_GCC) && ${HAVE_GCC} > 3) || defined(HAVE_PCC)
  CWARNFLAGS+=   -Wno-pointer-sign -Wno-attributes
 -.  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
 +.  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
 +       ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
  CWARNFLAGS+=   -Wextra -Wno-unused-parameter
  .  endif
  . endif
 ---- END ----

From: Juan RP <xtraeme@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-amd64/39266 (NetBSD/amd64 doesn't build with -Wextra)
Date: Fri, 5 Sep 2008 13:26:07 +0200

 On Fri,  5 Sep 2008 11:13:04 +0000 (UTC)
 tron@NetBSD.org wrote:

 > State-Changed-Why:
 > Your patch doesn't apply anymore unfortunately. Can you please send me an
 > updated version?

 Here's the patch against HEAD:

 Index: arch/amd64/amd64/db_trace.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/amd64/amd64/db_trace.c,v
 retrieving revision 1.13
 diff -b -u -p -r1.13 db_trace.c
 --- arch/amd64/amd64/db_trace.c	2 Jul 2008 19:49:58 -0000	1.13
 +++ arch/amd64/amd64/db_trace.c	5 Sep 2008 11:21:21 -0000
 @@ -52,30 +52,30 @@ static int db_x86_64_regop(const struct 
   * Machine register set.
   */
  const struct db_variable db_regs[] = {
 -	{ "ds",		dbreg(ds),     db_x86_64_regop },
 -	{ "es",		dbreg(es),     db_x86_64_regop },
 -	{ "fs",		dbreg(fs),     db_x86_64_regop },
 -	{ "gs",		dbreg(gs),     db_x86_64_regop },
 -	{ "rdi",	dbreg(rdi),    db_x86_64_regop },
 -	{ "rsi",	dbreg(rsi),    db_x86_64_regop },
 -	{ "rbp",	dbreg(rbp),    db_x86_64_regop },
 -	{ "rbx",	dbreg(rbx),    db_x86_64_regop },
 -	{ "rdx",	dbreg(rdx),    db_x86_64_regop },
 -	{ "rcx",	dbreg(rcx),    db_x86_64_regop },
 -	{ "rax",	dbreg(rax),    db_x86_64_regop },
 -	{ "r8",		dbreg(r8),     db_x86_64_regop },
 -	{ "r9",		dbreg(r9),     db_x86_64_regop },
 -	{ "r10",	dbreg(r10),    db_x86_64_regop },
 -	{ "r11",	dbreg(r11),    db_x86_64_regop },
 -	{ "r12",	dbreg(r12),    db_x86_64_regop },
 -	{ "r13",	dbreg(r13),    db_x86_64_regop },
 -	{ "r14",	dbreg(r14),    db_x86_64_regop },
 -	{ "r15",	dbreg(r15),    db_x86_64_regop },
 -	{ "rip",	dbreg(rip),    db_x86_64_regop },
 -	{ "cs",		dbreg(cs),     db_x86_64_regop },
 -	{ "rflags",	dbreg(rflags), db_x86_64_regop },
 -	{ "rsp",	dbreg(rsp),    db_x86_64_regop },
 -	{ "ss",		dbreg(ss),     db_x86_64_regop },
 +	{ "ds",		dbreg(ds),     db_x86_64_regop, NULL },
 +	{ "es",		dbreg(es),     db_x86_64_regop, NULL },
 +	{ "fs",		dbreg(fs),     db_x86_64_regop, NULL },
 +	{ "gs",		dbreg(gs),     db_x86_64_regop, NULL },
 +	{ "rdi",	dbreg(rdi),    db_x86_64_regop, NULL },
 +	{ "rsi",	dbreg(rsi),    db_x86_64_regop, NULL },
 +	{ "rbp",	dbreg(rbp),    db_x86_64_regop, NULL },
 +	{ "rbx",	dbreg(rbx),    db_x86_64_regop, NULL },
 +	{ "rdx",	dbreg(rdx),    db_x86_64_regop, NULL },
 +	{ "rcx",	dbreg(rcx),    db_x86_64_regop, NULL },
 +	{ "rax",	dbreg(rax),    db_x86_64_regop, NULL },
 +	{ "r8",		dbreg(r8),     db_x86_64_regop, NULL },
 +	{ "r9",		dbreg(r9),     db_x86_64_regop, NULL },
 +	{ "r10",	dbreg(r10),    db_x86_64_regop, NULL },
 +	{ "r11",	dbreg(r11),    db_x86_64_regop, NULL },
 +	{ "r12",	dbreg(r12),    db_x86_64_regop, NULL },
 +	{ "r13",	dbreg(r13),    db_x86_64_regop, NULL },
 +	{ "r14",	dbreg(r14),    db_x86_64_regop, NULL },
 +	{ "r15",	dbreg(r15),    db_x86_64_regop, NULL },
 +	{ "rip",	dbreg(rip),    db_x86_64_regop, NULL },
 +	{ "cs",		dbreg(cs),     db_x86_64_regop, NULL },
 +	{ "rflags",	dbreg(rflags), db_x86_64_regop, NULL },
 +	{ "rsp",	dbreg(rsp),    db_x86_64_regop, NULL },
 +	{ "ss",		dbreg(ss),     db_x86_64_regop, NULL },
  };
  const struct db_variable * const db_eregs =
  	db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 Index: arch/amd64/amd64/mem.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/amd64/amd64/mem.c,v
 retrieving revision 1.13
 diff -b -u -p -r1.13 mem.c
 --- arch/amd64/amd64/mem.c	13 Feb 2008 12:48:11 -0000	1.13
 +++ arch/amd64/amd64/mem.c	5 Sep 2008 11:21:21 -0000
 @@ -108,7 +108,7 @@ dev_type_mmap(mmmmap);

  const struct cdevsw mem_cdevsw = {
  	nullopen, nullclose, mmrw, mmrw, mmioctl,
 -	nostop, notty, nopoll, mmmmap, nokqfilter
 +	nostop, notty, nopoll, mmmmap, nokqfilter, D_OTHER
  };

  int check_pa_acc(paddr_t, vm_prot_t);
 Index: arch/xen/include/hypervisor.h
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/include/hypervisor.h,v
 retrieving revision 1.25
 diff -b -u -p -r1.25 hypervisor.h
 --- arch/xen/include/hypervisor.h	14 Apr 2008 13:38:03 -0000	1.25
 +++ arch/xen/include/hypervisor.h	5 Sep 2008 11:21:43 -0000
 @@ -128,7 +128,7 @@ extern union start_info_union start_info
  #define xen_start_info (start_info_union.start_info)

  /* For use in guest OSes. */
 -volatile extern shared_info_t *HYPERVISOR_shared_info;
 +extern volatile shared_info_t *HYPERVISOR_shared_info;

  /* hypervisor.c */
  struct intrframe;
 Index: arch/xen/x86/intr.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/x86/intr.c,v
 retrieving revision 1.20
 diff -b -u -p -r1.20 intr.c
 --- arch/xen/x86/intr.c	3 Jul 2008 14:02:25 -0000	1.20
 +++ arch/xen/x86/intr.c	5 Sep 2008 11:21:43 -0000
 @@ -131,11 +131,11 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
  #include "ioapic.h"
  #include "opt_mpbios.h"
  /* for x86/i8259.c */
 -struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0}};
 +struct intrstub i8259_stubs[NUM_LEGACY_IRQS] = {{0,0}};
  #if NIOAPIC > 0
  /* for x86/ioapic.c */
 -struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0}};
 -struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0}};
 +struct intrstub ioapic_edge_stubs[MAX_INTR_SOURCES] = {{0,0}};
 +struct intrstub ioapic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};

  #include <machine/i82093var.h>
  int irq2vect[256] = {0};
 Index: arch/xen/x86/x86_xpmap.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/x86/x86_xpmap.c,v
 retrieving revision 1.8
 diff -b -u -p -r1.8 x86_xpmap.c
 --- arch/xen/x86/x86_xpmap.c	14 Apr 2008 13:38:03 -0000	1.8
 +++ arch/xen/x86/x86_xpmap.c	5 Sep 2008 11:21:44 -0000
 @@ -819,11 +819,13 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
  				pte[pl1_pi(page)] |= PG_RW;
  			}

 -			if ((page  >= old_pgd && page < old_pgd + (old_count * PAGE_SIZE)) || page >= new_pgd)
 +			if ((page  >= old_pgd && page < old_pgd + (old_count * PAGE_SIZE))
 +			    || page >= new_pgd) {
  				__PRINTK(("va 0x%lx pa 0x%lx "
  				    "entry 0x%" PRIx64 " -> L1[0x%x]\n",
  				    page, page - KERNBASE,
  				    (int64_t)pte[pl1_pi(page)], pl1_pi(page)));
 +			}
  			page += PAGE_SIZE;
  		}

 Index: arch/xen/xen/xenevt.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/xen/xenevt.c,v
 retrieving revision 1.28
 diff -b -u -p -r1.28 xenevt.c
 --- arch/xen/xen/xenevt.c	7 Jun 2008 20:07:42 -0000	1.28
 +++ arch/xen/xen/xenevt.c	5 Sep 2008 11:21:45 -0000
 @@ -95,7 +95,7 @@ dev_type_read(xenevtread);
  dev_type_mmap(xenevtmmap);
  const struct cdevsw xenevt_cdevsw = {
  	xenevtopen, nullclose, xenevtread, nowrite, noioctl,
 -	nostop, notty, nopoll, xenevtmmap, nokqfilter,
 +	nostop, notty, nopoll, xenevtmmap, nokqfilter, D_OTHER
  };

  /* minor numbers */
 @@ -387,7 +387,7 @@ xenevt_fclose(struct file *fp)
  	for (i = 0; i < NR_EVENT_CHANNELS; i++ ) {
  		if (devevent[i] == d) {
  #ifdef XEN3
 -			evtchn_op_t op = { 0 };
 +			evtchn_op_t op = { .cmd = 0 };
  			int error;
  #endif
  			hypervisor_mask_event(i);
 @@ -519,7 +519,7 @@ xenevt_fioctl(struct file *fp, u_long cm
  {
  	struct xenevt_d *d = fp->f_data;
  #ifdef XEN3
 -	evtchn_op_t op = { 0 };
 +	evtchn_op_t op = { .cmd = 0 };
  	int error;
  #else
  	u_int *arg = addr;
 Index: arch/xen/xen/xengnt.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/xen/xengnt.c,v
 retrieving revision 1.7
 diff -b -u -p -r1.7 xengnt.c
 --- arch/xen/xen/xengnt.c	27 Apr 2008 19:28:45 -0000	1.7
 +++ arch/xen/xen/xengnt.c	5 Sep 2008 11:21:45 -0000
 @@ -171,7 +171,7 @@ xengnt_get_entry()
  	grant_ref_t entry;
  	int s = splvm();
  	static struct timeval xengnt_nonmemtime;
 -	const static struct timeval xengnt_nonmemintvl = {5,0};
 +	static const struct timeval xengnt_nonmemintvl = {5,0};

  	if (last_gnt_entry == 0) {
  		if (xengnt_more_entries()) {
 Index: arch/xen/xenbus/xenbus_client.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_client.c,v
 retrieving revision 1.8
 diff -b -u -p -r1.8 xenbus_client.c
 --- arch/xen/xenbus/xenbus_client.c	15 Dec 2007 00:39:24 -0000	1.8
 +++ arch/xen/xenbus/xenbus_client.c	5 Sep 2008 11:21:45 -0000
 @@ -241,8 +241,12 @@ xenbus_alloc_evtchn(struct xenbus_device
  {
  	evtchn_op_t op = {
  		.cmd = EVTCHNOP_alloc_unbound,
 -		.u.alloc_unbound.dom = DOMID_SELF,
 -		.u.alloc_unbound.remote_dom = dev->xbusd_otherend_id };
 +		.u.alloc_unbound = {
 +			.dom = DOMID_SELF,
 +			.remote_dom = dev->xbusd_otherend_id,
 +			.port = 0
 +		}
 +	};

  	int err = HYPERVISOR_event_channel_op(&op);
  	if (err)
 Index: arch/xen/xenbus/xenbus_probe.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_probe.c,v
 retrieving revision 1.21
 diff -b -u -p -r1.21 xenbus_probe.c
 --- arch/xen/xenbus/xenbus_probe.c	2 Jun 2008 20:54:59 -0000	1.21
 +++ arch/xen/xenbus/xenbus_probe.c	5 Sep 2008 11:21:45 -0000
 @@ -525,7 +525,7 @@ xenbus_probe_init(void *unused)
  #if defined(DOM0OPS)
  		vaddr_t page;
  		paddr_t ma;
 -		evtchn_op_t op = { 0 };
 +		evtchn_op_t op = { .cmd = 0 };
  		int ret;

  		/* Allocate page. */
 Index: compat/linux32/common/linux32_exec.c
 ===================================================================
 RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_exec.c,v
 retrieving revision 1.13
 diff -b -u -p -r1.13 linux32_exec.c
 --- compat/linux32/common/linux32_exec.c	28 Apr 2008 20:23:44 -0000	1.13
 +++ compat/linux32/common/linux32_exec.c	5 Sep 2008 11:21:47 -0000
 @@ -116,6 +116,9 @@ const struct emul emul_linux32 = {
  	NULL,
  	NULL,
  	netbsd32_vm_default_addr,
 +	NULL,
 +	0,
 +	NULL
  };

  static void
 ---- END ----

State-Changed-From-To: feedback->open
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 05 Sep 2008 12:45:11 +0000
State-Changed-Why:
New patch was provided.


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39266 CVS commit: src/sys
Date: Fri,  5 Sep 2008 13:37:25 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Fri Sep  5 13:37:25 UTC 2008

 Modified Files:
 	src/sys/arch/amd64/amd64: db_trace.c mem.c
 	src/sys/arch/xen/include: hypervisor.h
 	src/sys/arch/xen/x86: intr.c x86_xpmap.c
 	src/sys/arch/xen/xen: xenevt.c xengnt.c
 	src/sys/arch/xen/xenbus: xenbus_client.c xenbus_probe.c
 	src/sys/compat/linux32/common: linux32_exec.c
 	src/sys/conf: Makefile.kern.inc

 Log Message:
 Compile NetBSD/amd64 kernels with "-Wextra". Patches contributed by
 Juan RP in PR port-amd64/39266.


 To generate a diff of this commit:
 cvs rdiff -r1.13 -r1.14 src/sys/arch/amd64/amd64/db_trace.c \
     src/sys/arch/amd64/amd64/mem.c
 cvs rdiff -r1.25 -r1.26 src/sys/arch/xen/include/hypervisor.h
 cvs rdiff -r1.20 -r1.21 src/sys/arch/xen/x86/intr.c
 cvs rdiff -r1.8 -r1.9 src/sys/arch/xen/x86/x86_xpmap.c
 cvs rdiff -r1.28 -r1.29 src/sys/arch/xen/xen/xenevt.c
 cvs rdiff -r1.7 -r1.8 src/sys/arch/xen/xen/xengnt.c
 cvs rdiff -r1.8 -r1.9 src/sys/arch/xen/xenbus/xenbus_client.c
 cvs rdiff -r1.21 -r1.22 src/sys/arch/xen/xenbus/xenbus_probe.c
 cvs rdiff -r1.13 -r1.14 src/sys/compat/linux32/common/linux32_exec.c
 cvs rdiff -r1.115 -r1.116 src/sys/conf/Makefile.kern.inc

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 05 Sep 2008 13:41:44 +0000
State-Changed-Why:
I've committed your changes. Thanks a lot for the contribution.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.