Adapt to -Wcast-qual and -Wshadow by adding const and renaming a

few local variables.  One problem remains which makes this not
build related to the initial assignment of reloc_elfmag, where the
portmaster's opinion has been sought.
This commit is contained in:
he 2005-06-05 11:34:12 +00:00
parent 6082beaaf9
commit 0c68b63d19
1 changed files with 52 additions and 52 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextrom.c,v 1.17 2005/01/19 01:58:21 chs Exp $ */
/* $NetBSD: nextrom.c,v 1.18 2005/06/05 11:34:12 he Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.17 2005/01/19 01:58:21 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.18 2005/06/05 11:34:12 he Exp $");
#include "opt_ddb.h"
#include "opt_serial.h"
@ -87,7 +87,7 @@ typedef int (*putcptr)(int);
#define ROM_PUTC(c) \
(*MONRELOC(putcptr,MG_putc))(c)
#define ROM_PUTS(xs) \
do { volatile char *_s = xs + NEXT_RAMBASE; \
do { volatile const char *_s = xs + NEXT_RAMBASE; \
while(_s && *_s) (*MONRELOC(putcptr,MG_putc))(*_s++); \
} while(0)
@ -226,9 +226,9 @@ next68k_bootargs(unsigned char **args)
u_int msize16;
u_int msize4;
u_int msize1;
int i;
int ix;
int j = 0;
char machine;
char mach;
if (MONRELOC(char,MG_machine_type) == NeXT_X15) {
msize16 = 0x1000000;
@ -262,38 +262,38 @@ next68k_bootargs(unsigned char **args)
ROM_PUTS("Unrecognized machine_type\r\n");
}
machine = MONRELOC(char, MG_machine_type);
RELOC(rom_machine_type, char) = machine;
if (machine == NeXT_TURBO_MONO || machine == NeXT_TURBO_COLOR)
mach = MONRELOC(char, MG_machine_type);
RELOC(rom_machine_type, char) = mach;
if (mach == NeXT_TURBO_MONO || mach == NeXT_TURBO_COLOR)
RELOC(turbo, int) = 1;
else
RELOC(turbo, int) = 0;
for (i=0;i<N_SIMM;i++) {
for (ix=0;ix<N_SIMM;ix++) {
ROM_PUTS("Memory bank 0x");
ROM_PUTX(i);
ROM_PUTX(ix);
ROM_PUTS(" has value 0x");
ROM_PUTX(MONRELOC(char,MG_simm+i))
ROM_PUTX(MONRELOC(char,MG_simm+ix))
ROM_PUTS("\r\n");
if ((MONRELOC(char,MG_simm+i) & SIMM_SIZE) != SIMM_SIZE_EMPTY) {
if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) != SIMM_SIZE_EMPTY) {
RELOC(phys_seg_list[j].ps_start, vm_offset_t)
= NEXT_RAMBASE+(i*msize16);
= NEXT_RAMBASE+(ix*msize16);
}
if ((MONRELOC(char,MG_simm+i) & SIMM_SIZE) == SIMM_SIZE_16MB) {
if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_16MB) {
RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
msize16;
j++;
}
if ((MONRELOC(char,MG_simm+i) & SIMM_SIZE) == SIMM_SIZE_4MB) {
if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_4MB) {
RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
msize4;
j++;
}
if ((MONRELOC(char,MG_simm+i) & SIMM_SIZE) == SIMM_SIZE_1MB) {
if ((MONRELOC(char,MG_simm+ix) & SIMM_SIZE) == SIMM_SIZE_1MB) {
RELOC(phys_seg_list[j].ps_end, vm_offset_t) =
RELOC(phys_seg_list[j].ps_start, vm_offset_t) +
msize1;
@ -315,19 +315,19 @@ next68k_bootargs(unsigned char **args)
}
{
int i;
int j;
ROM_PUTS("Memory segments found:\r\n");
for (i=0;RELOC(phys_seg_list[i].ps_start, vm_offset_t);i++) {
for (j=0;RELOC(phys_seg_list[j].ps_start, vm_offset_t);j++) {
ROM_PUTS("\t0x");
ROM_PUTX((RELOC(phys_seg_list[i].ps_start, vm_offset_t)>>24)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_start, vm_offset_t)>>16)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_start, vm_offset_t)>>8)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_start, vm_offset_t)>>0)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>24)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>16)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>8)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_start, vm_offset_t)>>0)&0xff);
ROM_PUTS(" - 0x");
ROM_PUTX((RELOC(phys_seg_list[i].ps_end, vm_offset_t)>>24)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_end, vm_offset_t)>>16)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_end, vm_offset_t)>>8)&0xff);
ROM_PUTX((RELOC(phys_seg_list[i].ps_end, vm_offset_t)>>0)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_end, vm_offset_t)>>24)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_end, vm_offset_t)>>16)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_end, vm_offset_t)>>8)&0xff);
ROM_PUTX((RELOC(phys_seg_list[j].ps_end, vm_offset_t)>>0)&0xff);
ROM_PUTS("\r\n");
}
}
@ -336,12 +336,12 @@ next68k_bootargs(unsigned char **args)
* in device driver somehow.
*/
{
int i;
int j;
ROM_PUTS("Ethernet address: ");
for(i=0;i<6;i++) {
RELOC(rom_enetaddr[i], u_char) = MONRELOC(u_char *, MG_clientetheraddr)[i];
ROM_PUTX(RELOC(rom_enetaddr[i],u_char));
if (i < 5) ROM_PUTS(":");
for(j=0;j<6;j++) {
RELOC(rom_enetaddr[j], u_char) = MONRELOC(u_char *, MG_clientetheraddr)[j];
ROM_PUTX(RELOC(rom_enetaddr[j],u_char));
if (j < 5) ROM_PUTS(":");
}
ROM_PUTS("\r\n");
}
@ -349,40 +349,40 @@ next68k_bootargs(unsigned char **args)
/* Read the boot args
*/
{
int i;
for(i=0;i<sizeof(rom_bootfile);i++) {
RELOC(rom_bootfile[i], u_char) = MONRELOC(u_char, MG_bootfile+i);
int j;
for(j=0;j<sizeof(rom_bootfile);j++) {
RELOC(rom_bootfile[j], u_char) = MONRELOC(u_char, MG_bootfile+j);
}
ROM_PUTS("rom bootdev: ");
for(i=0;i<sizeof(rom_boot_dev);i++) {
RELOC(rom_boot_dev[i], u_char) = MONRELOC(u_char *, MG_boot_dev)[i];
ROM_PUTC(RELOC(rom_boot_dev[i], u_char));
if (MONRELOC(u_char *, MG_boot_dev)[i] == '\0') break;
for(j=0;j<sizeof(rom_boot_dev);j++) {
RELOC(rom_boot_dev[j], u_char) = MONRELOC(u_char *, MG_boot_dev)[j];
ROM_PUTC(RELOC(rom_boot_dev[j], u_char));
if (MONRELOC(u_char *, MG_boot_dev)[j] == '\0') break;
}
RELOC(rom_boot_dev[sizeof(rom_boot_dev)-1], u_char) = 0;
ROM_PUTS("\r\nrom bootarg: ");
for(i=0;i<sizeof(rom_boot_arg);i++) {
RELOC(rom_boot_arg[i], u_char) = MONRELOC(u_char *, MG_boot_arg)[i];
ROM_PUTC(RELOC(rom_boot_arg[i], u_char));
if (MONRELOC(u_char *, MG_boot_arg)[i] == '\0') break;
for(j=0;j<sizeof(rom_boot_arg);j++) {
RELOC(rom_boot_arg[j], u_char) = MONRELOC(u_char *, MG_boot_arg)[j];
ROM_PUTC(RELOC(rom_boot_arg[j], u_char));
if (MONRELOC(u_char *, MG_boot_arg)[j] == '\0') break;
}
RELOC(rom_boot_arg[sizeof(rom_boot_arg)-1], u_char) = 0;
ROM_PUTS("\r\nrom bootinfo: ");
for(i=0;i<sizeof(rom_boot_info);i++) {
RELOC(rom_boot_info[i], u_char) = MONRELOC(u_char *, MG_boot_info)[i];
ROM_PUTC(RELOC(rom_boot_info[i], u_char));
if (MONRELOC(u_char *, MG_boot_info)[i] == '\0') break;
for(j=0;j<sizeof(rom_boot_info);j++) {
RELOC(rom_boot_info[j], u_char) = MONRELOC(u_char *, MG_boot_info)[j];
ROM_PUTC(RELOC(rom_boot_info[j], u_char));
if (MONRELOC(u_char *, MG_boot_info)[j] == '\0') break;
}
RELOC(rom_boot_info[sizeof(rom_boot_info)-1], u_char) = 0;
ROM_PUTS("\r\nrom bootfile: ");
for(i=0;i<sizeof(rom_boot_file);i++) {
RELOC(rom_boot_file[i], u_char) = MONRELOC(u_char *, MG_boot_file)[i];
ROM_PUTC(RELOC(rom_boot_file[i], u_char));
if (MONRELOC(u_char *, MG_boot_file)[i] == '\0') break;
for(j=0;j<sizeof(rom_boot_file);j++) {
RELOC(rom_boot_file[j], u_char) = MONRELOC(u_char *, MG_boot_file)[j];
ROM_PUTC(RELOC(rom_boot_file[j], u_char));
if (MONRELOC(u_char *, MG_boot_file)[j] == '\0') break;
}
RELOC(rom_boot_file[sizeof(rom_boot_file)-1], u_char) = 0;
ROM_PUTS("\r\n");
@ -391,8 +391,8 @@ next68k_bootargs(unsigned char **args)
RELOC(rom_vbr, u_int) = MONRELOC(u_int, MG_vbr);
RELOC(rom_reboot_vect, paddr_t) = MONRELOC(paddr_t *, MG_vbr)[45]; /* trap #13 */
for(i=0;i<sizeof(rom_image);i++) {
RELOC(rom_image[i], u_char) = *(u_char *)(RELOC(rom_image_base, vm_offset_t) + i);
for(j=0;j<sizeof(rom_image);j++) {
RELOC(rom_image[j], u_char) = *(u_char *)(RELOC(rom_image_base, vm_offset_t) + j);
}
}