Subject: Trying to fix -current amd64 kernel compilation failures
To: NetBSD current <current-users@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 06/01/2005 13:54:54
--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
While trying to upgrade my -current amd64 workstation, i just got hit
by the recent shadow/cast compilation flags change.
I tried to fix some of them (attached for review), but some remains :
sys/kern/kern_lock.c
declaration of `cpu_id' shadows a global declaration in
`machine/cpu.h'
sys/arch/amd64/amd64/pmap.c
declaration of `pdes' shadows a global declaration in
`machine/pmap.h'
sys/arch/amd64/amd64/netbsd32_machdep.c
cast discards qualifiers from pointer target type
Help is welcome.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netbsd-kernconst.diff"
Index: sys/arch/amd64/amd64/db_disasm.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/db_disasm.c,v
retrieving revision 1.2
diff -u -r1.2 db_disasm.c
--- sys/arch/amd64/amd64/db_disasm.c 1 Mar 2005 18:08:42 -0000 1.2
+++ sys/arch/amd64/amd64/db_disasm.c 1 Jun 2005 11:50:26 -0000
@@ -109,11 +109,11 @@
#define Ed 35 /* address, double size */
struct inst {
- char * i_name; /* name */
+ const char *i_name; /* name */
short i_has_modrm; /* has regmodrm byte */
short i_size; /* operand size */
int i_mode; /* addressing modes */
- char * i_extra; /* pointer to extra opcode table */
+ const char *i_extra; /* pointer to extra opcode table */
};
#define op1(x) (x)
@@ -121,10 +121,10 @@
#define op3(x,y,z) ((x)|((y)<<8)|((z)<<16))
struct finst {
- char * f_name; /* name for memory instruction */
+ const char *f_name; /* name for memory instruction */
int f_size; /* size for memory instruction */
int f_rrmode; /* mode for rr instruction */
- char * f_rrname; /* name for rr instruction
+ const char *f_rrname; /* name for rr instruction
(or pointer to table) */
};
@@ -173,8 +173,8 @@
};
const struct inst db_inst_0f0x[] = {
-/*00*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp6 },
-/*01*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp7 },
+/*00*/ { "", TRUE, NONE, op1(Ew), (const char *)db_Grp6 },
+/*01*/ { "", TRUE, NONE, op1(Ew), (const char *)db_Grp7 },
/*02*/ { "lar", TRUE, LONG, op2(E,R), 0 },
/*03*/ { "lsl", TRUE, LONG, op2(E,R), 0 },
/*04*/ { "", FALSE, NONE, 0, 0 },
@@ -304,7 +304,7 @@
/*b8*/ { "", FALSE, NONE, 0, 0 },
/*b9*/ { "", FALSE, NONE, 0, 0 },
-/*ba*/ { "", TRUE, LONG, op2(Ib, E), (char *)db_Grp8 },
+/*ba*/ { "", TRUE, LONG, op2(Ib, E), (const char *)db_Grp8 },
/*bb*/ { "btc", TRUE, LONG, op2(R, E), 0 },
/*bc*/ { "bsf", TRUE, LONG, op2(E, R), 0 },
/*bd*/ { "bsr", TRUE, LONG, op2(E, R), 0 },
@@ -320,7 +320,7 @@
/*c4*/ { "", FALSE, NONE, 0, 0 },
/*c5*/ { "", FALSE, NONE, 0, 0 },
/*c6*/ { "", FALSE, NONE, 0, 0 },
-/*c7*/ { "", TRUE, NONE, op1(E), (char *)db_Grp9 },
+/*c7*/ { "", TRUE, NONE, op1(E), (const char *)db_Grp9 },
/*c8*/ { "bswap", FALSE, LONG, op1(Ri), 0 },
/*c9*/ { "bswap", FALSE, LONG, op1(Ri), 0 },
/*ca*/ { "bswap", FALSE, LONG, op1(Ri), 0 },
@@ -400,12 +400,12 @@
const struct finst db_Esc9[] = {
/*0*/ { "fld", SNGL, op1(STI), 0 },
/*1*/ { "", NONE, op1(STI), "fxch" },
-/*2*/ { "fst", SNGL, op1(X), (char *)db_Esc92 },
-/*3*/ { "fstp", SNGL, op1(X), (char *)db_Esc93 },
-/*4*/ { "fldenv", NONE, op1(X), (char *)db_Esc94 },
-/*5*/ { "fldcw", NONE, op1(X), (char *)db_Esc95 },
-/*6*/ { "fnstenv",NONE, op1(X), (char *)db_Esc96 },
-/*7*/ { "fnstcw", NONE, op1(X), (char *)db_Esc97 },
+/*2*/ { "fst", SNGL, op1(X), (const char *)db_Esc92 },
+/*3*/ { "fstp", SNGL, op1(X), (const char *)db_Esc93 },
+/*4*/ { "fldenv", NONE, op1(X), (const char *)db_Esc94 },
+/*5*/ { "fldcw", NONE, op1(X), (const char *)db_Esc95 },
+/*6*/ { "fnstenv",NONE, op1(X), (const char *)db_Esc96 },
+/*7*/ { "fnstcw", NONE, op1(X), (const char *)db_Esc97 },
};
const struct finst db_Esca[] = {
@@ -413,7 +413,7 @@
/*1*/ { "fimul", WORD, 0, 0 },
/*2*/ { "ficom", WORD, 0, 0 },
/*3*/ { "ficomp", WORD, 0, 0 },
-/*4*/ { "fisub", WORD, op1(X), (char *)db_Esca4 },
+/*4*/ { "fisub", WORD, op1(X), (const char *)db_Esca4 },
/*5*/ { "fisubr", WORD, 0, 0 },
/*6*/ { "fidiv", WORD, 0, 0 },
/*7*/ { "fidivr", WORD, 0, 0 }
@@ -424,7 +424,7 @@
/*1*/ { "", NONE, 0, 0 },
/*2*/ { "fist", WORD, 0, 0 },
/*3*/ { "fistp", WORD, 0, 0 },
-/*4*/ { "", WORD, op1(X), (char *)db_Escb4 },
+/*4*/ { "", WORD, op1(X), (const char *)db_Escb4 },
/*5*/ { "fld", EXTR, 0, 0 },
/*6*/ { "", WORD, 0, 0 },
/*7*/ { "fstp", EXTR, 0, 0 },
@@ -456,7 +456,7 @@
/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" },
/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" },
/*2*/ { "ficom", LONG, 0, 0 },
-/*3*/ { "ficomp", LONG, op1(X), (char *)db_Esce3 },
+/*3*/ { "ficomp", LONG, op1(X), (const char *)db_Esce3 },
/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" },
/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" },
/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" },
@@ -468,7 +468,7 @@
/*1*/ { "", LONG, 0, 0 },
/*2*/ { "fist", LONG, 0, 0 },
/*3*/ { "fistp", LONG, 0, 0 },
-/*4*/ { "fbld", NONE, op1(XA), (char *)db_Escf4 },
+/*4*/ { "fbld", NONE, op1(XA), (const char *)db_Escf4 },
/*5*/ { "fld", QUAD, 0, 0 },
/*6*/ { "fbstp", NONE, 0, 0 },
/*7*/ { "fstp", QUAD, 0, 0 },
@@ -684,10 +684,10 @@
/*7e*/ { "jle", FALSE, NONE, op1(Db), 0 },
/*7f*/ { "jnle", FALSE, NONE, op1(Db), 0 },
-/*80*/ { "", TRUE, BYTE, op2(I, E), (char *)db_Grp1 },
-/*81*/ { "", TRUE, LONG, op2(I, E), (char *)db_Grp1 },
-/*82*/ { "", TRUE, BYTE, op2(Is,E), (char *)db_Grp1 },
-/*83*/ { "", TRUE, LONG, op2(Ibs,E), (char *)db_Grp1 },
+/*80*/ { "", TRUE, BYTE, op2(I, E), (const char *)db_Grp1 },
+/*81*/ { "", TRUE, LONG, op2(I, E), (const char *)db_Grp1 },
+/*82*/ { "", TRUE, BYTE, op2(Is,E), (const char *)db_Grp1 },
+/*83*/ { "", TRUE, LONG, op2(Ibs,E), (const char *)db_Grp1 },
/*84*/ { "test", TRUE, BYTE, op2(R, E), 0 },
/*85*/ { "test", TRUE, LONG, op2(R, E), 0 },
/*86*/ { "xchg", TRUE, BYTE, op2(R, E), 0 },
@@ -756,8 +756,8 @@
/*be*/ { "mov", FALSE, LONG, op2(I, Ri), 0 },
/*bf*/ { "mov", FALSE, LONG, op2(I, Ri), 0 },
-/*c0*/ { "", TRUE, BYTE, op2(Ib, E), (char *)db_Grp2 },
-/*c1*/ { "", TRUE, LONG, op2(Ib, E), (char *)db_Grp2 },
+/*c0*/ { "", TRUE, BYTE, op2(Ib, E), (const char *)db_Grp2 },
+/*c1*/ { "", TRUE, LONG, op2(Ib, E), (const char *)db_Grp2 },
/*c2*/ { "ret", FALSE, NONE, op1(Iw), 0 },
/*c3*/ { "ret", FALSE, NONE, 0, 0 },
/*c4*/ { "les", TRUE, LONG, op2(E, R), 0 },
@@ -774,23 +774,23 @@
/*ce*/ { "into", FALSE, NONE, 0, 0 },
/*cf*/ { "iret", FALSE, NONE, 0, 0 },
-/*d0*/ { "", TRUE, BYTE, op2(o1, E), (char *)db_Grp2 },
-/*d1*/ { "", TRUE, LONG, op2(o1, E), (char *)db_Grp2 },
-/*d2*/ { "", TRUE, BYTE, op2(CL, E), (char *)db_Grp2 },
-/*d3*/ { "", TRUE, LONG, op2(CL, E), (char *)db_Grp2 },
+/*d0*/ { "", TRUE, BYTE, op2(o1, E), (const char *)db_Grp2 },
+/*d1*/ { "", TRUE, LONG, op2(o1, E), (const char *)db_Grp2 },
+/*d2*/ { "", TRUE, BYTE, op2(CL, E), (const char *)db_Grp2 },
+/*d3*/ { "", TRUE, LONG, op2(CL, E), (const char *)db_Grp2 },
/*d4*/ { "aam", TRUE, NONE, 0, 0 },
/*d5*/ { "aad", TRUE, NONE, 0, 0 },
/*d6*/ { "", FALSE, NONE, 0, 0 },
/*d7*/ { "xlat", FALSE, BYTE, op1(BX), 0 },
-/*d8*/ { "", TRUE, NONE, 0, (char *)db_Esc8 },
-/*d9*/ { "", TRUE, NONE, 0, (char *)db_Esc9 },
-/*da*/ { "", TRUE, NONE, 0, (char *)db_Esca },
-/*db*/ { "", TRUE, NONE, 0, (char *)db_Escb },
-/*dc*/ { "", TRUE, NONE, 0, (char *)db_Escc },
-/*dd*/ { "", TRUE, NONE, 0, (char *)db_Escd },
-/*de*/ { "", TRUE, NONE, 0, (char *)db_Esce },
-/*df*/ { "", TRUE, NONE, 0, (char *)db_Escf },
+/*d8*/ { "", TRUE, NONE, 0, (const char *)db_Esc8 },
+/*d9*/ { "", TRUE, NONE, 0, (const char *)db_Esc9 },
+/*da*/ { "", TRUE, NONE, 0, (const char *)db_Esca },
+/*db*/ { "", TRUE, NONE, 0, (const char *)db_Escb },
+/*dc*/ { "", TRUE, NONE, 0, (const char *)db_Escc },
+/*dd*/ { "", TRUE, NONE, 0, (const char *)db_Escd },
+/*de*/ { "", TRUE, NONE, 0, (const char *)db_Esce },
+/*df*/ { "", TRUE, NONE, 0, (const char *)db_Escf },
/*e0*/ { "loopne",FALSE, NONE, op1(Db), 0 },
/*e1*/ { "loope", FALSE, NONE, op1(Db), 0 },
@@ -816,8 +816,8 @@
/*f3*/ { "", FALSE, NONE, 0, 0 },
/*f4*/ { "hlt", FALSE, NONE, 0, 0 },
/*f5*/ { "cmc", FALSE, NONE, 0, 0 },
-/*f6*/ { "", TRUE, BYTE, 0, (char *)db_Grp3 },
-/*f7*/ { "", TRUE, LONG, 0, (char *)db_Grp3 },
+/*f6*/ { "", TRUE, BYTE, 0, (const char *)db_Grp3 },
+/*f7*/ { "", TRUE, LONG, 0, (const char *)db_Grp3 },
/*f8*/ { "clc", FALSE, NONE, 0, 0 },
/*f9*/ { "stc", FALSE, NONE, 0, 0 },
@@ -825,8 +825,8 @@
/*fb*/ { "sti", FALSE, NONE, 0, 0 },
/*fc*/ { "cld", FALSE, NONE, 0, 0 },
/*fd*/ { "std", FALSE, NONE, 0, 0 },
-/*fe*/ { "", TRUE, NONE, 0, (char *)db_Grp4 },
-/*ff*/ { "", TRUE, NONE, 0, (char *)db_Grp5 },
+/*fe*/ { "", TRUE, NONE, 0, (const char *)db_Grp4 },
+/*ff*/ { "", TRUE, NONE, 0, (const char *)db_Grp5 },
};
const struct inst db_bad_inst =
@@ -937,8 +937,8 @@
db_addr_t db_read_address(db_addr_t, u_int, int, int, struct i_addr *);
-void db_print_address(char *, u_int, int, struct i_addr *);
-db_addr_t db_disasm_esc(db_addr_t, int, u_int, int, int, char *);
+void db_print_address(const char *, u_int, int, struct i_addr *);
+db_addr_t db_disasm_esc(db_addr_t, int, u_int, int, int, const char *);
/*
* Read address at location and return updated location.
@@ -1040,7 +1040,7 @@
void
db_print_address(seg, rex, size, addrp)
- char * seg;
+ const char * seg;
u_int rex;
int size;
struct i_addr *addrp;
@@ -1077,13 +1077,13 @@
u_int rex;
int short_addr;
int size;
- char * seg;
+ const char * seg;
{
int regmodrm;
const struct finst *fp;
int mod;
struct i_addr address;
- char * name;
+ const char * name;
get_value_inc(regmodrm, loc, 1, FALSE);
fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
@@ -1136,11 +1136,11 @@
db_printf("%s\t%%st(%d)",name, f_rm(regmodrm));
break;
case op1(X):
- db_printf("%s", ((char **)fp->f_rrname)[f_rm(regmodrm)]);
+ db_printf("%s", ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]);
break;
case op1(XA):
db_printf("%s\t%%ax",
- ((char **)fp->f_rrname)[f_rm(regmodrm)]);
+ ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]);
break;
default:
db_printf("<bad instruction>");
@@ -1164,9 +1164,9 @@
int inst;
int size;
int short_addr;
- char * seg;
+ const char * seg;
const struct inst * ip;
- char * i_name;
+ const char * i_name;
int i_size;
int i_mode;
int regmodrm = 0;
@@ -1288,20 +1288,20 @@
i_size = ip->i_size;
i_mode = ip->i_mode;
- if (ip->i_extra == (char *)db_Grp1 ||
- ip->i_extra == (char *)db_Grp2 ||
- ip->i_extra == (char *)db_Grp6 ||
- ip->i_extra == (char *)db_Grp7 ||
- ip->i_extra == (char *)db_Grp8) {
- i_name = ((char **)ip->i_extra)[f_reg(regmodrm)];
- } else if (ip->i_extra == (char *)db_Grp3) {
- ip = (struct inst *)ip->i_extra;
+ if (ip->i_extra == (const char *)db_Grp1 ||
+ ip->i_extra == (const char *)db_Grp2 ||
+ ip->i_extra == (const char *)db_Grp6 ||
+ ip->i_extra == (const char *)db_Grp7 ||
+ ip->i_extra == (const char *)db_Grp8) {
+ i_name = ((const char *const*)ip->i_extra)[f_reg(regmodrm)];
+ } else if (ip->i_extra == (const char *)db_Grp3) {
+ ip = (const struct inst *)ip->i_extra;
ip = &ip[f_reg(regmodrm)];
i_name = ip->i_name;
i_mode = ip->i_mode;
- } else if (ip->i_extra == (char *)db_Grp4 ||
- ip->i_extra == (char *)db_Grp5) {
- ip = (struct inst *)ip->i_extra;
+ } else if (ip->i_extra == (const char *)db_Grp4 ||
+ ip->i_extra == (const char *)db_Grp5) {
+ ip = (const struct inst *)ip->i_extra;
ip = &ip[f_reg(regmodrm)];
i_name = ip->i_name;
i_mode = ip->i_mode;
Index: sys/arch/amd64/amd64/db_trace.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/db_trace.c,v
retrieving revision 1.3
diff -u -r1.3 db_trace.c
--- sys/arch/amd64/amd64/db_trace.c 16 Apr 2004 14:21:56 -0000 1.3
+++ sys/arch/amd64/amd64/db_trace.c 1 Jun 2005 11:50:26 -0000
@@ -124,7 +124,7 @@
int db_numargs(long *);
int db_nextframe(long **, long **, long **, db_addr_t *, long *, int,
void (*) (const char *, ...));
-db_sym_t db_frame_info(long *, db_addr_t, char **, db_expr_t *, int *, int *);
+db_sym_t db_frame_info(long *, db_addr_t, const char **, db_expr_t *, int *, int *);
void
@@ -244,13 +244,13 @@
}
db_sym_t
-db_frame_info(long *frame, db_addr_t callpc, char **namep, db_expr_t *offp,
+db_frame_info(long *frame, db_addr_t callpc, const char **namep, db_expr_t *offp,
int *is_trap, int *nargp)
{
db_expr_t offset;
db_sym_t sym;
int narg;
- char *name;
+ const char *name;
sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
@@ -299,7 +299,7 @@
void
db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count,
- char *modif, void (*pr)(const char *, ...))
+ const char *modif, void (*pr)(const char *, ...))
{
long *frame, *lastframe;
long *retaddr, *arg0;
@@ -315,8 +315,8 @@
#endif
{
- register char *cp = modif;
- register char c;
+ const char *cp = modif;
+ char c;
while ((c = *cp++) != 0) {
if (c == 't')
@@ -370,7 +370,7 @@
lastframe = 0;
while (count && frame != 0) {
int narg;
- char * name;
+ const char * name;
db_expr_t offset;
db_sym_t sym;
char *argnames[16], **argnp = NULL;
Index: sys/arch/amd64/isa/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/isa/clock.c,v
retrieving revision 1.4
diff -u -r1.4 clock.c
--- sys/arch/amd64/isa/clock.c 30 Apr 2004 17:58:04 -0000 1.4
+++ sys/arch/amd64/isa/clock.c 1 Jun 2005 11:50:26 -0000
@@ -490,7 +490,7 @@
i8254_delay(n)
int n;
{
- int tick, otick;
+ int ntick, otick;
static const int delaytab[26] = {
0, 2, 3, 4, 5, 6, 7, 9, 10, 11,
12, 13, 15, 16, 17, 18, 19, 21, 22, 23,
@@ -540,14 +540,14 @@
while (n > 0) {
#ifdef CLOCK_PARANOIA
int delta;
- tick = gettick();
- if (tick > otick)
- delta = rtclock_tval - (tick - otick);
+ ntick = gettick();
+ if (ntick > otick)
+ delta = rtclock_tval - (ntick - otick);
else
- delta = otick - tick;
+ delta = otick - ntick;
if (delta < 0 || delta >= rtclock_tval / 2) {
DPRINTF(("delay: ignore ticks %.4x-%.4x",
- otick, tick));
+ otick, ntick));
if (clock_broken_latch) {
DPRINTF((" (%.4x %.4x %.4x %.4x %.4x %.4x)\n",
ticks[0], ticks[1], ticks[2],
@@ -558,13 +558,13 @@
} else
n -= delta;
#else
- tick = gettick();
- if (tick > otick)
- n -= rtclock_tval - (tick - otick);
+ ntick = gettick();
+ if (ntick > otick)
+ n -= rtclock_tval - (ntick - otick);
else
- n -= otick - tick;
+ n -= otick - ntick;
#endif
- otick = tick;
+ otick = ntick;
}
}
Index: sys/arch/x86/x86/mpbios.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/mpbios.c,v
retrieving revision 1.24
diff -u -r1.24 mpbios.c
--- sys/arch/x86/x86/mpbios.c 1 Apr 2005 11:59:36 -0000 1.24
+++ sys/arch/x86/x86/mpbios.c 1 Jun 2005 11:50:29 -0000
@@ -433,7 +433,7 @@
self->dv_xname, start, start+count-sizeof(*m));
for (i = 0; i <= end; i += 4) {
- m = (struct mpbios_fps *)&base[i];
+ m = (const struct mpbios_fps *)&base[i];
if ((m->signature == MP_FP_SIG) &&
((len = m->length << 4) != 0) &&
@@ -629,7 +629,7 @@
cur_intr = 0;
while ((count--) && (position < end)) {
- switch (type = *(u_char *) position) {
+ switch (type = *(const u_char *) position) {
case MPS_MCT_CPU:
#ifdef MPACPI
/* ACPI has done this for us */
@@ -675,7 +675,7 @@
return;
}
- (u_char*)position += mp_conf[type].length;
+ (const u_char*)position += mp_conf[type].length;
}
if (mp_verbose && mp_cth->ext_len)
printf("%s: MP WARNING: %d bytes of extended entries not examined\n",
Index: sys/dev/sequencer.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sequencer.c,v
retrieving revision 1.28
diff -u -r1.28 sequencer.c
--- sys/dev/sequencer.c 29 May 2005 22:18:25 -0000 1.28
+++ sys/dev/sequencer.c 1 Jun 2005 11:50:30 -0000
@@ -1068,7 +1068,7 @@
struct uio *uio;
{
int cmd, chan, note, parm;
- u_int32_t delay;
+ u_int32_t delayx;
int error;
cmd = SEQ_CMD(ev);
@@ -1103,10 +1103,10 @@
SEQ_EPARM(ev) = parm;
break;
case SEQOLD_WAIT:
- delay = *(u_int32_t *)ev->arr >> 8;
+ delayx = *(u_int32_t *)ev->arr >> 8;
SEQ_CMD(ev) = SEQ_TIMING;
SEQ_TCMD(ev) = TMR_WAIT_REL;
- *(u_int32_t *)&ev->arr[4] = delay;
+ *(u_int32_t *)&ev->arr[4] = delayx;
break;
case SEQOLD_SYNCTIMER:
SEQ_CMD(ev) = SEQ_TIMING;
--jI8keyz6grp/JLjh--