Module Name: src Committed By: mrg Date: Wed Nov 6 20:19:03 UTC 2013
Modified Files: src/sys/arch/x86/x86: i8259.c mpbios.c pmap.c Log Message: gcc 4.8 issues: - avoid running over the end of an array (this is a real bug, but i didn't really look closely at what memory is clobbered. it may not actually matter.) - move variables inside their #if usage. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/i8259.c cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x86/x86/mpbios.c cvs rdiff -u -r1.180 -r1.181 src/sys/arch/x86/x86/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/i8259.c diff -u src/sys/arch/x86/x86/i8259.c:1.15 src/sys/arch/x86/x86/i8259.c:1.16 --- src/sys/arch/x86/x86/i8259.c:1.15 Thu Dec 18 12:18:20 2008 +++ src/sys/arch/x86/x86/i8259.c Wed Nov 6 20:19:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: i8259.c,v 1.15 2008/12/18 12:18:20 cegger Exp $ */ +/* $NetBSD: i8259.c,v 1.16 2013/11/06 20:19:03 mrg Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.15 2008/12/18 12:18:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.16 2013/11/06 20:19:03 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -233,9 +233,11 @@ i8259_reinit_irqs(void) { int irqs, irq; struct cpu_info *ci = &cpu_info_primary; + const size_t array_len = MIN(__arraycount(ci->ci_isources), + NUM_LEGACY_IRQS); irqs = 0; - for (irq = 0; irq < NUM_LEGACY_IRQS; irq++) + for (irq = 0; irq < array_len; irq++) if (ci->ci_isources[irq] != NULL) irqs |= 1 << irq; if (irqs >= 0x100) /* any IRQs >= 8 in use */ Index: src/sys/arch/x86/x86/mpbios.c diff -u src/sys/arch/x86/x86/mpbios.c:1.61 src/sys/arch/x86/x86/mpbios.c:1.62 --- src/sys/arch/x86/x86/mpbios.c:1.61 Wed Aug 21 16:37:31 2013 +++ src/sys/arch/x86/x86/mpbios.c Wed Nov 6 20:19:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mpbios.c,v 1.61 2013/08/21 16:37:31 christos Exp $ */ +/* $NetBSD: mpbios.c,v 1.62 2013/11/06 20:19:03 mrg Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.61 2013/08/21 16:37:31 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.62 2013/11/06 20:19:03 mrg Exp $"); #include "acpica.h" #include "lapic.h" @@ -552,7 +552,9 @@ mpbios_scan(device_t self, int *ncpup) int count; int type; int intr_cnt, cur_intr; +#if NLAPIC > 0 paddr_t lapic_base; +#endif const struct dflt_conf_entry *dflt_conf; const int *dflt_bus_irq; const struct mpbios_int *iep; @@ -580,11 +582,11 @@ mpbios_scan(device_t self, int *ncpup) #if NACPICA > 0 if (mpacpi_ncpu == 0) { #endif +#if NLAPIC > 0 lapic_base = LAPIC_BASE; if (mp_cth != NULL) lapic_base = (paddr_t)mp_cth->apic_address; -#if NLAPIC > 0 lapic_boot_init(lapic_base); #endif #if NACPICA > 0 Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.180 src/sys/arch/x86/x86/pmap.c:1.181 --- src/sys/arch/x86/x86/pmap.c:1.180 Sat Oct 5 16:50:31 2013 +++ src/sys/arch/x86/x86/pmap.c Wed Nov 6 20:19:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.180 2013/10/05 16:50:31 rmind Exp $ */ +/* $NetBSD: pmap.c,v 1.181 2013/11/06 20:19:03 mrg Exp $ */ /*- * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.180 2013/10/05 16:50:31 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181 2013/11/06 20:19:03 mrg Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -505,8 +505,8 @@ extern int mem_cluster_cnt; #define PTESLEW(pte, id) ((pte)+(id)*NPTECL) #define VASLEW(va,id) ((va)+(id)*NPTECL*PAGE_SIZE) #else -#define PTESLEW(pte, id) (pte) -#define VASLEW(va,id) (va) +#define PTESLEW(pte, id) ((void)id, pte) +#define VASLEW(va,id) ((void)id, va) #endif /* @@ -4220,9 +4220,10 @@ pmap_growkernel(vaddr_t maxkvaddr) struct pmap *kpm = pmap_kernel(); #if !defined(XEN) || !defined(__x86_64__) struct pmap *pm; + long old; #endif int s, i; - long needed_kptp[PTP_LEVELS], target_nptp, old; + long needed_kptp[PTP_LEVELS], target_nptp; bool invalidate = false; s = splvm(); /* to be safe */ @@ -4235,7 +4236,10 @@ pmap_growkernel(vaddr_t maxkvaddr) } maxkvaddr = x86_round_pdr(maxkvaddr); +#if !defined(XEN) || !defined(__x86_64__) old = nkptp[PTP_LEVELS - 1]; +#endif + /* * This loop could be optimized more, but pmap_growkernel() * is called infrequently.