More i386PAE fixes:
- x86_round_page, x86_trunc_page, x86_btop and x86_ptob macros are used with physical addresses; cast to paddr_t instead of u_long. Issue pointed out by jym@ - machine_to_phys_mapping[] is a long. This is fine as it holds page frame numbers (and this fits in a 32bit int as physical addresses are only 36bits), but cast to paddr_t before << PAGE_SHIFT - xen_start_info.store_mfn is a long; cast it to paddr_t before << PAGE_SHIFT. should fix issue pointed out by cegger@
This commit is contained in:
parent
aea22a43d4
commit
f5f016d356
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_memrw.c,v 1.24 2008/04/28 20:23:24 martin Exp $ */
|
||||
/* $NetBSD: db_memrw.c,v 1.25 2009/03/10 20:05:30 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -49,7 +49,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.24 2008/04/28 20:23:24 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.25 2009/03/10 20:05:30 bouyer Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
|
||||
|
@ -125,7 +125,7 @@ db_write_text(vaddr_t addr, size_t size, const char *data)
|
|||
if (oldpte & PG_PS)
|
||||
pgva = (vaddr_t)dst & PG_LGFRAME;
|
||||
else
|
||||
pgva = x86_trunc_page(dst);
|
||||
pgva = x86_trunc_page((vaddr_t)dst);
|
||||
|
||||
/*
|
||||
* Compute number of bytes that can be written
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: param.h,v 1.70 2008/12/20 13:07:36 ad Exp $ */
|
||||
/* $NetBSD: param.h,v 1.71 2009/03/10 20:05:30 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -161,9 +161,9 @@
|
|||
#define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
|
||||
#define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
|
||||
#define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
|
||||
#define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET)
|
||||
#define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET)
|
||||
#define x86_btop(x) ((unsigned long)(x) >> PGSHIFT)
|
||||
#define x86_ptob(x) ((unsigned long)(x) << PGSHIFT)
|
||||
#define x86_round_page(x) ((((paddr_t)(x)) + PGOFSET) & ~PGOFSET)
|
||||
#define x86_trunc_page(x) ((paddr_t)(x) & ~PGOFSET)
|
||||
#define x86_btop(x) ((paddr_t)(x) >> PGSHIFT)
|
||||
#define x86_ptob(x) ((paddr_t)(x) << PGSHIFT)
|
||||
|
||||
#endif /* _I386_PARAM_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xenpmap.h,v 1.21 2008/10/24 22:06:06 jym Exp $ */
|
||||
/* $NetBSD: xenpmap.h,v 1.22 2009/03/10 20:05:31 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -71,15 +71,17 @@ extern unsigned long *xpmap_phys_to_machine_mapping;
|
|||
static __inline paddr_t
|
||||
xpmap_mtop(paddr_t mpa)
|
||||
{
|
||||
return ((machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT) +
|
||||
XPMAP_OFFSET) | (mpa & ~PG_FRAME);
|
||||
return (
|
||||
((paddr_t)machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT)
|
||||
+ XPMAP_OFFSET) | (mpa & ~PG_FRAME);
|
||||
}
|
||||
|
||||
static __inline paddr_t
|
||||
xpmap_mtop_masked(paddr_t mpa)
|
||||
{
|
||||
return ((machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT) +
|
||||
XPMAP_OFFSET);
|
||||
return (
|
||||
((paddr_t)machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT)
|
||||
+ XPMAP_OFFSET);
|
||||
}
|
||||
|
||||
static __inline paddr_t
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xenevt.c,v 1.30 2008/12/17 20:51:33 cegger Exp $ */
|
||||
/* $NetBSD: xenevt.c,v 1.31 2009/03/10 20:05:31 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Manuel Bouyer.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.30 2008/12/17 20:51:33 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.31 2009/03/10 20:05:31 bouyer Exp $");
|
||||
|
||||
#include "opt_xen.h"
|
||||
#include <sys/param.h>
|
||||
|
@ -372,7 +372,7 @@ xenevtmmap(dev_t dev, off_t off, int prot)
|
|||
if (off != 0)
|
||||
return -1;
|
||||
return x86_btop(
|
||||
xpmap_mtop(xen_start_info.store_mfn << PAGE_SHIFT));
|
||||
xpmap_mtop((paddr_t)xen_start_info.store_mfn << PAGE_SHIFT));
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue