summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-10-13 08:24:45 +0000
committerdg <dg@FreeBSD.org>1998-10-13 08:24:45 +0000
commit3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d (patch)
tree64822d97637c55a2d7aeb4a999c847a5869bac46 /sys/amd64
parent3280e5edc1739224a3e662ea57aa1746d1eb9105 (diff)
downloadFreeBSD-src-3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d.zip
FreeBSD-src-3defb6d13f481d8c8bb2d9014db42c8a5ee19f9d.tar.gz
Fixed two potentially serious classes of bugs:
1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/busdma_machdep.c8
-rw-r--r--sys/amd64/amd64/vm_machdep.c6
-rw-r--r--sys/amd64/isa/isa.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c
index d900e9b..d35967e 100644
--- a/sys/amd64/amd64/busdma_machdep.c
+++ b/sys/amd64/amd64/busdma_machdep.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: busdma_machdep.c,v 1.9 1998/09/29 09:06:00 bde Exp $
+ * $Id: busdma_machdep.c,v 1.10 1998/10/07 03:38:14 gibbs Exp $
*/
#include <sys/param.h>
@@ -138,8 +138,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->parent = parent;
newtag->boundary = boundary;
- newtag->lowaddr = trunc_page(lowaddr) + (PAGE_SIZE - 1);
- newtag->highaddr = trunc_page(highaddr) + (PAGE_SIZE - 1);
+ newtag->lowaddr = trunc_page((vm_offset_t)lowaddr) + (PAGE_SIZE - 1);
+ newtag->highaddr = trunc_page((vm_offset_t)highaddr) + (PAGE_SIZE - 1);
newtag->filter = filter;
newtag->filterarg = filterarg;
newtag->maxsize = maxsize;
@@ -395,7 +395,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
* Count the number of bounce pages
* needed in order to complete this transfer
*/
- vaddr = trunc_page(buf);
+ vaddr = trunc_page((vm_offset_t)buf);
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index fb0e601..de8b52c 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $Id: vm_machdep.c,v 1.110 1998/09/25 17:34:48 peter Exp $
+ * $Id: vm_machdep.c,v 1.111 1998/09/28 03:34:39 tegge Exp $
*/
#include "npx.h"
@@ -341,7 +341,7 @@ vmapbuf(bp)
if ((bp->b_flags & B_PHYS) == 0)
panic("vmapbuf");
- for (v = bp->b_saveaddr, addr = (caddr_t)trunc_page(bp->b_data);
+ for (v = bp->b_saveaddr, addr = (caddr_t)trunc_page((vm_offset_t)bp->b_data);
addr < bp->b_data + bp->b_bufsize;
addr += PAGE_SIZE, v += PAGE_SIZE) {
/*
@@ -376,7 +376,7 @@ vunmapbuf(bp)
if ((bp->b_flags & B_PHYS) == 0)
panic("vunmapbuf");
- for (addr = (caddr_t)trunc_page(bp->b_data);
+ for (addr = (caddr_t)trunc_page((vm_offset_t)bp->b_data);
addr < bp->b_data + bp->b_bufsize;
addr += PAGE_SIZE) {
pa = trunc_page(pmap_kextract((vm_offset_t) addr));
diff --git a/sys/amd64/isa/isa.c b/sys/amd64/isa/isa.c
index c9852d9..eb28093 100644
--- a/sys/amd64/isa/isa.c
+++ b/sys/amd64/isa/isa.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
- * $Id: isa.c,v 1.113 1998/07/19 04:22:55 bde Exp $
+ * $Id: isa.c,v 1.114 1998/10/12 13:12:45 bde Exp $
*/
/*
@@ -900,7 +900,7 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan)
vm_offset_t phys, priorpage = 0, endva;
u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
- endva = (vm_offset_t)round_page(va + length);
+ endva = (vm_offset_t)round_page((vm_offset_t)va + length);
for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
#define ISARAM_END RAM_END
OpenPOWER on IntegriCloud