Module Name: src
Committed By: snj
Date: Sat Jan 30 19:14:21 UTC 2010
Modified Files:
src/sys/arch/xen/x86 [netbsd-5]: xen_bus_dma.c
src/sys/arch/xen/xen [netbsd-5]: xengnt.c xennetback_xenbus.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1271):
sys/arch/xen/x86/xen_bus_dma.c: revision 1.16
sys/arch/xen/xen/xengnt.c: revision 1.17 via patch
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.33
fix address overflow with 32bit PAE.
Reported and tested by Mark Davies on port-...@.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/xen/x86/xen_bus_dma.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/arch/xen/xen/xengnt.c
cvs rdiff -u -r1.24.4.2 -r1.24.4.3 src/sys/arch/xen/xen/xennetback_xenbus.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/x86/xen_bus_dma.c
diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.11 src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.1
--- src/sys/arch/xen/x86/xen_bus_dma.c:1.11 Wed Jun 4 12:41:42 2008
+++ src/sys/arch/xen/x86/xen_bus_dma.c Sat Jan 30 19:14:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_bus_dma.c,v 1.11 2008/06/04 12:41:42 ad Exp $ */
+/* $NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $ */
/* NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
/*-
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.11 2008/06/04 12:41:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,8 +85,8 @@
KASSERT(npages >= npagesreq);
/* get npages from UWM, and give them back to the hypervisor */
- error = uvm_pglistalloc(npages << PAGE_SHIFT, 0, avail_end, 0, 0,
- mlistp, npages, (flags & BUS_DMA_NOWAIT) == 0);
+ error = uvm_pglistalloc(((psize_t)npages) << PAGE_SHIFT,
+ 0, avail_end, 0, 0, mlistp, npages, (flags & BUS_DMA_NOWAIT) == 0);
if (error)
return (error);
@@ -161,7 +161,7 @@
pa = VM_PAGE_TO_PHYS(pg);
xpmap_phys_to_machine_mapping[
(pa - XPMAP_OFFSET) >> PAGE_SHIFT] = mfn+i;
- xpq_queue_machphys_update((mfn+i) << PAGE_SHIFT, pa);
+ xpq_queue_machphys_update(((paddr_t)(mfn+i)) << PAGE_SHIFT, pa);
/* while here, give extra pages back to UVM */
if (i >= npagesreq) {
TAILQ_REMOVE(mlistp, pg, pageq.queue);
@@ -217,7 +217,7 @@
pa = VM_PAGE_TO_PHYS(pg);
xpmap_phys_to_machine_mapping[
(pa - XPMAP_OFFSET) >> PAGE_SHIFT] = mfn;
- xpq_queue_machphys_update((mfn) << PAGE_SHIFT, pa);
+ xpq_queue_machphys_update(((paddr_t)mfn) << PAGE_SHIFT, pa);
TAILQ_REMOVE(mlistp, pg, pageq.queue);
uvm_pagefree(pg);
}
Index: src/sys/arch/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.10 src/sys/arch/xen/xen/xengnt.c:1.10.4.1
--- src/sys/arch/xen/xen/xengnt.c:1.10 Sat Oct 25 17:12:29 2008
+++ src/sys/arch/xen/xen/xengnt.c Sat Jan 30 19:14:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: xengnt.c,v 1.10 2008/10/25 17:12:29 jym Exp $ */
+/* $NetBSD: xengnt.c,v 1.10.4.1 2010/01/30 19:14:20 snj Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.10 2008/10/25 17:12:29 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.10.4.1 2010/01/30 19:14:20 snj Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -125,14 +125,14 @@
xengnt_more_entries()
{
gnttab_setup_table_t setup;
- unsigned long *pages;
+ u_long *pages;
int nframes_new = gnt_nr_grant_frames + 1;
int i;
if (gnt_nr_grant_frames == gnt_max_grant_frames)
return ENOMEM;
- pages = malloc(nframes_new * sizeof(long), M_DEVBUF, M_NOWAIT);
+ pages = malloc(nframes_new * sizeof(u_long), M_DEVBUF, M_NOWAIT);
if (pages == NULL)
return ENOMEM;
@@ -163,7 +163,7 @@
* the grant table frames
*/
pmap_kenter_ma(((vaddr_t)grant_table) + gnt_nr_grant_frames * PAGE_SIZE,
- pages[gnt_nr_grant_frames] << PAGE_SHIFT, VM_PROT_WRITE);
+ ((paddr_t)pages[gnt_nr_grant_frames]) << PAGE_SHIFT, VM_PROT_WRITE);
/*
* add the grant entries associated to the last grant table frame
Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.2 src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.3
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.2 Mon Sep 28 01:47:49 2009
+++ src/sys/arch/xen/xen/xennetback_xenbus.c Sat Jan 30 19:14:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: xennetback_xenbus.c,v 1.24.4.2 2009/09/28 01:47:49 snj Exp $ */
+/* $NetBSD: xennetback_xenbus.c,v 1.24.4.3 2010/01/30 19:14:20 snj Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -604,7 +604,7 @@
*/
return -1;
- *map = mcl_pages[mcl_pages_alloc] << PAGE_SHIFT;
+ *map = ((paddr_t)mcl_pages[mcl_pages_alloc]) << PAGE_SHIFT;
mcl_pages_alloc--;
return 0;