Module Name: src Committed By: chs Date: Sat Oct 1 15:59:01 UTC 2011
Modified Files: src/sys/arch/atari/include: disklabel.h src/sys/arch/atari/stand/edahdi: edahdi.c src/sys/arch/atari/stand/installboot: disklabel.c src/sys/arch/atari/stand/tostools/aptck: ahdilbl.h src/sys/arch/atari/stand/tostools/libtos: ahdilbl.h elf.c src/sys/arch/atari/vme: if_we_vme.c src/sys/arch/next68k/next68k: nextrom.c src/sys/arch/x68k/stand/mboot: mboot.c src/sys/dev/ic: clmpcc.c Log Message: fix build errors with gcc 4.5. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/atari/include/disklabel.h cvs rdiff -u -r1.10 -r1.11 src/sys/arch/atari/stand/edahdi/edahdi.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/atari/stand/installboot/disklabel.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/atari/stand/tostools/libtos/elf.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/atari/vme/if_we_vme.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/next68k/next68k/nextrom.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/mboot/mboot.c cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/clmpcc.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/atari/include/disklabel.h diff -u src/sys/arch/atari/include/disklabel.h:1.9 src/sys/arch/atari/include/disklabel.h:1.10 --- src/sys/arch/atari/include/disklabel.h:1.9 Tue Aug 30 12:39:53 2011 +++ src/sys/arch/atari/include/disklabel.h Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.h,v 1.9 2011/08/30 12:39:53 bouyer Exp $ */ +/* $NetBSD: disklabel.h,v 1.10 2011/10/01 15:59:00 chs Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -71,7 +71,7 @@ struct bootblock { }; struct disklabel; -#define BBGETLABEL(bb, dl) *(dl) = *((struct disklabel *)(bb)->bb_label) -#define BBSETLABEL(bb, dl) *((struct disklabel *)(bb)->bb_label) = *(dl) +#define BBGETLABEL(bb, dl) memcpy((dl), (bb)->bb_label, sizeof (struct disklabel)) +#define BBSETLABEL(bb, dl) memcpy((bb)->bb_label, (dl), sizeof (struct disklabel)) #endif /* _MACHINE_DISKLABEL_H_ */ Index: src/sys/arch/atari/stand/edahdi/edahdi.c diff -u src/sys/arch/atari/stand/edahdi/edahdi.c:1.10 src/sys/arch/atari/stand/edahdi/edahdi.c:1.11 --- src/sys/arch/atari/stand/edahdi/edahdi.c:1.10 Wed Feb 10 14:48:26 2010 +++ src/sys/arch/atari/stand/edahdi/edahdi.c Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edahdi.c,v 1.10 2010/02/10 14:48:26 roy Exp $ */ +/* $NetBSD: edahdi.c,v 1.11 2011/10/01 15:59:00 chs Exp $ */ /* * Copyright (c) 1996 Leo Weppelman, Waldi Ravens. @@ -413,7 +413,9 @@ ahdi_getparts(fd, ptable, rsec, esec) end = &root->ar_parts[AHDI_MAXRPD]; else end = &root->ar_parts[AHDI_MAXARPD]; for (part = root->ar_parts; part < end; ++part) { - u_int id = *((u_int32_t *)&part->ap_flg); + u_int id; + + memcpy(&id, &part->ap_flg, sizeof (id)); if (!(id & 0x01000000)) continue; if ((id &= 0x00ffffff) == AHDI_PID_XGM) { @@ -433,7 +435,7 @@ ahdi_getparts(fd, ptable, rsec, esec) goto done; } p = &ptable->parts[--i]; - *((u_int32_t *)&p->id) = id << 8; + memcpy(&p->id, &id, sizeof (id)); p->start = part->ap_st + rsec; p->end = p->start + part->ap_size - 1; p->rsec = rsec; Index: src/sys/arch/atari/stand/installboot/disklabel.c diff -u src/sys/arch/atari/stand/installboot/disklabel.c:1.5 src/sys/arch/atari/stand/installboot/disklabel.c:1.6 --- src/sys/arch/atari/stand/installboot/disklabel.c:1.5 Sat Mar 14 21:04:07 2009 +++ src/sys/arch/atari/stand/installboot/disklabel.c Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.5 2009/03/14 21:04:07 dsl Exp $ */ +/* $NetBSD: disklabel.c,v 1.6 2011/10/01 15:59:00 chs Exp $ */ /* * Copyright (c) 1995 Waldi Ravens @@ -173,8 +173,9 @@ ahdi_label (int fd, u_int32_t *bbsec, st */ for (i = 0; i < al.nparts; ++i) { struct ahdi_part *pd = &al.parts[i]; - u_int id = *((u_int32_t *)&pd->ap_flg); + u_int id; + memcpy(&id, &pd->ap_flg, sizeof (id)); if (id == AHDI_PID_NBD || id == AHDI_PID_RAW) { off_t offs = pd->ap_st * AHDI_BSIZE; if ((e = bsd_label(fd, offs, label)) < 0) @@ -214,7 +215,9 @@ ahdi_getparts(fd, rsec, esec, alab) end = &root.ar_parts[AHDI_MAXRPD]; else end = &root.ar_parts[AHDI_MAXARPD]; for (part = root.ar_parts; part < end; ++part) { - u_int id = *((u_int32_t *)&part->ap_flg); + u_int id; + + memcpy(&id, &part->ap_flg, sizeof (id)); if (!(id & 0x01000000)) continue; if ((id &= 0x00ffffff) == AHDI_PID_XGM) { @@ -232,7 +235,7 @@ ahdi_getparts(fd, rsec, esec, alab) alab->parts = realloc(alab->parts, (alab->nparts + 1) * sizeof(*alab->parts)); p = &alab->parts[alab->nparts++]; - *((u_int32_t *)&p->ap_flg) = id; + memcpy(&p->ap_flg, &id, sizeof (id)); p->ap_st = part->ap_st + rsec; p->ap_end = p->ap_st + part->ap_size - 1; } Index: src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h diff -u src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h:1.4 src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h:1.5 --- src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h:1.4 Tue Oct 20 19:10:11 2009 +++ src/sys/arch/atari/stand/tostools/aptck/ahdilbl.h Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ahdilbl.h,v 1.4 2009/10/20 19:10:11 snj Exp $ */ +/* $NetBSD: ahdilbl.h,v 1.5 2011/10/01 15:59:00 chs Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -60,8 +60,8 @@ struct bootblock { /* second-stage boot loader*/ }; -#define BBGETLABEL(bb, dl) *(dl) = *((struct disklabel *)(bb)->bb_label) -#define BBSETLABEL(bb, dl) *((struct disklabel *)(bb)->bb_label) = *(dl) +#define BBGETLABEL(bb, dl) memcpy((dl), (bb)->bb_label, sizeof (struct disklabel)) +#define BBSETLABEL(bb, dl) memcpy((bb)->bb_label, (dl), sizeof (struct disklabel)) /***** from src/sys/arch/atari/include/ahdilabel.h *************************/ Index: src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h diff -u src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h:1.3 src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h:1.4 --- src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h:1.3 Tue Oct 20 19:10:11 2009 +++ src/sys/arch/atari/stand/tostools/libtos/ahdilbl.h Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ahdilbl.h,v 1.3 2009/10/20 19:10:11 snj Exp $ */ +/* $NetBSD: ahdilbl.h,v 1.4 2011/10/01 15:59:00 chs Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -60,8 +60,8 @@ struct bootblock { /* second-stage boot loader*/ }; -#define BBGETLABEL(bb, dl) *(dl) = *((struct disklabel *)(bb)->bb_label) -#define BBSETLABEL(bb, dl) *((struct disklabel *)(bb)->bb_label) = *(dl) +#define BBGETLABEL(bb, dl) memcpy((dl), (bb)->bb_label, sizeof (struct disklabel)) +#define BBSETLABEL(bb, dl) memcpy((bb)->bb_label, (dl), sizeof (struct disklabel)) /***** from src/sys/arch/atari/include/ahdilabel.h *************************/ Index: src/sys/arch/atari/stand/tostools/libtos/elf.c diff -u src/sys/arch/atari/stand/tostools/libtos/elf.c:1.13 src/sys/arch/atari/stand/tostools/libtos/elf.c:1.14 --- src/sys/arch/atari/stand/tostools/libtos/elf.c:1.13 Tue Mar 31 11:48:15 2009 +++ src/sys/arch/atari/stand/tostools/libtos/elf.c Sat Oct 1 15:59:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.c,v 1.13 2009/03/31 11:48:15 tsutsui Exp $ */ +/* $NetBSD: elf.c,v 1.14 2011/10/01 15:59:00 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ elf_load(int fd, osdsc_t *od, char **err int err; Elf32_Ehdr ehdr; Elf32_Phdr *phdrs; - Elf32_Word symsize, symstart; + Elf32_Word ident, symsize, symstart; long kernsize; *errp = NULL; @@ -79,7 +79,8 @@ elf_load(int fd, osdsc_t *od, char **err if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) return -1; - if (*((u_int *)ehdr.e_ident) != ELFMAGIC) + memcpy(&ident, ehdr.e_ident, sizeof ident); + if (ident != ELFMAGIC) return -1; /* Index: src/sys/arch/atari/vme/if_we_vme.c diff -u src/sys/arch/atari/vme/if_we_vme.c:1.2 src/sys/arch/atari/vme/if_we_vme.c:1.3 --- src/sys/arch/atari/vme/if_we_vme.c:1.2 Tue Mar 16 18:50:14 2010 +++ src/sys/arch/atari/vme/if_we_vme.c Sat Oct 1 15:59:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_we_vme.c,v 1.2 2010/03/16 18:50:14 tsutsui Exp $ */ +/* $NetBSD: if_we_vme.c,v 1.3 2011/10/01 15:59:01 chs Exp $ */ /*- * Copyright (c) 1997, 1998, 2010 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_we_vme.c,v 1.2 2010/03/16 18:50:14 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_we_vme.c,v 1.3 2011/10/01 15:59:01 chs Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -132,7 +132,7 @@ we_vme_probe(device_t parent, cfdata_t c struct atari_bus_space t; bus_space_tag_t asict, memt; bus_space_handle_t asich, asich1, memh; - bus_size_t memsize; + bus_size_t memsize = 0; bool asich_valid, asich1_valid, memh_valid; int i, rv; uint8_t sum, reg, type, hwr; Index: src/sys/arch/next68k/next68k/nextrom.c diff -u src/sys/arch/next68k/next68k/nextrom.c:1.21 src/sys/arch/next68k/next68k/nextrom.c:1.22 --- src/sys/arch/next68k/next68k/nextrom.c:1.21 Sat Apr 24 19:58:13 2010 +++ src/sys/arch/next68k/next68k/nextrom.c Sat Oct 1 15:59:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nextrom.c,v 1.21 2010/04/24 19:58:13 dbj Exp $ */ +/* $NetBSD: nextrom.c,v 1.22 2011/10/01 15:59:01 chs Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.21 2010/04/24 19:58:13 dbj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.22 2011/10/01 15:59:01 chs Exp $"); #include "opt_ddb.h" #include "opt_serial.h" @@ -93,9 +93,9 @@ static char romprint_hextable[] = "01234 #define ROM_PUTX(v) \ do { \ (*MONRELOC(putcptr,MG_putc)) \ - ((romprint_hextable+NEXT_RAMBASE)[((v)>>4)&0xf]); \ + (RELOC(romprint_hextable, const char *)[((v)>>4)&0xf]); \ (*MONRELOC(putcptr,MG_putc)) \ - ((romprint_hextable+NEXT_RAMBASE)[(v)&0xf]); \ + (RELOC(romprint_hextable, const char *)[(v)&0xf]); \ } while(0); #else #define lookup_hex(v) ((v)>9?('a'+(v)-0xa):('0'+(v))) Index: src/sys/arch/x68k/stand/mboot/mboot.c diff -u src/sys/arch/x68k/stand/mboot/mboot.c:1.8 src/sys/arch/x68k/stand/mboot/mboot.c:1.9 --- src/sys/arch/x68k/stand/mboot/mboot.c:1.8 Sat Mar 14 15:36:15 2009 +++ src/sys/arch/x68k/stand/mboot/mboot.c Sat Oct 1 15:59:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mboot.c,v 1.8 2009/03/14 15:36:15 dsl Exp $ */ +/* $NetBSD: mboot.c,v 1.9 2011/10/01 15:59:01 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -162,12 +162,14 @@ bootmain(int scsiid) { struct cpu_disklabel *label = (void*) 0x3000; int i, firstinuse=-1; + unsigned char *t; if (IOCS_S_READ(2<<(2-size), size?2:1, scsiid, size, label) < 0) { IOCS_B_PRINT("Error in reading.\r\n"); return 0; } - if (*((long*) &label->dosparts[0].dp_typname) != 0x5836384b) { + t = label->dosparts[0].dp_typname; + if (t[0] != 'X' || t[1] != '6' || t[2] != '8' || t[3] != 'K') { IOCS_B_PRINT("Invalid disk.\r\n"); return 0; } Index: src/sys/dev/ic/clmpcc.c diff -u src/sys/dev/ic/clmpcc.c:1.44 src/sys/dev/ic/clmpcc.c:1.45 --- src/sys/dev/ic/clmpcc.c:1.44 Sun Apr 24 16:26:59 2011 +++ src/sys/dev/ic/clmpcc.c Sat Oct 1 15:59:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: clmpcc.c,v 1.44 2011/04/24 16:26:59 rmind Exp $ */ +/* $NetBSD: clmpcc.c,v 1.45 2011/10/01 15:59:01 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.44 2011/04/24 16:26:59 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.45 2011/10/01 15:59:01 chs Exp $"); #include "opt_ddb.h" @@ -795,8 +795,8 @@ clmpcc_param(struct tty *tp, struct term struct clmpcc_chan *ch = &sc->sc_chans[CLMPCCCHAN(tp->t_dev)]; u_char cor; u_char oldch; - int oclk, obpr; - int iclk, ibpr; + int oclk = 0, obpr = 0; + int iclk = 0, ibpr = 0; int s; /* Check requested parameters. */