From 86a14a7a0aa00514f670234d7da4fca666ef97b2 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sun, 16 Aug 1998 01:21:52 +0000 Subject: [PATCH] Use [u]intptr_t instead of [u_]long for casts between pointers and integers. Don't forget to cast to (void *) as well. --- sys/alpha/linux/linux_sysvec.c | 8 ++++---- sys/compat/linux/linux_misc.c | 6 +++--- sys/dev/bktr/bktr_core.c | 6 +++--- sys/dev/dgb/dgb.c | 6 +++--- sys/dev/dgb/dgm.c | 4 ++-- sys/dev/en/midway.c | 27 ++++++++++++++------------- sys/fs/umapfs/umap_subr.c | 5 +++-- sys/gnu/i386/fpemul/fpu_entry.c | 4 ++-- sys/gnu/i386/fpemul/get_address.c | 11 +++++------ sys/gnu/i386/fpemul/load_store.c | 17 +++++++++++------ sys/gnu/i386/fpemul/reg_ld_str.c | 8 +++++--- sys/gnu/i386/isa/dgb.c | 6 +++--- sys/gnu/i386/isa/dgm.c | 4 ++-- sys/i386/ibcs2/ibcs2_xenix.c | 5 +++-- sys/i386/ibcs2/imgact_coff.c | 16 +++++++++------- sys/i386/isa/istallion.c | 9 +++++---- sys/i386/isa/sound/dmabuf.c | 5 +++-- sys/i386/isa/sound/soundcard.c | 2 +- sys/i386/isa/wd7000.c | 2 +- sys/i386/linux/imgact_linux.c | 11 ++++++----- sys/i386/linux/linux_misc.c | 6 +++--- sys/i386/linux/linux_sysvec.c | 8 ++++---- sys/kern/kern_malloc.c | 6 +++--- sys/kern/link_aout.c | 4 ++-- sys/miscfs/devfs/devfs_vfsops.c | 6 +++--- sys/miscfs/devfs/devfs_vnops.c | 15 +++++++-------- sys/miscfs/umapfs/umap_subr.c | 5 +++-- sys/pccard/pccard.c | 14 ++++++++------ sys/pccard/pcic.c | 2 +- sys/pci/brooktree848.c | 6 +++--- 30 files changed, 125 insertions(+), 109 deletions(-) diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index 850263f9691b..67ed448cad98 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.30 1998/06/07 17:11:27 dfr Exp $ + * $Id: linux_sysvec.c,v 1.31 1998/07/29 16:43:00 bde Exp $ */ /* XXX we use functions that might not exist. */ @@ -126,11 +126,11 @@ linux_fixup(long **stack_base, struct image_params *imgp) argv = *stack_base; envp = *stack_base + (imgp->argc + 1); (*stack_base)--; - **stack_base = (long)envp; + **stack_base = (intptr_t)(void *)envp; (*stack_base)--; - **stack_base = (long)argv; + **stack_base = (intptr_t)(void *)argv; (*stack_base)--; - **stack_base = (long)imgp->argc; + **stack_base = imgp->argc; return 0; } diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index ec420fabff8f..3647f84c53d1 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.40 1998/07/29 16:43:00 bde Exp $ + * $Id: linux_misc.c,v 1.41 1998/08/05 16:44:30 bde Exp $ */ #include @@ -327,8 +327,8 @@ printf("uselib: Non page aligned binary %lu\n", file_offset); goto cleanup; /* copy from kernel VM space to user space */ - error = copyout((caddr_t)(buffer + file_offset), (caddr_t)vmaddr, - a_out->a_text + a_out->a_data); + error = copyout((caddr_t)(void *)(uintptr_t)(buffer + file_offset), + (caddr_t)vmaddr, a_out->a_text + a_out->a_data); /* release temporary kernel space */ vm_map_remove(kernel_map, buffer, diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index 051cc6f351d8..780e60d8b07c 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -3056,7 +3056,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , /* must be Blue. */ start_skip = 0; if (( pf->type == METEOR_PIXTYPE_RGB ) && ( pf->Bpp == 3 )) - switch ( ((u_long) *target_buffer) % 4 ) { + switch ( ((uintptr_t) (void *) *target_buffer) % 4 ) { case 2 : start_skip = 4 ; break; case 1 : start_skip = 8 ; break; } @@ -3079,7 +3079,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , *(*dma_prog)++ = operation | flag | (width * pixel_width - skip); if (operation != OP_SKIP ) - *(*dma_prog)++ = (u_long) *target_buffer; + *(*dma_prog)++ = (uintptr_t) (void *) *target_buffer; *target_buffer += width * pixel_width; bktr->current_col += width; @@ -3110,7 +3110,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , *(*dma_prog)++ = operation | flag | (width * pixel_width / 2 - skip); if (operation != OP_SKIP ) - *(*dma_prog)++ = (u_long ) *target_buffer ; + *(*dma_prog)++ = (uintptr_t) (void *) *target_buffer ; *target_buffer += (width * pixel_width / 2) ; if ( operation == OP_WRITE ) diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 06f167915879..9537c12055c5 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.37 1998/08/12 16:16:10 bde Exp $ + * dgb.c $Id: dgb.c,v 1.38 1998/08/12 23:44:22 brian Exp $ * * Digiboard driver. * @@ -419,7 +419,7 @@ dgbprobe(dev) sc->altpin=0; /* left 24 bits only (ISA address) */ - sc->pmem=((long)dev->id_maddr & 0xFFFFFF); + sc->pmem=((intptr_t)(void *)dev->id_maddr & 0xFFFFFF); DPRINT4(DB_INFO,"dgb%d: port 0x%x mem 0x%lx\n",unit,sc->port,sc->pmem); @@ -493,7 +493,7 @@ dgbprobe(dev) dev->id_unit, sc->pmem, sc->pmem & 0xFFE000); - dev->id_maddr= (u_char *)( (long)sc->pmem & 0xFFE000 ); + dev->id_maddr= (u_char *)(void *)(intptr_t)( sc->pmem & 0xFFE000 ); } } } diff --git a/sys/dev/dgb/dgm.c b/sys/dev/dgb/dgm.c index c10e403e185b..487b1aa73847 100644 --- a/sys/dev/dgb/dgm.c +++ b/sys/dev/dgb/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.2 1998/08/05 20:19:03 brian Exp $ + * $Id: dgm.c,v 1.3 1998/08/12 17:38:09 bde Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -392,7 +392,7 @@ dgmprobe(dev) sc->altpin=0; /* left 24 bits only (ISA address) */ - sc->pmem=((long)dev->id_maddr & 0xFFFFFF); + sc->pmem=((intptr_t)(void *)dev->id_maddr & 0xFFFFFF); DPRINT4(DB_INFO,"dgm%d: port 0x%x mem 0x%lx\n",unit,sc->port,sc->pmem); diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c index 9e3b2d0e436f..ce598aa2e63d 100644 --- a/sys/dev/en/midway.c +++ b/sys/dev/en/midway.c @@ -579,7 +579,7 @@ u_int len, tx; } if (tx) { /* byte burst? */ - needalign = (((unsigned long) data) % sizeof(u_int32_t)); + needalign = (((uintptr_t) (void *) data) % sizeof(u_int32_t)); if (needalign) { result++; sz = min(len, sizeof(u_int32_t) - needalign); @@ -589,7 +589,7 @@ u_int len, tx; } if (sc->alburst && len) { - needalign = (((unsigned long) data) & sc->bestburstmask); + needalign = (((uintptr_t) (void *) data) & sc->bestburstmask); if (needalign) { result++; /* alburst */ sz = min(len, sc->bestburstlen - needalign); @@ -896,8 +896,8 @@ struct en_softc *sc; #ifdef NBURSTS /* setup src and dst buf at the end of the boundary */ - sp = (u_int8_t *)roundup((unsigned long)buffer, 64); - while (((unsigned long)sp & (BOUNDARY - 1)) != (BOUNDARY - 64)) + sp = (u_int8_t *)roundup((uintptr_t)(void *)buffer, 64); + while (((uintptr_t)(void *)sp & (BOUNDARY - 1)) != (BOUNDARY - 64)) sp += 64; dp = sp + BOUNDARY; @@ -906,9 +906,9 @@ struct en_softc *sc; * boundary, move it to the next page. but still either src or dst * will be at the boundary, which should be ok. */ - if ((((unsigned long)sp + 64) & PAGE_MASK) == 0) + if ((((uintptr_t)(void *)sp + 64) & PAGE_MASK) == 0) sp += 64; - if ((((unsigned long)dp + 64) & PAGE_MASK) == 0) + if ((((uintptr_t)(void *)dp + 64) & PAGE_MASK) == 0) dp += 64; #else /* !NBURSTS */ sp = (u_int8_t *) srcbuf; @@ -1649,7 +1649,7 @@ struct ifnet *ifp; while (1) { /* no DMA? */ if ((!sc->is_adaptec && EN_ENIDMAFIX) || EN_NOTXDMA || !en_dma) { - if ( (mtod(lastm, unsigned long) % sizeof(u_int32_t)) != 0 || + if ( ((uintptr_t)mtod(lastm, void *) % sizeof(u_int32_t)) != 0 || ((lastm->m_len % sizeof(u_int32_t)) != 0 && lastm->m_next)) { first = (lastm == m); if (en_mfix(sc, &lastm, prev) == 0) { /* failed? */ @@ -1920,7 +1920,7 @@ STATIC int en_makeexclusive(sc, mm, prev) /* the buffer is not shared, align the data offset using this buffer. */ u_char *d = mtod(m, u_char *); - int off = ((u_long)d) % sizeof(u_int32_t); + int off = ((uintptr_t)(void *)d) % sizeof(u_int32_t); if (off > 0) { bcopy(d, d - off, m->m_len); @@ -1951,7 +1951,7 @@ struct mbuf **mm, *prev; #endif d = mtod(m, u_char *); - off = ((unsigned long) d) % sizeof(u_int32_t); + off = ((uintptr_t) (void *) d) % sizeof(u_int32_t); if (off) { if ((m->m_flags & M_EXT) == 0) { @@ -2307,7 +2307,8 @@ struct en_launch *l; /* now, determine if we should copy it */ if (l->nodma || (len < EN_MINDMA && - (len % 4) == 0 && ((unsigned long) data % 4) == 0 && (cur % 4) == 0)) { + (len % 4) == 0 && ((uintptr_t) (void *) data % 4) == 0 && + (cur % 4) == 0)) { /* * roundup len: the only time this will change the value of len @@ -2384,7 +2385,7 @@ struct en_launch *l; */ /* do we need to do a DMA op to align to word boundary? */ - needalign = (unsigned long) data % sizeof(u_int32_t); + needalign = (uintptr_t) (void *) data % sizeof(u_int32_t); if (needalign) { EN_COUNT(sc->headbyte); cnt = sizeof(u_int32_t) - needalign; @@ -2412,7 +2413,7 @@ struct en_launch *l; /* do we need to do a DMA op to align? */ if (sc->alburst && - (needalign = (((unsigned long) data) & sc->bestburstmask)) != 0 + (needalign = (((uintptr_t) (void *) data) & sc->bestburstmask)) != 0 && len >= sizeof(u_int32_t)) { cnt = sc->bestburstlen - needalign; mx = len & ~(sizeof(u_int32_t)-1); /* don't go past end */ @@ -3148,7 +3149,7 @@ struct en_softc *sc; /* do we need to do a DMA op to align? */ if (sc->alburst && - (needalign = (((unsigned long) data) & sc->bestburstmask)) != 0) { + (needalign = (((uintptr_t) (void *) data) & sc->bestburstmask)) != 0) { cnt = sc->bestburstlen - needalign; if (cnt > tlen) { cnt = tlen; diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c index dd93078e647d..fc4d5eb4575a 100644 --- a/sys/fs/umapfs/umap_subr.c +++ b/sys/fs/umapfs/umap_subr.c @@ -35,7 +35,7 @@ * * @(#)umap_subr.c 8.9 (Berkeley) 5/14/95 * - * $Id: umap_subr.c,v 1.12 1998/02/07 01:36:24 kato Exp $ + * $Id: umap_subr.c,v 1.13 1998/02/09 06:09:48 eivind Exp $ */ #include @@ -58,7 +58,8 @@ */ #define UMAP_NHASH(vp) \ - (&umap_node_hashtbl[(((u_long)vp)>>LOG2_SIZEVNODE) & umap_node_hash]) + (&umap_node_hashtbl \ + [((uintptr_t)(void *)(vp) >> LOG2_SIZEVNODE) & umap_node_hash]) static LIST_HEAD(umap_node_hashhead, umap_node) *umap_node_hashtbl; static u_long umap_node_hash; diff --git a/sys/gnu/i386/fpemul/fpu_entry.c b/sys/gnu/i386/fpemul/fpu_entry.c index 5d737fdb30e4..1d8b44d0ee83 100644 --- a/sys/gnu/i386/fpemul/fpu_entry.c +++ b/sys/gnu/i386/fpemul/fpu_entry.c @@ -55,7 +55,7 @@ * * W. Metzenthen June 1994. * - * $Id: fpu_entry.c,v 1.12 1997/06/14 15:11:03 bde Exp $ + * $Id: fpu_entry.c,v 1.13 1997/07/20 08:46:23 bde Exp $ * */ @@ -395,7 +395,7 @@ math_emulate(struct trapframe * tframe) reg_mem_instr_done: - data_operand_offset = (unsigned long) FPU_data_address; + data_operand_offset = (intptr_t) (void *) FPU_data_address; } else { /* None of these instructions access user memory */ unsigned char instr_index = (FPU_modrm & 0x38) | (code & 7); diff --git a/sys/gnu/i386/fpemul/get_address.c b/sys/gnu/i386/fpemul/get_address.c index 84ac5311841e..ccaf68475265 100644 --- a/sys/gnu/i386/fpemul/get_address.c +++ b/sys/gnu/i386/fpemul/get_address.c @@ -56,7 +56,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: get_address.c,v 1.6 1997/02/22 09:29:09 peter Exp $ * */ @@ -129,7 +129,7 @@ sib(int mod) REENTRANT_CHECK(ON); FPU_EIP += 4; } - return (void *) offset; + return (void *) (intptr_t) offset; } @@ -175,9 +175,8 @@ get_address(unsigned char FPU_modrm) FPU_data_address = (void *) offset; return; } else { - FPU_data_address = (void *) *cpu_reg_ptr; /* Just return the - * contents of the cpu - * register */ + /* Just return the contents of the cpu register */ + FPU_data_address = (void *) (intptr_t) *cpu_reg_ptr; return; } case 1: @@ -199,5 +198,5 @@ get_address(unsigned char FPU_modrm) EXCEPTION(EX_Invalid); } - FPU_data_address = offset + (char *) *cpu_reg_ptr; + FPU_data_address = (void *) (intptr_t) (offset + *cpu_reg_ptr); } diff --git a/sys/gnu/i386/fpemul/load_store.c b/sys/gnu/i386/fpemul/load_store.c index 5eee2b412fd4..50eec3e9ada0 100644 --- a/sys/gnu/i386/fpemul/load_store.c +++ b/sys/gnu/i386/fpemul/load_store.c @@ -57,7 +57,7 @@ * W. Metzenthen June 1994. * * - * $Id: load_store.c,v 1.10 1997/07/01 00:08:33 bde Exp $ + * $Id: load_store.c,v 1.11 1997/08/31 22:22:19 bde Exp $ * */ @@ -208,7 +208,8 @@ load_store_instr(char type) control_word |= EX_Underflow; } #endif - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ break; case 025: /* fld m80real */ @@ -223,12 +224,14 @@ load_store_instr(char type) break; case 030: /* fstenv m14/28byte */ fstenv(); - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ break; case 032: /* fsave */ fsave(); - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ break; case 033: /* fbstp m80dec */ @@ -241,7 +244,8 @@ load_store_instr(char type) /* verify_area(VERIFY_WRITE, FPU_data_address, 2);*/ susword( (short *) FPU_data_address,control_word); REENTRANT_CHECK(ON); - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t ) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ break; case 035: /* fstp m80real */ @@ -256,7 +260,8 @@ load_store_instr(char type) /* verify_area(VERIFY_WRITE, FPU_data_address, 2);*/ susword( (short *) FPU_data_address,status_word); REENTRANT_CHECK(ON); - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ break; case 037: /* fistp m64int */ diff --git a/sys/gnu/i386/fpemul/reg_ld_str.c b/sys/gnu/i386/fpemul/reg_ld_str.c index 214e16125337..bb569b894b3b 100644 --- a/sys/gnu/i386/fpemul/reg_ld_str.c +++ b/sys/gnu/i386/fpemul/reg_ld_str.c @@ -56,7 +56,7 @@ * W. Metzenthen June 1994. * * - * $Id: reg_ld_str.c,v 1.10 1997/06/14 15:11:05 bde Exp $ + * $Id: reg_ld_str.c,v 1.11 1997/08/31 22:22:21 bde Exp $ * */ @@ -1195,7 +1195,8 @@ fldenv(void) } } - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; FPU_entry_eip = ip_offset; /* We want no net effect */ return s + 0x1c; @@ -1233,7 +1234,8 @@ frstor(void) control_word = saved_control; status_word = saved_status; - FPU_data_address = (void *) data_operand_offset; /* We want no net effect */ + /* We want no net effect: */ + FPU_data_address = (void *) (intptr_t) data_operand_offset; } diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 06f167915879..9537c12055c5 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.37 1998/08/12 16:16:10 bde Exp $ + * dgb.c $Id: dgb.c,v 1.38 1998/08/12 23:44:22 brian Exp $ * * Digiboard driver. * @@ -419,7 +419,7 @@ dgbprobe(dev) sc->altpin=0; /* left 24 bits only (ISA address) */ - sc->pmem=((long)dev->id_maddr & 0xFFFFFF); + sc->pmem=((intptr_t)(void *)dev->id_maddr & 0xFFFFFF); DPRINT4(DB_INFO,"dgb%d: port 0x%x mem 0x%lx\n",unit,sc->port,sc->pmem); @@ -493,7 +493,7 @@ dgbprobe(dev) dev->id_unit, sc->pmem, sc->pmem & 0xFFE000); - dev->id_maddr= (u_char *)( (long)sc->pmem & 0xFFE000 ); + dev->id_maddr= (u_char *)(void *)(intptr_t)( sc->pmem & 0xFFE000 ); } } } diff --git a/sys/gnu/i386/isa/dgm.c b/sys/gnu/i386/isa/dgm.c index c10e403e185b..487b1aa73847 100644 --- a/sys/gnu/i386/isa/dgm.c +++ b/sys/gnu/i386/isa/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.2 1998/08/05 20:19:03 brian Exp $ + * $Id: dgm.c,v 1.3 1998/08/12 17:38:09 bde Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -392,7 +392,7 @@ dgmprobe(dev) sc->altpin=0; /* left 24 bits only (ISA address) */ - sc->pmem=((long)dev->id_maddr & 0xFFFFFF); + sc->pmem=((intptr_t)(void *)dev->id_maddr & 0xFFFFFF); DPRINT4(DB_INFO,"dgm%d: port 0x%x mem 0x%lx\n",unit,sc->port,sc->pmem); diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c index 8694e2a1220f..0677edec6a2f 100644 --- a/sys/i386/ibcs2/ibcs2_xenix.c +++ b/sys/i386/ibcs2/ibcs2_xenix.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ibcs2_xenix.c,v 1.14 1997/11/06 19:28:46 phk Exp $ + * $Id: ibcs2_xenix.c,v 1.15 1998/06/02 05:39:07 dyson Exp $ */ #include @@ -168,7 +168,8 @@ xenix_utsname(struct proc *p, struct xenix_utsname_args *uap) ibcs2_sco_uname.sysorigin = 0xFFFF; ibcs2_sco_uname.sysoem = 0xFFFF; ibcs2_sco_uname.numcpu = 1; - return copyout((caddr_t)&ibcs2_sco_uname, (caddr_t)uap->addr, + return copyout((caddr_t)&ibcs2_sco_uname, + (caddr_t)(void *)(intptr_t)uap->addr, sizeof(struct ibcs2_sco_utsname)); } diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c index d38c7b651dbe..9308e9d0a0df 100644 --- a/sys/i386/ibcs2/imgact_coff.c +++ b/sys/i386/ibcs2/imgact_coff.c @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_coff.c,v 1.29 1998/02/09 06:08:20 eivind Exp $ + * $Id: imgact_coff.c,v 1.30 1998/02/11 01:46:47 eivind Exp $ */ #include @@ -257,13 +257,13 @@ coff_load_file(struct proc *p, char *name) } if (error = load_coff_section(vmspace, vp, text_offset, - (caddr_t)text_address, + (caddr_t)(void *)(uintptr_t)text_address, text_size, text_size, VM_PROT_READ | VM_PROT_EXECUTE)) { goto dealloc_and_fail; } if (error = load_coff_section(vmspace, vp, data_offset, - (caddr_t)data_address, + (caddr_t)(void *)(uintptr_t)data_address, data_size + bss_size, data_size, VM_PROT_ALL)) { goto dealloc_and_fail; @@ -417,7 +417,8 @@ exec_coff_imgact(imgp) __FILE__, __LINE__, text_offset, text_address, text_size, text_size, VM_PROT_READ | VM_PROT_EXECUTE)); if (error = load_coff_section(vmspace, imgp->vp, - text_offset, (caddr_t)text_address, + text_offset, + (caddr_t)(void *)(uintptr_t)text_address, text_size, text_size, VM_PROT_READ | VM_PROT_EXECUTE)) { DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error)); @@ -433,7 +434,8 @@ exec_coff_imgact(imgp) __FILE__, __LINE__, data_offset, data_address, data_size + bss_size, data_size, VM_PROT_ALL)); if (error = load_coff_section(vmspace, imgp->vp, - data_offset, (caddr_t)data_address, + data_offset, + (caddr_t)(void *)(uintptr_t)data_address, data_size + bss_size, data_size, VM_PROT_ALL)) { @@ -446,8 +448,8 @@ exec_coff_imgact(imgp) vmspace->vm_tsize = round_page(text_size) >> PAGE_SHIFT; vmspace->vm_dsize = round_page(data_size + bss_size) >> PAGE_SHIFT; - vmspace->vm_taddr = (caddr_t)text_address; - vmspace->vm_daddr = (caddr_t)data_address; + vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)text_address; + vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t)data_address; hole = (caddr_t)trunc_page(vmspace->vm_daddr) + ctob(vmspace->vm_dsize); diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index c05b29c202f1..c11fc16b01b5 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: istallion.c,v 1.18 1998/04/15 17:45:29 bde Exp $ + * $Id: istallion.c,v 1.19 1998/06/07 17:10:42 dfr Exp $ */ /*****************************************************************************/ @@ -3391,13 +3391,14 @@ static int stli_startbrd(stlibrd_t *brdp) brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; brdp->bitsize = (nrdevs + 7) / 8; - memp = (volatile cdkmem_t *) hdrp->memp; - if (((unsigned long) memp) > brdp->memsize) { + memp = (volatile cdkmem_t *) (void *) (uintptr_t) hdrp->memp; + if (((uintptr_t) (void *) memp) > brdp->memsize) { printf("STALLION: corrupted shared memory region?\n"); rc = EIO; goto stli_donestartup; } - memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); + memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, + (uintptr_t) (void *) memp); if (memp->dtype != TYP_ASYNCTRL) { printf("STALLION: no slave control device found\n"); rc = EIO; diff --git a/sys/i386/isa/sound/dmabuf.c b/sys/i386/isa/sound/dmabuf.c index dfd2283186a3..613e30b862e5 100644 --- a/sys/i386/isa/sound/dmabuf.c +++ b/sys/i386/isa/sound/dmabuf.c @@ -1103,13 +1103,14 @@ DMAbuf_start_dma(int dev, u_long physaddr, int count, int dma_mode) if (audio_devs[dev]->flags & DMA_AUTOMODE) { /* Auto restart mode. Transfer the whole buffer */ isa_dmastart(B_RAW | ((dma_mode == 0) ? B_READ : B_WRITE), - (caddr_t) dmap->raw_buf_phys, dmap->bytes_in_use, chan); + (caddr_t) (void *) (uintptr_t) dmap->raw_buf_phys, + dmap->bytes_in_use, chan); } else #endif { isa_dmastart((dma_mode == 0) ? B_READ : B_WRITE, - (caddr_t) physaddr, count, chan); + (caddr_t) (void *) (uintptr_t) physaddr, count, chan); } return count; } diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index 4661c6b11304..b4eca553ebc1 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -522,7 +522,7 @@ alloc_dmap(int dev, int chan, struct dma_buffparms * dmap) * performs the phys address computation. */ - dmap->raw_buf_phys = (u_long) tmpbuf; + dmap->raw_buf_phys = (uintptr_t) tmpbuf; for (i = 0; i < audio_devs[dev]->buffsize; i++) *tmpbuf++ = 0x80; } diff --git a/sys/i386/isa/wd7000.c b/sys/i386/isa/wd7000.c index 0dc3829d50c2..5722aeeed1cf 100644 --- a/sys/i386/isa/wd7000.c +++ b/sys/i386/isa/wd7000.c @@ -441,7 +441,7 @@ wdsintr(int unit) in = &wds[unit].imbs[c]; pc = (struct wds_cmd *)scsi_3btou(in->addr); - vc = (struct wds_cmd *)PHYSTOKV((long)pc); + vc = (struct wds_cmd *)PHYSTOKV((intptr_t)(void *)pc); stat = in->stat; wds_done(unit, vc, stat); diff --git a/sys/i386/linux/imgact_linux.c b/sys/i386/linux/imgact_linux.c index 5f8590224ab6..b91b6ab71cc7 100644 --- a/sys/i386/linux/imgact_linux.c +++ b/sys/i386/linux/imgact_linux.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_linux.c,v 1.27 1998/02/11 01:46:49 eivind Exp $ + * $Id: imgact_linux.c,v 1.28 1998/07/29 16:43:00 bde Exp $ */ #include @@ -146,8 +146,8 @@ exec_linux_imgact(imgp) if (error) return error; - error = copyout((caddr_t)(buffer + file_offset), (caddr_t)vmaddr, - a_out->a_text + a_out->a_data); + error = copyout((caddr_t)(void *)(uintptr_t)(buffer + file_offset), + (caddr_t)vmaddr, a_out->a_text + a_out->a_data); vm_map_remove(kernel_map, buffer, buffer + round_page(a_out->a_text + a_out->a_data + file_offset)); @@ -219,8 +219,9 @@ exec_linux_imgact(imgp) /* Fill in process VM information */ vmspace->vm_tsize = round_page(a_out->a_text) >> PAGE_SHIFT; vmspace->vm_dsize = round_page(a_out->a_data + bss_size) >> PAGE_SHIFT; - vmspace->vm_taddr = (caddr_t)virtual_offset; - vmspace->vm_daddr = (caddr_t)virtual_offset + a_out->a_text; + vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)virtual_offset; + vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t) + (virtual_offset + a_out->a_text); /* Fill in image_params */ imgp->interpreted = 0; diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index ec420fabff8f..3647f84c53d1 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.40 1998/07/29 16:43:00 bde Exp $ + * $Id: linux_misc.c,v 1.41 1998/08/05 16:44:30 bde Exp $ */ #include @@ -327,8 +327,8 @@ printf("uselib: Non page aligned binary %lu\n", file_offset); goto cleanup; /* copy from kernel VM space to user space */ - error = copyout((caddr_t)(buffer + file_offset), (caddr_t)vmaddr, - a_out->a_text + a_out->a_data); + error = copyout((caddr_t)(void *)(uintptr_t)(buffer + file_offset), + (caddr_t)vmaddr, a_out->a_text + a_out->a_data); /* release temporary kernel space */ vm_map_remove(kernel_map, buffer, diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 850263f9691b..67ed448cad98 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.30 1998/06/07 17:11:27 dfr Exp $ + * $Id: linux_sysvec.c,v 1.31 1998/07/29 16:43:00 bde Exp $ */ /* XXX we use functions that might not exist. */ @@ -126,11 +126,11 @@ linux_fixup(long **stack_base, struct image_params *imgp) argv = *stack_base; envp = *stack_base + (imgp->argc + 1); (*stack_base)--; - **stack_base = (long)envp; + **stack_base = (intptr_t)(void *)envp; (*stack_base)--; - **stack_base = (long)argv; + **stack_base = (intptr_t)(void *)argv; (*stack_base)--; - **stack_base = (long)imgp->argc; + **stack_base = imgp->argc; return 0; } diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index c7a25d97c1bc..618b726361c0 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.45 1998/03/08 09:56:49 julian Exp $ + * $Id: kern_malloc.c,v 1.46 1998/07/29 17:38:14 bde Exp $ */ #include "opt_vm.h" @@ -205,7 +205,7 @@ malloc(size, type, flags) #if BYTE_ORDER == LITTLE_ENDIAN freep->type = (struct malloc_type *)WEIRD_ADDR; #endif - if (((long)(&freep->next)) & 0x2) + if ((intptr_t)(void *)&freep->next & 0x2) freep->next = (caddr_t)((WEIRD_ADDR >> 16)|(WEIRD_ADDR << 16)); else freep->next = (caddr_t)WEIRD_ADDR; @@ -279,7 +279,7 @@ free(addr, type) alloc = addrmask[BUCKETINDX(PAGE_SIZE)]; else alloc = addrmask[kup->ku_indx]; - if (((u_long)addr & alloc) != 0) + if (((uintptr_t)(void *)addr & alloc) != 0) panic("free: unaligned addr %p, size %ld, type %s, mask %ld", (void *)addr, size, type->ks_shortdesc, alloc); #endif /* DIAGNOSTIC */ diff --git a/sys/kern/link_aout.c b/sys/kern/link_aout.c index 5b4e47ce059e..a24c07739dce 100644 --- a/sys/kern/link_aout.c +++ b/sys/kern/link_aout.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: link_aout.c,v 1.8 1998/07/15 02:32:11 bde Exp $ + * $Id: link_aout.c,v 1.9 1998/08/12 08:44:21 dfr Exp $ */ #include @@ -476,7 +476,7 @@ link_aout_search_symbol(linker_file_t lf, caddr_t value, linker_sym_t* sym, long* diffp) { aout_file_t af = lf->priv; - u_long off = (u_long) value; + u_long off = (uintptr_t) (void *) value; u_long diff = off; struct nzlist* sp; struct nzlist* ep; diff --git a/sys/miscfs/devfs/devfs_vfsops.c b/sys/miscfs/devfs/devfs_vfsops.c index 06323711b3d9..ffa12ea07e85 100644 --- a/sys/miscfs/devfs/devfs_vfsops.c +++ b/sys/miscfs/devfs/devfs_vfsops.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: devfs_vfsops.c,v 1.29 1998/04/19 23:32:12 julian Exp $ + * $Id: devfs_vfsops.c,v 1.30 1998/05/06 05:29:32 msmith Exp $ * */ @@ -123,7 +123,7 @@ DBPRINT(("mount ")); */ mp->mnt_data = (qaddr_t)devfs_mp_p; mp->mnt_stat.f_type = MOUNT_DEVFS; - mp->mnt_stat.f_fsid.val[0] = (long)devfs_mp_p; + mp->mnt_stat.f_fsid.val[0] = (intptr_t)(void *)devfs_mp_p; mp->mnt_stat.f_fsid.val[1] = MOUNT_DEVFS; mp->mnt_flag |= MNT_LOCAL; @@ -228,7 +228,7 @@ DBPRINT(("statfs ")); sbp->f_bavail = 0; sbp->f_files = 128; sbp->f_ffree = 0; /* what to put in here? */ - sbp->f_fsid.val[0] = (long)devfs_mp_p; + sbp->f_fsid.val[0] = (intptr_t)(void *)devfs_mp_p; sbp->f_fsid.val[1] = MOUNT_DEVFS; /*- diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index bc82ac0f1e93..a11413b395b5 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: devfs_vnops.c,v 1.57 1998/07/05 23:10:21 julian Exp $ + * $Id: devfs_vnops.c,v 1.58 1998/07/30 17:40:44 bde Exp $ */ @@ -428,8 +428,8 @@ DBPRINT(("getattr\n")); vap->va_nlink = file_node->links; vap->va_uid = file_node->uid; vap->va_gid = file_node->gid; - vap->va_fsid = (long)file_node->dvm; - vap->va_fileid = (long)file_node; + vap->va_fsid = (intptr_t)(void *)file_node->dvm; + vap->va_fileid = (intptr_t)(void *)file_node; vap->va_size = file_node->len; /* now a u_quad_t */ vap->va_blocksize = 512; /* @@ -1135,7 +1135,7 @@ DBPRINT(("readdir\n")); switch(nodenumber) { case 0: - dirent.d_fileno = (unsigned long int)dir_node; + dirent.d_fileno = (uintptr_t)(void *)dir_node; name = "."; dirent.d_namlen = 1; dirent.d_type = DT_DIR; @@ -1143,16 +1143,15 @@ DBPRINT(("readdir\n")); case 1: if(dir_node->by.Dir.parent) dirent.d_fileno - = (unsigned long int)dir_node->by.Dir.parent; + = (uintptr_t)(void *)dir_node->by.Dir.parent; else - dirent.d_fileno = (unsigned long int)dir_node; + dirent.d_fileno = (uintptr_t)(void *)dir_node; name = ".."; dirent.d_namlen = 2; dirent.d_type = DT_DIR; break; default: - dirent.d_fileno = - (unsigned long int)name_node->dnp; + dirent.d_fileno = (uintptr_t)(void *)name_node->dnp; dirent.d_namlen = strlen(name_node->name); name = name_node->name; switch(name_node->dnp->type) { diff --git a/sys/miscfs/umapfs/umap_subr.c b/sys/miscfs/umapfs/umap_subr.c index dd93078e647d..fc4d5eb4575a 100644 --- a/sys/miscfs/umapfs/umap_subr.c +++ b/sys/miscfs/umapfs/umap_subr.c @@ -35,7 +35,7 @@ * * @(#)umap_subr.c 8.9 (Berkeley) 5/14/95 * - * $Id: umap_subr.c,v 1.12 1998/02/07 01:36:24 kato Exp $ + * $Id: umap_subr.c,v 1.13 1998/02/09 06:09:48 eivind Exp $ */ #include @@ -58,7 +58,8 @@ */ #define UMAP_NHASH(vp) \ - (&umap_node_hashtbl[(((u_long)vp)>>LOG2_SIZEVNODE) & umap_node_hash]) + (&umap_node_hashtbl \ + [((uintptr_t)(void *)(vp) >> LOG2_SIZEVNODE) & umap_node_hash]) static LIST_HEAD(umap_node_hashhead, umap_node) *umap_node_hashtbl; static u_long umap_node_hash; diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 7ce11de845e0..3fd3caf620e7 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pccard.c,v 1.61 1998/06/07 17:12:34 dfr Exp $ + * $Id: pccard.c,v 1.62 1998/06/18 15:32:09 bde Exp $ */ #include "opt_devfs.h" @@ -589,7 +589,8 @@ allocate_driver(struct slot *slt, struct dev_desc *desc) */ if (desc->mem) devi->isahd.id_maddr = - (caddr_t)(desc->mem + atdevbase - IOM_BEGIN); + (caddr_t)(void *)(uintptr_t) + (desc->mem + atdevbase - IOM_BEGIN); else devi->isahd.id_maddr = 0; devi->next = slt->devices; @@ -789,7 +790,7 @@ crdread(dev_t dev, struct uio *uio, int ioflag) while (uio->uio_resid && error == 0) { mp->card = uio->uio_offset; mp->size = PCCARD_MEMSIZE; - mp->start = (caddr_t)pccard_mem; + mp->start = (caddr_t)(void *)(uintptr_t)pccard_mem; if (error = slt->ctrl->mapmem(slt, win)) break; offs = (unsigned int)uio->uio_offset & (PCCARD_MEMSIZE - 1); @@ -839,7 +840,7 @@ crdwrite(dev_t dev, struct uio *uio, int ioflag) while (uio->uio_resid && error == 0) { mp->card = uio->uio_offset; mp->size = PCCARD_MEMSIZE; - mp->start = (caddr_t)pccard_mem; + mp->start = (caddr_t)(void *)(uintptr_t)pccard_mem; if (error = slt->ctrl->mapmem(slt, win)) break; offs = (unsigned int)uio->uio_offset & (PCCARD_MEMSIZE - 1); @@ -977,8 +978,9 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) * Map it to kernel VM. */ pccard_mem = *(unsigned long *)data; - pccard_kmem = (unsigned char *)(pccard_mem - + atdevbase - IOM_BEGIN); + pccard_kmem = + (unsigned char *)(void *)(uintptr_t) + (pccard_mem + atdevbase - IOM_BEGIN); break; /* * Set power values. diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index ff02b78093ba..6bfd48477019 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -374,7 +374,7 @@ pcic_memory(struct slot *slt, int win) #endif /* PC98 */ if (mp->flags & MDF_ACTIVE) { - unsigned long sys_addr = (unsigned long)mp->start >> 12; + unsigned long sys_addr = (uintptr_t)(void *)mp->start >> 12; /* * Write the addresses, card offsets and length. * The values are all stored as the upper 12 bits of the diff --git a/sys/pci/brooktree848.c b/sys/pci/brooktree848.c index 051cc6f351d8..780e60d8b07c 100644 --- a/sys/pci/brooktree848.c +++ b/sys/pci/brooktree848.c @@ -3056,7 +3056,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , /* must be Blue. */ start_skip = 0; if (( pf->type == METEOR_PIXTYPE_RGB ) && ( pf->Bpp == 3 )) - switch ( ((u_long) *target_buffer) % 4 ) { + switch ( ((uintptr_t) (void *) *target_buffer) % 4 ) { case 2 : start_skip = 4 ; break; case 1 : start_skip = 8 ; break; } @@ -3079,7 +3079,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , *(*dma_prog)++ = operation | flag | (width * pixel_width - skip); if (operation != OP_SKIP ) - *(*dma_prog)++ = (u_long) *target_buffer; + *(*dma_prog)++ = (uintptr_t) (void *) *target_buffer; *target_buffer += width * pixel_width; bktr->current_col += width; @@ -3110,7 +3110,7 @@ static bool_t split(bktr_reg_t * bktr, volatile u_long **dma_prog, int width , *(*dma_prog)++ = operation | flag | (width * pixel_width / 2 - skip); if (operation != OP_SKIP ) - *(*dma_prog)++ = (u_long ) *target_buffer ; + *(*dma_prog)++ = (uintptr_t) (void *) *target_buffer ; *target_buffer += (width * pixel_width / 2) ; if ( operation == OP_WRITE )