From: Matthew Dillon Date: Tue, 25 Aug 2009 19:35:08 +0000 (-0700) Subject: AMD64 - Fix format conversions and other warnings. X-Git-Tag: v2.4.0~123 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/bfc09ba0a4d805c1860f88e64d6ae9a407d3567d AMD64 - Fix format conversions and other warnings. --- diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index e8e8fabc8c..998081614d 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -2717,7 +2717,8 @@ pci_add_map(device_t pcib, device_t bus, device_t dev, */ if (bootverbose) { kprintf("pci:%d:%d:%d: resource reservation failed " - "%#llx - %#llx\n", b, s, f, start, end); + "%#jx - %#jx\n", b, s, f, + (intmax_t)start, (intmax_t)end); } return (barlen); #endif /* PCI_BAR_CLEAR */ diff --git a/sys/dev/acpica5/Osd/OsdMemory.c b/sys/dev/acpica5/Osd/OsdMemory.c index 06a52aa2ff..6b4096db26 100644 --- a/sys/dev/acpica5/Osd/OsdMemory.c +++ b/sys/dev/acpica5/Osd/OsdMemory.c @@ -155,9 +155,9 @@ again: *ptrack = track->next; pmap_unmapdev((vm_offset_t)track->base, track->size); kprintf("AcpiOsUnmapMemory: Warning, deallocation request too" - " large! %p/%08x (actual was %p/%08x)\n", - LogicalAddress, Length, - track->base, track->size); + " large! %p/%08jx (actual was %p/%08jx)\n", + LogicalAddress, (intmax_t)Length, + track->base, (intmax_t)track->size); #if ACPI_DEBUG_MEMMAP track->freed = 1; track->unmapper.func = caller; @@ -175,13 +175,13 @@ again: (char *)LogicalAddress < (char *)track->base + track->size ) { kprintf("AcpiOsUnmapMemory: Warning, deallocation did not " - "track allocation: %p/%08x (actual was %p/%08x)\n", - LogicalAddress, Length, - track->base, track->size); + "track allocation: %p/%08jx (actual was %p/%08jx)\n", + LogicalAddress, (intmax_t)Length, + track->base, (intmax_t)track->size); } } - kprintf("AcpiOsUnmapMemory: Warning, broken ACPI, bad unmap: %p/%08x\n", - LogicalAddress, Length); + kprintf("AcpiOsUnmapMemory: Warning, broken ACPI, bad unmap: %p/%08jx\n", + LogicalAddress, (intmax_t)Length); #if ACPI_DEBUG_MEMMAP for (track = acpi_mapbase; track != NULL; track = track->next) { if (track->freed && track->base == LogicalAddress) { diff --git a/sys/dev/acpica5/Osd/OsdSynch.c b/sys/dev/acpica5/Osd/OsdSynch.c index c41f7fc113..d6f0e478fc 100644 --- a/sys/dev/acpica5/Osd/OsdSynch.c +++ b/sys/dev/acpica5/Osd/OsdSynch.c @@ -214,8 +214,10 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) as->as_pendings++; if (acpi_semaphore_debug) { - kprintf("%s: Sleep %d, pending %d, semaphore %p, thread %d\n", - __func__, Timeout, as->as_pendings, as, AcpiOsGetThreadId()); + kprintf("%s: Sleep %jd, pending %jd, semaphore %p, thread %jd\n", + __func__, (intmax_t)Timeout, + (intmax_t)as->as_pendings, as, + (intmax_t)AcpiOsGetThreadId()); } rv = ssleep(as, &as->as_spin, PCATCH, "acsem", tmo); @@ -257,9 +259,10 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) tmo = 1; if (acpi_semaphore_debug) { - kprintf("%s: Wakeup timeleft(%lu, %lu), tmo %u, sem %p, thread %d\n", - __func__, timelefttv.tv_sec, timelefttv.tv_usec, tmo, as, - AcpiOsGetThreadId()); + kprintf("%s: Wakeup timeleft(%ju, %ju), tmo %ju, sem %p, thread %jd\n", + __func__, + (intmax_t)timelefttv.tv_sec, (intmax_t)timelefttv.tv_usec, + (intmax_t)tmo, as, (intmax_t)AcpiOsGetThreadId()); } } @@ -269,9 +272,9 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout) __func__, Timeout, as->as_pendings, as); } if (result == AE_OK && (as->as_timeouts > 0 || as->as_pendings > 0)) { - kprintf("%s: Acquire %d, units %d, pending %d, sem %p, thread %d\n", + kprintf("%s: Acquire %d, units %d, pending %d, sem %p, thread %jd\n", __func__, Units, as->as_units, as->as_pendings, as, - AcpiOsGetThreadId()); + (intmax_t)AcpiOsGetThreadId()); } } @@ -310,8 +313,9 @@ AcpiOsSignalSemaphore(ACPI_HANDLE Handle, UINT32 Units) } if (acpi_semaphore_debug && (as->as_timeouts > 0 || as->as_pendings > 0)) { - kprintf("%s: Release %d, units %d, pending %d, semaphore %p, thread %d\n", - __func__, Units, as->as_units, as->as_pendings, as, AcpiOsGetThreadId()); + kprintf("%s: Release %d, units %d, pending %d, semaphore %p, thread %jd\n", + __func__, Units, as->as_units, as->as_pendings, as, + (intmax_t)AcpiOsGetThreadId()); } wakeup(as); diff --git a/sys/dev/acpica5/acpi_cpu_pstate.c b/sys/dev/acpica5/acpi_cpu_pstate.c index d4b786a9e1..d1252f4a5f 100644 --- a/sys/dev/acpica5/acpi_cpu_pstate.c +++ b/sys/dev/acpica5/acpi_cpu_pstate.c @@ -351,9 +351,9 @@ acpi_pst_attach(device_t dev) return error; } if (bootverbose) { - device_printf(dev, "control reg %d %llx\n", - sc->pst_creg.pr_gas.SpaceId, - sc->pst_creg.pr_gas.Address); + device_printf(dev, "control reg %jd %jx\n", + (intmax_t)sc->pst_creg.pr_gas.SpaceId, + (intmax_t)sc->pst_creg.pr_gas.Address); } /* Save and try allocating status register */ diff --git a/sys/dev/crypto/ubsec/ubsec.c b/sys/dev/crypto/ubsec/ubsec.c index eab77059d5..933f9bbbad 100644 --- a/sys/dev/crypto/ubsec/ubsec.c +++ b/sys/dev/crypto/ubsec/ubsec.c @@ -1853,8 +1853,8 @@ ubsec_dma_malloc( BUS_DMA_NOWAIT, &dma->dma_map); if (r != 0) { device_printf(sc->sc_dev, "ubsec_dma_malloc: " - "bus_dmammem_alloc failed; size %u, error %u\n", - size, r); + "bus_dmammem_alloc failed; size %ju, error %u\n", + (intmax_t)size, r); goto fail_2; } diff --git a/sys/dev/disk/aha/aha.c b/sys/dev/disk/aha/aha.c index 971a10ff32..faa002650f 100644 --- a/sys/dev/disk/aha/aha.c +++ b/sys/dev/disk/aha/aha.c @@ -140,7 +140,8 @@ static __inline struct aha_ccb * ahaccbptov(struct aha_softc *aha, u_int32_t ccb_addr) { return (aha->aha_ccb_array + - + ((struct aha_ccb*)ccb_addr-(struct aha_ccb*)aha->aha_ccb_physbase)); + + ((struct aha_ccb*)(intptr_t)ccb_addr - + (struct aha_ccb*)(intptr_t)aha->aha_ccb_physbase)); } static struct aha_ccb* ahagetccb(struct aha_softc *aha); diff --git a/sys/dev/disk/ccd/ccd.c b/sys/dev/disk/ccd/ccd.c index 003e97742c..fa53ff3ba2 100644 --- a/sys/dev/disk/ccd/ccd.c +++ b/sys/dev/disk/ccd/ccd.c @@ -1243,10 +1243,12 @@ ccdiodone(struct bio *bio) obp->b_error = cbp->cb_buf.b_error ? cbp->cb_buf.b_error : EIO; } - kprintf("ccd%d: error %d on component %d offset %lld (ccd offset %lld)%s\n", - unit, obp->b_error, cbp->cb_comp, - cbp->cb_buf.b_bio2.bio_offset, - obio->bio_offset, msg); + kprintf("ccd%d: error %d on component %d " + "offset %jd (ccd offset %jd)%s\n", + unit, obp->b_error, cbp->cb_comp, + (intmax_t)cbp->cb_buf.b_bio2.bio_offset, + (intmax_t)obio->bio_offset, + msg); } /* diff --git a/sys/dev/disk/iscsi/initiator/isc_soc.c b/sys/dev/disk/iscsi/initiator/isc_soc.c index 369a6abd99..cbe43b8521 100644 --- a/sys/dev/disk/iscsi/initiator/isc_soc.c +++ b/sys/dev/disk/iscsi/initiator/isc_soc.c @@ -345,14 +345,16 @@ so_getbhs(isc_session_t *sp) error = so_pru_soreceive(sp->soc, NULL, uio, NULL, NULL, &flags); if(error) - debug(2, "error=%d so_error=%d uio->uio_resid=%d iov.iov_len=%zd", + debug(2, "error=%d so_error=%d uio->uio_resid=%zd iov.iov_len=%zd", error, sp->soc->so_error, uio->uio_resid, iov->iov_len); if(!error && (uio->uio_resid > 0)) { error = EPIPE; // was EAGAIN - debug(2, "error=%d so_error=%d uio->uio_resid=%d iov.iov_len=%zd so_state=%x", + debug(2, "error=%d so_error=%d uio->uio_resid=%zd iov.iov_len=%zd " + "so_state=%x", error, - sp->soc->so_error, uio->uio_resid, iov->iov_len, sp->soc->so_state); + sp->soc->so_error, uio->uio_resid, iov->iov_len, + sp->soc->so_state); } return error; diff --git a/sys/dev/disk/iscsi/initiator/isc_subr.c b/sys/dev/disk/iscsi/initiator/isc_subr.c index bfda38da1c..e867db2e5e 100644 --- a/sys/dev/disk/iscsi/initiator/isc_subr.c +++ b/sys/dev/disk/iscsi/initiator/isc_subr.c @@ -86,7 +86,7 @@ int i_setopt(isc_session_t *sp, isc_opt_t *opt) { const int digsize = 6; - int len; + size_t len; char hdigest[digsize], ddigest[digsize]; debug_called(8); diff --git a/sys/dev/disk/mpt/mpt.c b/sys/dev/disk/mpt/mpt.c index 77300164a9..adf171bfc2 100644 --- a/sys/dev/disk/mpt/mpt.c +++ b/sys/dev/disk/mpt/mpt.c @@ -1443,7 +1443,7 @@ mpt_recv_handshake_reply(struct mpt_softc *mpt, size_t reply_len, void *reply) hdr->MsgLength << 2, reply_len << 1, hdr->Function); #else mpt_prt(mpt, "reply length does not match message length: " - "got %x; expected %x for function %x\n", + "got %x; expected %zx for function %x\n", hdr->MsgLength << 2, reply_len << 1, hdr->Function); #endif } diff --git a/sys/dev/disk/sbp/sbp.c b/sys/dev/disk/sbp/sbp.c index 0cae3b6831..e7e371b40f 100644 --- a/sys/dev/disk/sbp/sbp.c +++ b/sys/dev/disk/sbp/sbp.c @@ -2514,12 +2514,8 @@ sbp_execute_ocb(void *arg, bus_dma_segment_t *segments, int seg, int error) SBP_DEBUG(2) kprintf("sbp_execute_ocb: seg %d", seg); for (i = 0; i < seg; i++) -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - kprintf(", %x:%d", segments[i].ds_addr, segments[i].ds_len); -#else kprintf(", %jx:%jd", (uintmax_t)segments[i].ds_addr, (uintmax_t)segments[i].ds_len); -#endif kprintf("\n"); END_DEBUG @@ -2538,12 +2534,9 @@ SBP_DEBUG(0) /* XXX LSI Logic "< 16 byte" bug might be hit */ if (s->ds_len < 16) kprintf("sbp_execute_ocb: warning, " -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - "segment length(%d) is less than 16." -#else "segment length(%zd) is less than 16." -#endif - "(seg=%d/%d)\n", s->ds_len, i+1, seg); + "(seg=%d/%jd)\n", + (size_t)s->ds_len, i+1, (intmax_t)seg); END_DEBUG if (s->ds_len > SBP_SEG_MAX) panic("ds_len > SBP_SEG_MAX, fix busdma code"); @@ -2646,11 +2639,7 @@ sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - kprintf("%s: 0x%08x\n", __func__, ocb->bus_addr); -#else kprintf("%s: 0x%08jx\n", __func__, (uintmax_t)ocb->bus_addr); -#endif END_DEBUG prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb); STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb); @@ -2661,13 +2650,8 @@ END_DEBUG if (prev != NULL) { SBP_DEBUG(2) -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - kprintf("linking chain 0x%x -> 0x%x\n", - prev->bus_addr, ocb->bus_addr); -#else kprintf("linking chain 0x%jx -> 0x%jx\n", (uintmax_t)prev->bus_addr, (uintmax_t)ocb->bus_addr); -#endif END_DEBUG prev->orb[1] = htonl(ocb->bus_addr); prev->orb[0] = 0; @@ -2710,11 +2694,7 @@ sbp_abort_ocb(struct sbp_ocb *ocb, int status) sdev = ocb->sdev; SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); -#if defined(__DragonFly__) || __FreeBSD_version < 500000 - kprintf("sbp_abort_ocb 0x%x\n", ocb->bus_addr); -#else kprintf("sbp_abort_ocb 0x%jx\n", (uintmax_t)ocb->bus_addr); -#endif END_DEBUG SBP_DEBUG(1) if (ocb->ccb != NULL) diff --git a/sys/dev/drm/drm_drawable.c b/sys/dev/drm/drm_drawable.c index 3ad40ea065..004e897328 100644 --- a/sys/dev/drm/drm_drawable.c +++ b/sys/dev/drm/drm_drawable.c @@ -81,7 +81,7 @@ int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv) /* * XXX Only valid for sizeof(int) == sizeof(void *) */ - info->handle = (int)info; + info->handle = (intptr_t)info; DRM_SPINLOCK(&dev->drw_lock); RB_INSERT(drawable_tree, &dev->drw_head, info); diff --git a/sys/dev/misc/dcons/dcons_crom.c b/sys/dev/misc/dcons/dcons_crom.c index 47ec373f35..6d8ac4533e 100644 --- a/sys/dev/misc/dcons/dcons_crom.c +++ b/sys/dev/misc/dcons/dcons_crom.c @@ -135,12 +135,8 @@ dmamap_cb(void *arg, bus_dma_segment_t *segments, int seg, int error) sc->bus_addr = segments[0].ds_addr; bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_PREWRITE); - device_printf(sc->fd.dev, -#if __FreeBSD_version < 500000 - "bus_addr 0x%x\n", sc->bus_addr); -#else - "bus_addr 0x%jx\n", (uintmax_t)sc->bus_addr); -#endif + device_printf(sc->fd.dev, "bus_addr 0x%jx\n", + (uintmax_t)sc->bus_addr); if (dcons_paddr != 0) { /* XXX */ device_printf(sc->fd.dev, "dcons_paddr is already set\n"); diff --git a/sys/dev/misc/kbd/atkbdc.c b/sys/dev/misc/kbd/atkbdc.c index 48e2da0dde..111fcf82dd 100644 --- a/sys/dev/misc/kbd/atkbdc.c +++ b/sys/dev/misc/kbd/atkbdc.c @@ -157,6 +157,8 @@ atkbdc_configure(void) /* XXX: tag should be passed from the caller */ #if defined(__i386__) tag = I386_BUS_SPACE_IO; +#else + tag = 0; /* XXX */ #endif #if notyet diff --git a/sys/dev/netif/acx/if_acx.c b/sys/dev/netif/acx/if_acx.c index 1d8bf2f53e..ed8e1c99b8 100644 --- a/sys/dev/netif/acx/if_acx.c +++ b/sys/dev/netif/acx/if_acx.c @@ -1774,7 +1774,7 @@ acx_setup_firmware(struct acx_softc *sc, struct fw_image *img, */ if (img->fw_imglen <= sizeof(*hdr)) { if_printf(&sc->sc_ic.ic_if, "%s is invalid image, " - "size %u (too small)\n", + "size %zu (too small)\n", img->fw_name, img->fw_imglen); return EINVAL; } @@ -1785,7 +1785,7 @@ acx_setup_firmware(struct acx_softc *sc, struct fw_image *img, */ if (hdr->fwh_len != img->fw_imglen - sizeof(*hdr)) { if_printf(&sc->sc_ic.ic_if, "%s is invalid image, " - "size in hdr %u and image size %u mismatches\n", + "size in hdr %u and image size %zu mismatches\n", img->fw_name, hdr->fwh_len, img->fw_imglen); return EINVAL; } diff --git a/sys/dev/netif/bwi/bwimac.c b/sys/dev/netif/bwi/bwimac.c index 71d5fa4067..592cda2744 100644 --- a/sys/dev/netif/bwi/bwimac.c +++ b/sys/dev/netif/bwi/bwimac.c @@ -826,7 +826,7 @@ bwi_fwimage_is_valid(struct bwi_softc *sc, const struct fw_image *fw, struct ifnet *ifp = &sc->sc_ic.ic_if; if (fw->fw_imglen < sizeof(*hdr)) { - if_printf(ifp, "invalid firmware (%s): invalid size %u\n", + if_printf(ifp, "invalid firmware (%s): invalid size %zu\n", fw->fw_name, fw->fw_imglen); return 0; } @@ -838,9 +838,10 @@ bwi_fwimage_is_valid(struct bwi_softc *sc, const struct fw_image *fw, * Don't verify IV's size, it has different meaning */ if (be32toh(hdr->fw_size) != fw->fw_imglen - sizeof(*hdr)) { - if_printf(ifp, "invalid firmware (%s): size mismatch, " - "fw %u, real %u\n", fw->fw_name, - be32toh(hdr->fw_size), + if_printf(ifp, + "invalid firmware (%s): size mismatch, " + "fw %u, real %zu\n", + fw->fw_name, be32toh(hdr->fw_size), fw->fw_imglen - sizeof(*hdr)); return 0; } diff --git a/sys/dev/netif/iwi/if_iwi.c b/sys/dev/netif/iwi/if_iwi.c index d5d705d280..30e5cc7e7e 100644 --- a/sys/dev/netif/iwi/if_iwi.c +++ b/sys/dev/netif/iwi/if_iwi.c @@ -2134,8 +2134,10 @@ iwi_alloc_firmware(struct iwi_softc *sc, enum ieee80211_opmode opmode) length_sum = le32toh(hdr->bsize) + le32toh(hdr->usize) + le32toh(hdr->fsize); if (length_sum + sizeof(*hdr) != image->fw_imglen) { - if_printf(ifp, "%s size mismatch, %u/hdr %u\n", image->fw_name, - fw->fw_image->fw_imglen, length_sum + sizeof(*hdr)); + if_printf(ifp, + "%s size mismatch, %zu/hdr %zu\n", + image->fw_name, fw->fw_image->fw_imglen, + length_sum + sizeof(*hdr)); goto back; } diff --git a/sys/dev/netif/iwl/iwl2100.c b/sys/dev/netif/iwl/iwl2100.c index 9fbdda2b90..2a781fe2fb 100644 --- a/sys/dev/netif/iwl/iwl2100.c +++ b/sys/dev/netif/iwl/iwl2100.c @@ -1285,8 +1285,9 @@ iwl2100_alloc_firmware(struct iwl2100_softc *sc, enum ieee80211_opmode opmode) if (hdr->data_size + hdr->ucode_size + sizeof(*hdr) != image->fw_imglen) { - if_printf(ifp, "%s size mismatch, %u/hdr %u\n", image->fw_name, - fw->fw_image->fw_imglen, + if_printf(ifp, + "%s size mismatch, %zu/hdr %zu\n", + image->fw_name, fw->fw_image->fw_imglen, hdr->data_size + hdr->ucode_size + sizeof(*hdr)); goto back; } diff --git a/sys/dev/netif/my/if_my.c b/sys/dev/netif/my/if_my.c index cdd1a3fe09..838d0d17bc 100644 --- a/sys/dev/netif/my/if_my.c +++ b/sys/dev/netif/my/if_my.c @@ -872,7 +872,7 @@ my_attach(device_t dev) sc->my_ldata_ptr = kmalloc(sizeof(struct my_list_data) + 8, M_DEVBUF, M_WAITOK); sc->my_ldata = (struct my_list_data *) sc->my_ldata_ptr; - round = (unsigned int)sc->my_ldata_ptr & 0xF; + round = (uintptr_t)sc->my_ldata_ptr & 0xF; roundptr = sc->my_ldata_ptr; for (i = 0; i < 8; i++) { if (round % 8) { diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index dc7b92ceae..71e62b13f4 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -1582,7 +1582,7 @@ siodivisor(u_long rclk, speed_t speed) u_int divisor; int error; - if (speed == 0 || speed > (ULONG_MAX - 1) / 8) + if (speed == 0 || speed > ((speed_t)-1 - 1) / 8) return (0); divisor = (rclk / (8UL * speed) + 1) / 2; if (divisor == 0 || divisor >= 65536) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 2de62c8348..a779ee7ff2 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -490,7 +490,7 @@ next_registered_randintr(int intr) static void sched_ithd_remote(void *arg) { - sched_ithd((int)arg); + sched_ithd((int)(intptr_t)arg); } #endif @@ -516,7 +516,7 @@ sched_ithd(int intr) } } else { lwkt_send_ipiq(info->i_thread.td_gd, - sched_ithd_remote, (void *)intr); + sched_ithd_remote, (void *)(intptr_t)intr); } #else if (info->i_running == 0) { diff --git a/sys/kern/kern_p1003_1b.c b/sys/kern/kern_p1003_1b.c index bbb5b39d19..2906e1df6e 100644 --- a/sys/kern/kern_p1003_1b.c +++ b/sys/kern/kern_p1003_1b.c @@ -179,7 +179,7 @@ sys_sched_setparam(struct sched_setparam_args *uap) if ((e = p31b_proc(p, uap->pid, &p)) == 0) { lp = FIRST_LWP_IN_PROC(p); /* XXX lwp */ - e = ksched_setparam(&uap->sysmsg_result, ksched, lp, + e = ksched_setparam(&uap->sysmsg_reg, ksched, lp, (const struct sched_param *)&sched_param); } return e; @@ -203,7 +203,7 @@ sys_sched_getparam(struct sched_getparam_args *uap) } lp = FIRST_LWP_IN_PROC(targetp); /* XXX lwp */ - e = ksched_getparam(&uap->sysmsg_result, ksched, lp, &sched_param); + e = ksched_getparam(&uap->sysmsg_reg, ksched, lp, &sched_param); if (!e) copyout(&sched_param, uap->param, sizeof(sched_param)); @@ -223,7 +223,7 @@ sys_sched_setscheduler(struct sched_setscheduler_args *uap) if ((e = p31b_proc(p, uap->pid, &p)) == 0) { lp = FIRST_LWP_IN_PROC(p); /* XXX lwp */ - e = ksched_setscheduler(&uap->sysmsg_result, ksched, lp, + e = ksched_setscheduler(&uap->sysmsg_reg, ksched, lp, uap->policy, (const struct sched_param *)&sched_param); } return e; @@ -246,7 +246,7 @@ sys_sched_getscheduler(struct sched_getscheduler_args *uap) } lp = FIRST_LWP_IN_PROC(targetp); /* XXX lwp */ - e = ksched_getscheduler(&uap->sysmsg_result, ksched, lp); + e = ksched_getscheduler(&uap->sysmsg_reg, ksched, lp); return e; } @@ -254,19 +254,19 @@ sys_sched_getscheduler(struct sched_getscheduler_args *uap) int sys_sched_yield(struct sched_yield_args *uap) { - return ksched_yield(&uap->sysmsg_result, ksched); + return ksched_yield(&uap->sysmsg_reg, ksched); } int sys_sched_get_priority_max(struct sched_get_priority_max_args *uap) { - return ksched_get_priority_max(&uap->sysmsg_result, ksched, uap->policy); + return ksched_get_priority_max(&uap->sysmsg_reg, ksched, uap->policy); } int sys_sched_get_priority_min(struct sched_get_priority_min_args *uap) { - return ksched_get_priority_min(&uap->sysmsg_result, ksched, uap->policy); + return ksched_get_priority_min(&uap->sysmsg_reg, ksched, uap->policy); } int @@ -277,8 +277,8 @@ sys_sched_rr_get_interval(struct sched_rr_get_interval_args *uap) struct lwp *lp = curthread->td_lwp; if ((e = p31b_proc(p, uap->pid, &p)) == 0) { - e = ksched_rr_get_interval(&uap->sysmsg_result, ksched, - lp, uap->interval); + e = ksched_rr_get_interval(&uap->sysmsg_reg, ksched, + lp, uap->interval); } return e; } diff --git a/sys/net/netisr.c b/sys/net/netisr.c index f8a2f6e587..c35c371cba 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -501,10 +501,12 @@ schednetisr(int num) KASSERT((num > 0 && num <= (sizeof(netisrs)/sizeof(netisrs[0]))), ("schednetisr: bad isr %d", num)); #ifdef SMP - if (mycpu->gd_cpuid != 0) - lwkt_send_ipiq(globaldata_find(0), schednetisr_remote, (void *)num); - else + if (mycpu->gd_cpuid != 0) { + lwkt_send_ipiq(globaldata_find(0), + schednetisr_remote, (void *)(intptr_t)num); + } else { schednetisr_remote((void *)(intptr_t)num); + } #else schednetisr_remote((void *)(intptr_t)num); #endif diff --git a/sys/net/tun/if_tun.c b/sys/net/tun/if_tun.c index 7b5654e79f..e7d6b78533 100644 --- a/sys/net/tun/if_tun.c +++ b/sys/net/tun/if_tun.c @@ -585,7 +585,7 @@ tunwrite(struct dev_write_args *ap) return 0; if (uio->uio_resid > TUNMRU) { - TUNDEBUG(ifp, "len=%d!\n", uio->uio_resid); + TUNDEBUG(ifp, "len=%zd!\n", uio->uio_resid); return EIO; } tlen = uio->uio_resid; diff --git a/sys/platform/pc64/acpica5/acpi_wakeup.c b/sys/platform/pc64/acpica5/acpi_wakeup.c index f83138e426..3e75242bb8 100644 --- a/sys/platform/pc64/acpica5/acpi_wakeup.c +++ b/sys/platform/pc64/acpica5/acpi_wakeup.c @@ -57,7 +57,6 @@ #endif extern uint32_t acpi_reset_video; -extern void initializecpu(void); static struct region_descriptor r_idt, r_gdt, *p_gdt; static uint16_t r_ldt; diff --git a/sys/platform/pc64/amd64/autoconf.c b/sys/platform/pc64/amd64/autoconf.c index 504ac81722..8ddea8c447 100644 --- a/sys/platform/pc64/amd64/autoconf.c +++ b/sys/platform/pc64/amd64/autoconf.c @@ -151,8 +151,6 @@ configure(void *dummy) static void configure_final(void *dummy) { - int i; - cninit_finish(); if (bootverbose) { @@ -164,6 +162,7 @@ configure_final(void *dummy) /* * Print out the BIOS's idea of the disk geometries. */ + int i; kprintf("BIOS Geometries:\n"); for (i = 0; i < N_BIOS_GEOM; i++) { unsigned long bios_geom; diff --git a/sys/platform/pc64/amd64/db_trace.c b/sys/platform/pc64/amd64/db_trace.c index 1e49b10209..f50c0cfc70 100644 --- a/sys/platform/pc64/amd64/db_trace.c +++ b/sys/platform/pc64/amd64/db_trace.c @@ -660,15 +660,14 @@ static void dl_symbol_values(long callpc, const char **name) { +#if 0 Dl_info info; - -/* if (*name == NULL) { if (dladdr((const void *)callpc, &info) != 0) { if (info.dli_saddr <= (const void *)callpc) *name = info.dli_sname; } } -*/ +#endif } diff --git a/sys/platform/pc64/amd64/est.c b/sys/platform/pc64/amd64/est.c index 0bd2055f8b..dec59004ea 100644 --- a/sys/platform/pc64/amd64/est.c +++ b/sys/platform/pc64/amd64/est.c @@ -683,7 +683,7 @@ est_init(void) est_fqlist = findcpu(hwmodel, mv); if (est_fqlist == NULL) { kprintf(" - unknown CPU or operating point" - "(cpu_id:%#x, msr:%#llx).\n", cpu_id, msr); + "(cpu_id:%#x, msr:%#jx).\n", cpu_id, (intmax_t)msr); return(EOPNOTSUPP); } diff --git a/sys/platform/pc64/amd64/exception.S b/sys/platform/pc64/amd64/exception.S index a0c8c93521..7b72b33afd 100644 --- a/sys/platform/pc64/amd64/exception.S +++ b/sys/platform/pc64/amd64/exception.S @@ -45,6 +45,7 @@ #include #include #include +#include #include "assym.s" diff --git a/sys/platform/pc64/amd64/genassym.c b/sys/platform/pc64/amd64/genassym.c index 776f23ab89..8d6930a0e1 100644 --- a/sys/platform/pc64/amd64/genassym.c +++ b/sys/platform/pc64/amd64/genassym.c @@ -227,7 +227,7 @@ ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL)); ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL)); ASSYM(KUCSEL, GSEL(GUCODE_SEL, SEL_UPL)); ASSYM(KUDSEL, GSEL(GUDATA_SEL, SEL_UPL)); -ASSYM(SEL_RPL_MASK, SEL_RPL_MASK); +/*ASSYM(SEL_RPL_MASK, SEL_RPL_MASK);*/ ASSYM(MSR_GSBASE, MSR_GSBASE); ASSYM(MSR_KGSBASE, MSR_KGSBASE); diff --git a/sys/platform/pc64/amd64/initcpu.c b/sys/platform/pc64/amd64/initcpu.c index 77dadcf35d..8c6771a9c1 100644 --- a/sys/platform/pc64/amd64/initcpu.c +++ b/sys/platform/pc64/amd64/initcpu.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/sys/platform/pc64/amd64/machdep.c b/sys/platform/pc64/amd64/machdep.c index b3519f99dd..bb59973b7d 100644 --- a/sys/platform/pc64/amd64/machdep.c +++ b/sys/platform/pc64/amd64/machdep.c @@ -131,9 +131,6 @@ extern void identify_cpu(void); extern void finishidentcpu(void); #endif extern void panicifcpuunsupported(void); -extern void initializecpu(void); - -extern void init_paging(vm_paddr_t *); static void cpu_startup(void *); #ifndef CPU_DISABLE_SSE @@ -292,7 +289,9 @@ cpu_startup(void *dummy) #ifdef PERFMON perfmon_init(); #endif - kprintf("real memory = %llu (%lluK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); + kprintf("real memory = %ju (%juK bytes)\n", + (intmax_t)ptoa(Maxmem), + (intmax_t)ptoa(Maxmem) / 1024); /* * Display any holes after the first chunk of extended memory. */ @@ -303,9 +302,11 @@ cpu_startup(void *dummy) for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { vm_paddr_t size1 = phys_avail[indx + 1] - phys_avail[indx]; - kprintf("0x%08llx - 0x%08llx, %llu bytes (%llu pages)\n", - phys_avail[indx], phys_avail[indx + 1] - 1, size1, - size1 / PAGE_SIZE); + kprintf("0x%08jx - 0x%08jx, %ju bytes (%ju pages)\n", + (intmax_t)phys_avail[indx], + (intmax_t)phys_avail[indx + 1] - 1, + (intmax_t)size1, + (intmax_t)(size1 / PAGE_SIZE)); } } diff --git a/sys/platform/pc64/amd64/mp_machdep.c b/sys/platform/pc64/amd64/mp_machdep.c index c532aa8322..3ffde67c4e 100644 --- a/sys/platform/pc64/amd64/mp_machdep.c +++ b/sys/platform/pc64/amd64/mp_machdep.c @@ -269,14 +269,11 @@ extern pt_entry_t *KPTphys; (SMP_MAXCPU * sizeof(struct privatespace) / PAGE_SIZE) extern pt_entry_t *SMPpt; -static int SMPpt_alloc_index = IO_MAPPING_START_INDEX; struct pcb stoppcbs[MAXCPU]; extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); -extern void initializecpu(void); - /* * Local data and functions. */ @@ -300,7 +297,9 @@ static void setup_apic_irq_mapping(void); static int apic_int_is_bus_type(int intr, int bus_type); #endif static int start_all_aps(u_int boot_addr); +#if 0 static void install_ap_tramp(u_int boot_addr); +#endif static int start_ap(struct mdglobaldata *gd, u_int boot_addr); static cpumask_t smp_startup_mask = 1; /* which cpus have been started */ @@ -413,11 +412,11 @@ mp_announce(void) kprintf("DragonFly/MP: Multiprocessor motherboard\n"); kprintf(" cpu0 (BSP): apic id: %2d", CPU_TO_ID(0)); kprintf(", version: 0x%08x", cpu_apic_versions[0]); - kprintf(", at 0x%08x\n", cpu_apic_address); + kprintf(", at 0x%08jx\n", (intmax_t)cpu_apic_address); for (x = 1; x <= mp_naps; ++x) { kprintf(" cpu%d (AP): apic id: %2d", x, CPU_TO_ID(x)); kprintf(", version: 0x%08x", cpu_apic_versions[x]); - kprintf(", at 0x%08x\n", cpu_apic_address); + kprintf(", at 0x%08jx\n", (intmax_t)cpu_apic_address); } #if defined(APIC_IO) @@ -786,8 +785,9 @@ mptable_pass1(void) #endif /* APIC_IO */ } else { - if ((cth = mpfps->pap) == 0) + if (mpfps->pap == 0) panic("MP Configuration Table Header MISSING!"); + cth = (void *)mpfps->pap; cpu_apic_address = (vm_offset_t) cth->apic_address; @@ -935,10 +935,10 @@ mptable_pass2(void) if (mpfps->mpfb1 != 0) return mpfps->mpfb1; /* return default configuration type */ - if ((cth = mpfps->pap) == 0) + if (mpfps->pap == 0) panic("MP Configuration Table Header MISSING!"); - cth = PHYS_TO_DMAP(mpfps->pap); + cth = (void *)PHYS_TO_DMAP(mpfps->pap); /* walk the table, recording info of interest */ totalSize = cth->base_table_length - sizeof(struct MPCTH); position = (u_char *) cth + sizeof(struct MPCTH); @@ -2068,8 +2068,6 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; struct mdglobaldata *gd; struct privatespace *ps; - char *stack; - uintptr_t kptbase; POSTCODE(START_ALL_APS_POST); @@ -2079,7 +2077,7 @@ start_all_aps(u_int boot_addr) /* install the AP 1st level boot code */ pmap_kenter(va, boot_address); - cpu_invlpg(va); /* JG XXX */ + cpu_invlpg((void *)va); /* JG XXX */ bcopy(mptramp_start, (void *)va, bootMP_size); /* Locate the page tables, they'll be below the trampoline */ @@ -2124,26 +2122,6 @@ start_all_aps(u_int boot_addr) /* allocate new private data page(s) */ gd = (struct mdglobaldata *)kmem_alloc(&kernel_map, MDGLOBALDATA_BASEALLOC_SIZE); -#if JGXXX - /* wire it into the private page table page */ - for (i = 0; i < MDGLOBALDATA_BASEALLOC_SIZE; i += PAGE_SIZE) { - SMPpt[pg + i / PAGE_SIZE] = (pt_entry_t) - (PG_V | PG_RW | vtophys_pte((char *)gd + i)); - } - pg += MDGLOBALDATA_BASEALLOC_PAGES; - - SMPpt[pg + 0] = 0; /* *gd_CMAP1 */ - SMPpt[pg + 1] = 0; /* *gd_CMAP2 */ - SMPpt[pg + 2] = 0; /* *gd_CMAP3 */ - SMPpt[pg + 3] = 0; /* *gd_PMAP1 */ - - /* allocate and set up an idle stack data page */ - stack = (char *)kmem_alloc(&kernel_map, UPAGES*PAGE_SIZE); - for (i = 0; i < UPAGES; i++) { - SMPpt[pg + 4 + i] = (pt_entry_t) - (PG_V | PG_RW | vtophys_pte(PAGE_SIZE * i + stack)); - } -#endif gd = &CPU_prvspace[x].mdglobaldata; /* official location */ bzero(gd, sizeof(*gd)); @@ -2159,7 +2137,7 @@ start_all_aps(u_int boot_addr) gd->gd_CADDR1 = ps->CPAGE1; gd->gd_CADDR2 = ps->CPAGE2; gd->gd_CADDR3 = ps->CPAGE3; - gd->gd_PADDR1 = (unsigned *)ps->PPAGE1; + gd->gd_PADDR1 = (pt_entry_t *)ps->PPAGE1; gd->mi.gd_ipiq = (void *)kmem_alloc(&kernel_map, sizeof(lwkt_ipiq) * (mp_naps + 1)); bzero(gd->mi.gd_ipiq, sizeof(lwkt_ipiq) * (mp_naps + 1)); @@ -2248,6 +2226,8 @@ extern void MPentry(void); extern u_int MP_GDT; extern u_int mp_gdtbase; +#if 0 + static void install_ap_tramp(u_int boot_addr) { @@ -2295,6 +2275,7 @@ install_ap_tramp(u_int boot_addr) *dst8 = ((u_int) boot_addr >> 16) & 0xff; } +#endif /* * this function starts the AP (application processor) identified diff --git a/sys/platform/pc64/amd64/npx.c b/sys/platform/pc64/amd64/npx.c index ef547b12ec..b467dac8f4 100644 --- a/sys/platform/pc64/amd64/npx.c +++ b/sys/platform/pc64/amd64/npx.c @@ -102,20 +102,9 @@ static void fpu_clean_state(void); static struct krate badfprate = { 1 }; -static int npx_attach (device_t dev); static void fpusave (union savefpu *); static void fpurstor (union savefpu *); -/* - * Attach routine - announce which it is, and wire into system - */ -int -npx_attach(device_t dev) -{ - npxinit(__INITIAL_NPXCW__); - return (0); -} - /* * Initialize the floating point unit. */ @@ -149,6 +138,7 @@ npxexit(void) npxsave(curthread->td_savefpu); } +#if 0 /* * The following mechanism is used to ensure that the FPE_... value * that is passed as a trapcode to the signal handler of the user @@ -320,6 +310,8 @@ static char fpetable[128] = { FPE_FLTSUB, /* 7F - INV | DNML | DZ | OFL | UFL | IMP | STK */ }; +#endif + #if 0 /* diff --git a/sys/platform/pc64/amd64/pmap.c b/sys/platform/pc64/amd64/pmap.c index d2c7e9a7b5..9af119dc41 100644 --- a/sys/platform/pc64/amd64/pmap.c +++ b/sys/platform/pc64/amd64/pmap.c @@ -124,12 +124,6 @@ #define MINPV 2048 -#if !defined(PMAP_DIAGNOSTIC) -#define PMAP_INLINE __inline -#else -#define PMAP_INLINE -#endif - /* * Get PDEs and PTEs for user/kernel address space */ @@ -209,22 +203,20 @@ extern uint64_t SMPptpa; #define DISABLE_PSE -static PMAP_INLINE void free_pv_entry (pv_entry_t pv); static pv_entry_t get_pv_entry (void); -static void i386_protection_init (void); -static __inline void pmap_clearbit (vm_page_t m, int bit); - -static void pmap_remove_all (vm_page_t m); -static void pmap_enter_quick (pmap_t pmap, vm_offset_t va, vm_page_t m); -static int pmap_remove_pte (struct pmap *pmap, pt_entry_t *ptq, +static void i386_protection_init (void); +static void create_pagetables(vm_paddr_t *firstaddr); +static void pmap_remove_all (vm_page_t m); +static void pmap_enter_quick (pmap_t pmap, vm_offset_t va, vm_page_t m); +static int pmap_remove_pte (struct pmap *pmap, pt_entry_t *ptq, vm_offset_t sva, pmap_inval_info_t info); static void pmap_remove_page (struct pmap *pmap, vm_offset_t va, pmap_inval_info_t info); -static int pmap_remove_entry (struct pmap *pmap, vm_page_t m, +static int pmap_remove_entry (struct pmap *pmap, vm_page_t m, vm_offset_t va, pmap_inval_info_t info); static boolean_t pmap_testbit (vm_page_t m, int bit); static void pmap_insert_entry (pmap_t pmap, vm_offset_t va, - vm_page_t mpte, vm_page_t m); + vm_page_t mpte, vm_page_t m); static vm_page_t pmap_allocpte (pmap_t pmap, vm_offset_t va); @@ -232,8 +224,8 @@ static int pmap_release_free_page (pmap_t pmap, vm_page_t p); static vm_page_t _pmap_allocpte (pmap_t pmap, vm_pindex_t ptepindex); static pt_entry_t * pmap_pte_quick (pmap_t pmap, vm_offset_t va); static vm_page_t pmap_page_lookup (vm_object_t object, vm_pindex_t pindex); -static int pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, - pmap_inval_info_t info); +static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, + pmap_inval_info_t info); static int pmap_unuse_pt (pmap_t, vm_offset_t, vm_page_t, pmap_inval_info_t); static vm_offset_t pmap_kmem_choose(vm_offset_t addr); @@ -245,7 +237,8 @@ static unsigned pdir4mb; * by using a large (2MB) page for much of the kernel * (.text, .data, .bss) */ -static vm_offset_t +static +vm_offset_t pmap_kmem_choose(vm_offset_t addr) { vm_offset_t newaddr = addr; @@ -266,42 +259,48 @@ pmap_kmem_choose(vm_offset_t addr) */ static __inline pt_entry_t *pmap_pte(pmap_t pmap, vm_offset_t va); -static pt_entry_t * +static +pt_entry_t * pmap_pte_quick(pmap_t pmap, vm_offset_t va) { return pmap_pte(pmap, va); } /* Return a non-clipped PD index for a given VA */ -static __inline vm_pindex_t +static __inline +vm_pindex_t pmap_pde_pindex(vm_offset_t va) { return va >> PDRSHIFT; } /* Return various clipped indexes for a given VA */ -static __inline vm_pindex_t +static __inline +vm_pindex_t pmap_pte_index(vm_offset_t va) { return ((va >> PAGE_SHIFT) & ((1ul << NPTEPGSHIFT) - 1)); } -static __inline vm_pindex_t +static __inline +vm_pindex_t pmap_pde_index(vm_offset_t va) { return ((va >> PDRSHIFT) & ((1ul << NPDEPGSHIFT) - 1)); } -static __inline vm_pindex_t +static __inline +vm_pindex_t pmap_pdpe_index(vm_offset_t va) { return ((va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1)); } -static __inline vm_pindex_t +static __inline +vm_pindex_t pmap_pml4e_index(vm_offset_t va) { @@ -309,7 +308,8 @@ pmap_pml4e_index(vm_offset_t va) } /* Return a pointer to the PML4 slot that corresponds to a VA */ -static __inline pml4_entry_t * +static __inline +pml4_entry_t * pmap_pml4e(pmap_t pmap, vm_offset_t va) { @@ -317,7 +317,8 @@ pmap_pml4e(pmap_t pmap, vm_offset_t va) } /* Return a pointer to the PDP slot that corresponds to a VA */ -static __inline pdp_entry_t * +static __inline +pdp_entry_t * pmap_pml4e_to_pdpe(pml4_entry_t *pml4e, vm_offset_t va) { pdp_entry_t *pdpe; @@ -327,7 +328,8 @@ pmap_pml4e_to_pdpe(pml4_entry_t *pml4e, vm_offset_t va) } /* Return a pointer to the PDP slot that corresponds to a VA */ -static __inline pdp_entry_t * +static __inline +pdp_entry_t * pmap_pdpe(pmap_t pmap, vm_offset_t va) { pml4_entry_t *pml4e; @@ -339,7 +341,8 @@ pmap_pdpe(pmap_t pmap, vm_offset_t va) } /* Return a pointer to the PD slot that corresponds to a VA */ -static __inline pd_entry_t * +static __inline +pd_entry_t * pmap_pdpe_to_pde(pdp_entry_t *pdpe, vm_offset_t va) { pd_entry_t *pde; @@ -349,7 +352,8 @@ pmap_pdpe_to_pde(pdp_entry_t *pdpe, vm_offset_t va) } /* Return a pointer to the PD slot that corresponds to a VA */ -static __inline pd_entry_t * +static __inline +pd_entry_t * pmap_pde(pmap_t pmap, vm_offset_t va) { pdp_entry_t *pdpe; @@ -361,7 +365,8 @@ pmap_pde(pmap_t pmap, vm_offset_t va) } /* Return a pointer to the PT slot that corresponds to a VA */ -static __inline pt_entry_t * +static __inline +pt_entry_t * pmap_pde_to_pte(pd_entry_t *pde, vm_offset_t va) { pt_entry_t *pte; @@ -371,7 +376,8 @@ pmap_pde_to_pte(pd_entry_t *pde, vm_offset_t va) } /* Return a pointer to the PT slot that corresponds to a VA */ -static __inline pt_entry_t * +static __inline +pt_entry_t * pmap_pte(pmap_t pmap, vm_offset_t va) { pd_entry_t *pde; @@ -384,8 +390,8 @@ pmap_pte(pmap_t pmap, vm_offset_t va) return (pmap_pde_to_pte(pde, va)); } - -PMAP_INLINE pt_entry_t * +static __inline +pt_entry_t * vtopte(vm_offset_t va) { uint64_t mask = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + NPML4EPGSHIFT)) - 1); @@ -393,7 +399,8 @@ vtopte(vm_offset_t va) return (PTmap + ((va >> PAGE_SHIFT) & mask)); } -static __inline pd_entry_t * +static __inline +pd_entry_t * vtopde(vm_offset_t va) { uint64_t mask = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + NPML4EPGSHIFT)) - 1); @@ -412,13 +419,11 @@ allocpages(vm_paddr_t *firstaddr, int n) return (ret); } +static void create_pagetables(vm_paddr_t *firstaddr) { int i; - int count; - uint64_t cpu0pp, cpu0idlestk; - int idlestk_page_offset = offsetof(struct privatespace, idlestack) / PAGE_SIZE; /* we are running (mostly) V=P at this point */ @@ -522,7 +527,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) vm_offset_t va; pt_entry_t *pte; struct mdglobaldata *gd; - int i; int pg; KvaStart = VM_MIN_KERNEL_ADDRESS; @@ -779,7 +783,8 @@ pmap_init2(void) * This code checks for non-writeable/modified pages. * This should be an invalid condition. */ -static int +static +int pmap_nw_modified(pt_entry_t pte) { if ((pte & (PG_M|PG_RW)) == PG_M) @@ -794,7 +799,8 @@ pmap_nw_modified(pt_entry_t pte) * this routine defines the region(s) of memory that should * not be tested for the modified bit. */ -static PMAP_INLINE int +static __inline +int pmap_track_modified(vm_offset_t va) { if ((va < clean_sva) || (va >= clean_eva)) @@ -1081,7 +1087,8 @@ pmap_qremove(vm_offset_t va, int count) * the call should be made with a critical section held so the page's object * association remains valid on return. */ -static vm_page_t +static +vm_page_t pmap_page_lookup(vm_object_t object, vm_pindex_t pindex) { vm_page_t m; @@ -1132,8 +1139,24 @@ pmap_dispose_proc(struct proc *p) * This routine unholds page table pages, and if the hold count * drops to zero, then it decrements the wire count. */ -static int -_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, pmap_inval_info_t info) +static __inline +int +pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, + pmap_inval_info_t info) +{ + KKASSERT(m->hold_count > 0); + if (m->hold_count > 1) { + vm_page_unhold(m); + return 0; + } else { + return _pmap_unwire_pte_hold(pmap, va, m, info); + } +} + +static +int +_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, + pmap_inval_info_t info) { /* * Wait until we can busy the page ourselves. We cannot have @@ -1215,23 +1238,12 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, pmap_inval_info_ } } -static PMAP_INLINE int -pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, pmap_inval_info_t info) -{ - KKASSERT(m->hold_count > 0); - if (m->hold_count > 1) { - vm_page_unhold(m); - return 0; - } else { - return _pmap_unwire_pte_hold(pmap, va, m, info); - } -} - /* * After removing a page table entry, this routine is used to * conditionally free the page, and manage the hold/wire counts. */ -static int +static +int pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t mpte, pmap_inval_info_t info) { @@ -1255,7 +1267,6 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t mpte, } #endif } - return pmap_unwire_pte_hold(pmap, va, mpte, info); } @@ -1348,7 +1359,7 @@ pmap_puninit(pmap_t pmap) KKASSERT(pmap->pm_active == 0); if ((p = pmap->pm_pdirm) != NULL) { KKASSERT(pmap->pm_pml4 != NULL); - KKASSERT(pmap->pm_pml4 != (PTOV_OFFSET + KPML4phys)); + KKASSERT(pmap->pm_pml4 != (void *)(PTOV_OFFSET + KPML4phys)); pmap_kremove((vm_offset_t)pmap->pm_pml4); p->wire_count--; vmstats.v_wire_count--; @@ -1358,7 +1369,7 @@ pmap_puninit(pmap_t pmap) pmap->pm_pdirm = NULL; } if (pmap->pm_pml4) { - KKASSERT(pmap->pm_pml4 != (PTOV_OFFSET + KPML4phys)); + KKASSERT(pmap->pm_pml4 != (void *)(PTOV_OFFSET + KPML4phys)); kmem_free(&kernel_map, (vm_offset_t)pmap->pm_pml4, PAGE_SIZE); pmap->pm_pml4 = NULL; } @@ -1391,10 +1402,10 @@ pmap_pinit2(struct pmap *pmap) * leave it cached so we do not have to incur the SMP inval overhead of * removing the kernel mapping. pmap_puninit() will take care of it. */ -static int +static +int pmap_release_free_page(struct pmap *pmap, vm_page_t p) { - pml4_entry_t *pml4 = pmap->pm_pml4; /* * This code optimizes the case of freeing non-busy * page-table pages. Those pages are zero now, and @@ -1420,7 +1431,7 @@ pmap_release_free_page(struct pmap *pmap, vm_page_t p) */ vm_page_t m4 = vm_page_lookup(pmap->pm_pteobj, NUPDE + NUPDPE + PML4PML4I); KKASSERT(m4 != NULL); - pml4_entry_t *pml4 = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m4)); + pml4_entry_t *pml4 = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m4)); int idx = (p->pindex - (NUPDE + NUPDPE)) % NPML4EPG; KKASSERT(pml4[idx] != 0); pml4[idx] = 0; @@ -1433,7 +1444,7 @@ pmap_release_free_page(struct pmap *pmap, vm_page_t p) */ vm_page_t m3 = vm_page_lookup(pmap->pm_pteobj, NUPDE + NUPDPE + (p->pindex - NUPDE) / NPDPEPG); KKASSERT(m3 != NULL); - pdp_entry_t *pdp = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m3)); + pdp_entry_t *pdp = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m3)); int idx = (p->pindex - NUPDE) % NPDPEPG; KKASSERT(pdp[idx] != 0); pdp[idx] = 0; @@ -1445,7 +1456,7 @@ pmap_release_free_page(struct pmap *pmap, vm_page_t p) */ vm_page_t m2 = vm_page_lookup(pmap->pm_pteobj, NUPDE + p->pindex / NPDEPG); KKASSERT(m2 != NULL); - pd_entry_t *pd = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m2)); + pd_entry_t *pd = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m2)); int idx = p->pindex % NPDEPG; pd[idx] = 0; m2->hold_count--; @@ -1482,7 +1493,8 @@ pmap_release_free_page(struct pmap *pmap, vm_page_t p) * This routine is called when various levels in the page table need to * be populated. This routine cannot fail. */ -static vm_page_t +static +vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex) { vm_page_t m; @@ -1649,7 +1661,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex) return (m); } -static vm_page_t +static +vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va) { vm_pindex_t ptepindex; @@ -1741,7 +1754,8 @@ pmap_release(struct pmap *pmap) } while (info.error); } -static int +static +int pmap_release_callback(struct vm_page *p, void *data) { struct rb_vm_page_scan_info *info = data; @@ -1764,12 +1778,10 @@ pmap_release_callback(struct vm_page *p, void *data) /* * Grow the number of kernel page table entries, if needed. */ - void pmap_growkernel(vm_offset_t addr) { vm_paddr_t paddr; - struct pmap *pmap; vm_offset_t ptppaddr; vm_page_t nkpg; pd_entry_t *pde, newpdir; @@ -1883,7 +1895,8 @@ pmap_reference(pmap_t pmap) * free the pv_entry back to the free list. This function may be * called from an interrupt. */ -static PMAP_INLINE void +static __inline +void free_pv_entry(pv_entry_t pv) { pv_entry_count--; @@ -1895,7 +1908,8 @@ free_pv_entry(pv_entry_t pv) * get a new pv_entry, allocating a block from the system * when needed. This function may be called from an interrupt. */ -static pv_entry_t +static +pv_entry_t get_pv_entry(void) { pv_entry_count++; @@ -1944,7 +1958,8 @@ pmap_collect(void) * to the header. Otherwise we must search the list for * the entry. In either case we free the now unused entry. */ -static int +static +int pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va, pmap_inval_info_t info) { @@ -1985,7 +2000,8 @@ pmap_remove_entry(struct pmap *pmap, vm_page_t m, * Create a pv entry for page at pa for * (pmap, va). */ -static void +static +void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m) { pv_entry_t pv; @@ -2006,7 +2022,8 @@ pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m) /* * pmap_remove_pte: do the things to unmap a page in a process */ -static int +static +int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, pmap_inval_info_t info) { @@ -2057,7 +2074,8 @@ pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va, * This function may not be called from an interrupt if the pmap is * not kernel_pmap. */ -static void +static +void pmap_remove_page(struct pmap *pmap, vm_offset_t va, pmap_inval_info_t info) { pt_entry_t *pte; @@ -2188,7 +2206,8 @@ pmap_remove(struct pmap *pmap, vm_offset_t sva, vm_offset_t eva) * This routine may not be called from an interrupt. */ -static void +static +void pmap_remove_all(vm_page_t m) { struct pmap_inval_info info; @@ -2545,7 +2564,8 @@ validate: * * This code currently may only be used on user pmaps, not kernel_pmap. */ -static void +static +void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m) { pt_entry_t *pte; @@ -2922,8 +2942,10 @@ pmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired) */ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, - vm_size_t len, vm_offset_t src_addr) + vm_size_t len, vm_offset_t src_addr) { + return; +#if 0 pmap_inval_info info; vm_offset_t addr; vm_offset_t end_addr = src_addr + len; @@ -2933,16 +2955,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, if (dst_addr != src_addr) return; - /* - * XXX BUGGY. Amoung other things srcmpte is assumed to remain - * valid through blocking calls, and that's just not going to - * be the case. - * - * FIXME! - */ - return; - -#if 0 #if JGPMAP32 src_frame = src_pmap->pm_pdir[PTDPTDI] & PG_FRAME; if (src_frame != (PTDpde & PG_FRAME)) { @@ -3099,19 +3111,14 @@ pmap_zero_page(vm_paddr_t phys) void pmap_page_assertzero(vm_paddr_t phys) { - struct mdglobaldata *gd = mdcpu; - int i; - - crit_enter(); vm_offset_t virt = PHYS_TO_DMAP(phys); + int i; - for (i = 0; i < PAGE_SIZE; i += sizeof(int)) { - if (*(int *)((char *)virt + i) != 0) { - panic("pmap_page_assertzero() @ %p not zero!\n", - (void *)virt); + for (i = 0; i < PAGE_SIZE; i += sizeof(long)) { + if (*(long *)((char *)virt + i) != 0) { + panic("pmap_page_assertzero() @ %p not zero!\n", (void *)virt); } } - crit_exit(); } /* @@ -3125,12 +3132,9 @@ pmap_page_assertzero(vm_paddr_t phys) void pmap_zero_page_area(vm_paddr_t phys, int off, int size) { - struct mdglobaldata *gd = mdcpu; - - crit_enter(); vm_offset_t virt = PHYS_TO_DMAP(phys); + bzero((char *)virt + off, size); - crit_exit(); } /* @@ -3145,11 +3149,9 @@ pmap_copy_page(vm_paddr_t src, vm_paddr_t dst) { vm_offset_t src_virt, dst_virt; - crit_enter(); src_virt = PHYS_TO_DMAP(src); dst_virt = PHYS_TO_DMAP(dst); - bcopy(src_virt, dst_virt, PAGE_SIZE); - crit_exit(); + bcopy((void *)src_virt, (void *)dst_virt, PAGE_SIZE); } /* @@ -3164,13 +3166,12 @@ pmap_copy_page_frag(vm_paddr_t src, vm_paddr_t dst, size_t bytes) { vm_offset_t src_virt, dst_virt; - crit_enter(); src_virt = PHYS_TO_DMAP(src); dst_virt = PHYS_TO_DMAP(dst); + bcopy((char *)src_virt + (src & PAGE_MASK), (char *)dst_virt + (dst & PAGE_MASK), bytes); - crit_exit(); } /* @@ -3301,7 +3302,8 @@ pmap_remove_pages(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) * note that the testbit/clearbit routines are inline, * and a lot of things compile-time evaluate. */ -static boolean_t +static +boolean_t pmap_testbit(vm_page_t m, int bit) { pv_entry_t pv; @@ -3345,7 +3347,8 @@ pmap_testbit(vm_page_t m, int bit) /* * this routine is used to modify bits in ptes */ -static __inline void +static __inline +void pmap_clearbit(vm_page_t m, int bit) { struct pmap_inval_info info; @@ -3547,7 +3550,8 @@ pmap_clear_reference(vm_page_t m) * Miscellaneous support routines follow */ -static void +static +void i386_protection_init(void) { int *kp, prot; @@ -3791,7 +3795,8 @@ static void pads (pmap_t pm); void pmap_pvdump (vm_paddr_t pa); /* print address space of pmap*/ -static void +static +void pads(pmap_t pm) { vm_offset_t va; diff --git a/sys/platform/pc64/amd64/trap.c b/sys/platform/pc64/amd64/trap.c index dd036f0503..e1b98b0e92 100644 --- a/sys/platform/pc64/amd64/trap.c +++ b/sys/platform/pc64/amd64/trap.c @@ -79,6 +79,7 @@ #include #include #include +#include #include #include diff --git a/sys/platform/pc64/apic/apic_vector.s b/sys/platform/pc64/apic/apic_vector.s index 7a3635420e..32dd04846b 100644 --- a/sys/platform/pc64/apic/apic_vector.s +++ b/sys/platform/pc64/apic/apic_vector.s @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/sys/platform/pc64/apic/mpapic.c b/sys/platform/pc64/apic/mpapic.c index 9fc3deed5a..bda6fc2f26 100644 --- a/sys/platform/pc64/apic/mpapic.c +++ b/sys/platform/pc64/apic/mpapic.c @@ -38,6 +38,8 @@ #include /* Xspuriousint() */ +#include "apicvar.h" + /* EISA Edge/Level trigger control registers */ #define ELCR0 0x4d0 /* eisa irq 0-7 */ #define ELCR1 0x4d1 /* eisa irq 8-15 */ diff --git a/sys/platform/pc64/conf/files b/sys/platform/pc64/conf/files index 2b6a29d03a..77d6ed0bcd 100644 --- a/sys/platform/pc64/conf/files +++ b/sys/platform/pc64/conf/files @@ -141,7 +141,7 @@ bus/pci/amd64/mptable_pci.c optional pci smp apic_io # notyet (BIOS struct and functions) #bus/pci/amd64/pci_pir.c optional pci -platform/pc64/amd64/init.c standard +#platform/pc64/amd64/init.c standard platform/pc64/amd64/globaldata.c standard platform/pc64/amd64/pmap.c standard platform/pc64/amd64/pmap_inval.c standard diff --git a/sys/platform/pc64/icu/icu_vector.s b/sys/platform/pc64/icu/icu_vector.s index d73b7256ec..b10ef36d54 100644 --- a/sys/platform/pc64/icu/icu_vector.s +++ b/sys/platform/pc64/icu/icu_vector.s @@ -42,6 +42,7 @@ #include #include #include +#include #include #include diff --git a/sys/platform/pc64/include/md_var.h b/sys/platform/pc64/include/md_var.h index 067909fe8d..8b3a3f238a 100644 --- a/sys/platform/pc64/include/md_var.h +++ b/sys/platform/pc64/include/md_var.h @@ -44,6 +44,7 @@ extern u_long atdevbase; /* offset in virtual memory of ISA io mem */ extern u_int basemem; extern int busdma_swi_pending; extern void (*cpu_idle_hook)(void); +extern void cpu_idle(void); extern u_int cpu_exthigh; extern u_int amd_feature; extern u_int amd_feature2; @@ -74,7 +75,6 @@ void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); void enable_sse(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); void pagezero(void *addr); -int isa_nmi(int cd); void pagecopy(void *from, void *to); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); int user_dbreg_trap(void); diff --git a/sys/platform/pc64/include/pmap.h b/sys/platform/pc64/include/pmap.h index f77c2fe3f8..4e615e34a1 100644 --- a/sys/platform/pc64/include/pmap.h +++ b/sys/platform/pc64/include/pmap.h @@ -150,16 +150,6 @@ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ #endif #ifdef _KERNEL -/* - * virtual address to page table entry and - * to physical address. Likewise for alternate address space. - * Note: these work recursively, thus vtopte of a pte will give - * the corresponding pde that in turn maps it. - */ -pt_entry_t *vtopte(vm_offset_t); - -#define avtopte(va) (APTmap + amd64_btop(va)) - /* * XXX @@ -259,6 +249,7 @@ extern vm_offset_t clean_eva; extern vm_offset_t clean_sva; extern char *ptvmmap; /* poor name! */ +void init_paging(vm_paddr_t *); void pmap_bootstrap ( vm_paddr_t *); void *pmap_mapdev (vm_paddr_t, vm_size_t); void *pmap_mapdev_uncacheable(vm_paddr_t, vm_size_t); diff --git a/sys/platform/pc64/include/smp.h b/sys/platform/pc64/include/smp.h index fdfa12f401..91142fee0b 100644 --- a/sys/platform/pc64/include/smp.h +++ b/sys/platform/pc64/include/smp.h @@ -135,6 +135,7 @@ int read_apic_timer (void); void u_sleep (int); void cpu_send_ipiq (int); int cpu_send_ipiq_passive (int); +void initializecpu(void); /* global data in init_smp.c */ extern cpumask_t smp_active_mask; diff --git a/sys/platform/pc64/include/vmparam.h b/sys/platform/pc64/include/vmparam.h index 86c467e146..7e5ff5549a 100644 --- a/sys/platform/pc64/include/vmparam.h +++ b/sys/platform/pc64/include/vmparam.h @@ -124,8 +124,8 @@ #define USRSTACK VM_MAX_USER_ADDRESS -#define PHYS_TO_DMAP(x) ((x) | DMAP_MIN_ADDRESS) -#define DMAP_TO_PHYS(x) ((x) & ~DMAP_MIN_ADDRESS) +#define PHYS_TO_DMAP(x) ((vm_offset_t)(x) | DMAP_MIN_ADDRESS) +#define DMAP_TO_PHYS(x) ((vm_paddr_t)(x) & ~DMAP_MIN_ADDRESS) /* initial pagein size of beginning of executable file */ #ifndef VM_INITIAL_PAGEIN diff --git a/sys/platform/pc64/isa/intr_machdep.c b/sys/platform/pc64/isa/intr_machdep.c index 635878d364..f97434968c 100644 --- a/sys/platform/pc64/isa/intr_machdep.c +++ b/sys/platform/pc64/isa/intr_machdep.c @@ -263,7 +263,7 @@ isa_irq_pending(void) void forward_fastint_remote(void *arg) { - int irq = (int)arg; + int irq = (int)(intptr_t)arg; struct mdglobaldata *gd = mdcpu; atomic_set_int_nonlocked(&gd->gd_fpending, 1 << irq); diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index 184d86eac9..56cc0cd738 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -643,8 +643,8 @@ tryagain: if (error == 0 && sio.sb_cc != len) { if (sio.sb_cc != 0) log(LOG_INFO, - "short receive (%d/%d) from nfs server %s\n", - len - auio.uio_resid, len, + "short receive (%zu/%d) from nfs server %s\n", + (size_t)len - auio.uio_resid, len, nmp->nm_mountp->mnt_stat.f_mntfromname); error = EPIPE; } diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index ae5f4c4926..5536efed00 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -749,7 +749,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *m, int bytecount, } if (auio.uio_resid) { krateprintf(&vresrate, - "vnode_pager_putpages: residual I/O %d at %lu\n", + "vnode_pager_putpages: residual I/O %zd at %lu\n", auio.uio_resid, (u_long)m[0]->pindex); } for (i = 0; i < ncount; i++)