make paddr_t 64bit on arc port by introducing _MIPS_PADDR_T_64BIT.

This commit is contained in:
soda 2000-06-09 04:36:43 +00:00
parent f587c1c5bf
commit b1438dd751
8 changed files with 61 additions and 43 deletions

View File

@ -1,7 +1,9 @@
/* $NetBSD: types.h,v 1.7 2000/02/05 00:13:23 cgd Exp $ */
/* $NetBSD: types.h,v 1.8 2000/06/09 04:36:43 soda Exp $ */
/* $OpenBSD: types.h,v 1.2 1997/04/19 17:19:59 pefo Exp $ */
/* NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp */
#define _MIPS_PADDR_T_64BIT
#include <mips/types.h>
#define __BROKEN_CONFIG_UNIT_USAGE

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips1_pte.h,v 1.11 1999/05/27 01:56:32 nisimura Exp $ */
/* $NetBSD: mips1_pte.h,v 1.12 2000/06/09 04:37:51 soda Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -95,4 +95,4 @@ unsigned int pg_prot:2, /* SW: access control */
#define mips1_vad_to_pfn(x) (x)
#define MIPS1_PTE_TO_PADDR(pte) ((unsigned)(pte) & MIPS1_PG_FRAME)
#define MIPS1_PAGE_IS_RDONLY(pte,va) ((pte) & MIPS1_PG_RO)
#define MIPS1_PAGE_IS_RDONLY(pte,va) ((int)(pte) & MIPS1_PG_RO)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips3_pte.h,v 1.11 2000/03/27 02:55:13 nisimura Exp $ */
/* $NetBSD: mips3_pte.h,v 1.12 2000/06/09 04:37:51 soda Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -117,10 +117,9 @@ struct tlb {
/* pte accessor macros */
#define mips3_pfn_is_ext(x) ((x) & 0x3c000000)
#define mips3_vad_to_pfn(x) (((unsigned)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
#define mips3_vad_to_pfn64(x) (((quad_t)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
#define mips3_pfn_to_vad(x) (((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
#define mips3_vad_to_vpn(x) ((unsigned)(x) & MIPS3_PG_SVPN)
#define mips3_vad_to_pfn(x) (((paddr_t)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
#define mips3_pfn_to_vad(x) ((paddr_t)((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
#define mips3_vad_to_vpn(x) ((vaddr_t)(x) & MIPS3_PG_SVPN)
#define mips3_vpn_to_vad(x) ((x) & MIPS3_PG_SVPN)
#define MIPS3_PTE_TO_PADDR(pte) (mips3_pfn_to_vad(pte))

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips_param.h,v 1.19 2000/03/27 02:55:14 nisimura Exp $ */
/* $NetBSD: mips_param.h,v 1.20 2000/06/09 04:37:51 soda Exp $ */
#ifdef _KERNEL
#include <machine/cpu.h>
@ -75,5 +75,5 @@
*/
#define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
#define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
#define mips_btop(x) ((unsigned)(x) >> PGSHIFT)
#define mips_ptob(x) ((unsigned)(x) << PGSHIFT)
#define mips_btop(x) ((paddr_t)(x) >> PGSHIFT)
#define mips_ptob(x) ((paddr_t)(x) << PGSHIFT)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pte.h,v 1.8 1999/05/28 07:23:38 nisimura Exp $ */
/* $NetBSD: pte.h,v 1.9 2000/06/09 04:37:51 soda Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -140,11 +140,11 @@ static __inline unsigned int
mips_pg_ropage_bit(void),
mips_pg_cwpage_bit(void),
mips_pg_rwpage_bit(void),
mips_pg_global_bit(void),
PTE_TO_PADDR(unsigned int entry);
mips_pg_global_bit(void);
static __inline paddr_t PTE_TO_PADDR(unsigned int pte);
static __inline vaddr_t pfn_to_vad(unsigned int x);
static __inline int vad_to_pfn(vaddr_t x);
static __inline paddr_t pfn_to_vad(unsigned int pfn);
static __inline unsigned int vad_to_pfn(paddr_t pa);
static __inline int
@ -230,7 +230,7 @@ mips_pg_wired_bit()
return (MIPS1_PG_WIRED);
}
static __inline unsigned int
static __inline paddr_t
PTE_TO_PADDR(pte)
unsigned int pte;
{
@ -249,22 +249,22 @@ PAGE_IS_RDONLY(pte, va)
return (MIPS1_PAGE_IS_RDONLY(pte, va));
}
static __inline vaddr_t
pfn_to_vad(x)
unsigned int x;
static __inline paddr_t
pfn_to_vad(pfn)
unsigned int pfn;
{
if (CPUISMIPS3)
return (mips3_pfn_to_vad(x));
return (mips1_pfn_to_vad(x));
return (mips3_pfn_to_vad(pfn));
return (mips1_pfn_to_vad(pfn));
}
static __inline int
vad_to_pfn(x)
vaddr_t x;
static __inline unsigned int
vad_to_pfn(pa)
paddr_t pa;
{
if (CPUISMIPS3)
return (mips3_vad_to_pfn(x));
return (mips1_vad_to_pfn(x));
return (mips3_vad_to_pfn(pa));
return (mips1_vad_to_pfn(pa));
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: types.h,v 1.23 2000/06/06 02:24:02 soren Exp $ */
/* $NetBSD: types.h,v 1.24 2000/06/09 04:37:51 soda Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -72,8 +72,13 @@ typedef struct label_t {
/* NB: This should probably be if defined(_KERNEL) */
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
#ifdef _MIPS_PADDR_T_64BIT
typedef unsigned long long paddr_t;
typedef unsigned long long psize_t;
#else
typedef unsigned long paddr_t;
typedef unsigned long psize_t;
#endif
typedef unsigned long vaddr_t;
typedef unsigned long vsize_t;
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.97 2000/05/09 13:40:13 shin Exp $ */
/* $NetBSD: pmap.c,v 1.98 2000/06/09 04:37:52 soda Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2000/05/09 13:40:13 shin Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2000/06/09 04:37:52 soda Exp $");
/*
* Manages physical address maps.
@ -704,7 +704,7 @@ pmap_remove(pmap, sva, eva)
/* remove entries from kernel pmap */
#ifdef PARANOIADIAG
if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
if (sva < VM_MIN_KERNEL_ADDRESS || eva >= virtual_end)
panic("pmap_remove: kva not in range");
#endif
pte = kvtopte(sva);
@ -893,7 +893,7 @@ pmap_protect(pmap, sva, eva, prot)
* read-only.
*/
#ifdef PARANOIADIAG
if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
if (sva < VM_MIN_KERNEL_ADDRESS || eva >= virtual_end)
panic("pmap_protect: kva not in range");
#endif
pte = kvtopte(sva);
@ -976,13 +976,16 @@ pmap_procwr(p, va, len)
pmap = p->p_vmspace->vm_map.pmap;
if (CPUISMIPS3) {
#ifdef MIPS3
#if 0
printf("pmap_procwr: va %lx len %lx\n", va, len);
#endif
MachFlushDCache(va, len);
MachFlushICache(MIPS_PHYS_TO_KSEG0(va &
(mips_L1ICacheSize - 1)), len);
#endif /* MIPS3 */
} else {
#ifdef MIPS1
pt_entry_t *pte;
unsigned entry;
@ -996,7 +999,7 @@ printf("pmap_procwr: va %lx", va);
if (!mips_pg_v(entry))
return;
#if 0
printf(" flush %lx", pfn_to_vad(entry) + (va & PGOFSET));
printf(" flush %llx", (long long)pfn_to_vad(entry) + (va & PGOFSET));
#endif
mips1_FlushICache(MIPS_PHYS_TO_KSEG0(mips1_pfn_to_vad(entry)
+ (va & PGOFSET)),
@ -1004,6 +1007,7 @@ printf(" flush %lx", pfn_to_vad(entry) + (va & PGOFSET));
#if 0
printf("\n");
#endif
#endif /* MIPS1 */
}
}
@ -1118,21 +1122,27 @@ pmap_enter(pmap, va, pa, prot, flags)
#ifdef PARANOIADIAG
if (!pmap)
panic("pmap_enter: pmap");
#endif
#if defined(DEBUG) || defined(DIAGNOSTIC) || defined(PARANOIADIAG)
if (pmap == pmap_kernel()) {
#ifdef DEBUG
enter_stats.kernel++;
#endif
if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
panic("pmap_enter: kva");
panic("pmap_enter: kva too big");
} else {
#ifdef DEBUG
enter_stats.user++;
#endif
if (va >= VM_MAXUSER_ADDRESS)
panic("pmap_enter: uva");
panic("pmap_enter: uva too big");
}
if (pa & 0x80000000)
#endif
#ifdef PARANOIADIAG
#if defined(cobalt) || defined(newsmips) || defined(pmax) /* otherwise ok */
if (pa & 0x80000000) /* this is not error in general. */
panic("pmap_enter: pa");
#endif
if (!(prot & VM_PROT_READ))
panic("pmap_enter: prot");
#endif
@ -1847,7 +1857,7 @@ pmap_set_modified(pa)
#endif
}
vaddr_t
paddr_t
pmap_phys_address(ppn)
int ppn;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.138 2000/06/06 18:52:40 soren Exp $ */
/* $NetBSD: trap.c,v 1.139 2000/06/09 04:37:52 soda Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -44,7 +44,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.138 2000/06/06 18:52:40 soren Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139 2000/06/09 04:37:52 soda Exp $");
#include "opt_cputype.h" /* which mips CPU levels do we support? */
#include "opt_inet.h"
@ -430,7 +430,7 @@ trap(status, cause, vaddr, opc, frame)
if (KERNLAND(vaddr)) {
pt_entry_t *pte;
unsigned entry;
vaddr_t pa;
paddr_t pa;
pte = kvtopte(vaddr);
entry = pte->pt_entry;
@ -448,7 +448,8 @@ trap(status, cause, vaddr, opc, frame)
MachTLBUpdate(vaddr, entry);
pa = pfn_to_vad(entry);
if (!IS_VM_PHYSADDR(pa)) {
printf("ktlbmod: va %x pa %lx\n", vaddr, pa);
printf("ktlbmod: va %x pa %llx\n",
vaddr, (long long)pa);
panic("ktlbmod: unmanaged page");
}
pmap_set_modified(pa);
@ -459,7 +460,7 @@ trap(status, cause, vaddr, opc, frame)
{
pt_entry_t *pte;
unsigned entry;
vaddr_t pa;
paddr_t pa;
pmap_t pmap;
pmap = p->p_vmspace->vm_map.pmap;
@ -482,7 +483,8 @@ trap(status, cause, vaddr, opc, frame)
MachTLBUpdate(vaddr, entry);
pa = pfn_to_vad(entry);
if (!IS_VM_PHYSADDR(pa)) {
printf("utlbmod: va %x pa %lx\n", vaddr, pa);
printf("utlbmod: va %x pa %llx\n",
vaddr, (long long)pa);
panic("utlbmod: unmanaged page");
}
pmap_set_modified(pa);