2001-09-03 22:27:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1991 Regents of the University of California.
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2001-09-03 22:27:23 +00:00
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department and William Jolitz of UUNET Technologies Inc.
|
|
|
|
*
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2001-09-03 22:27:23 +00:00
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
*
|
2001-09-03 22:27:23 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
2001-09-03 22:27:23 +00:00
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
2001-09-03 22:27:23 +00:00
|
|
|
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
|
|
|
|
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
|
|
|
|
* from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MACHINE_PMAP_H_
|
|
|
|
#define _MACHINE_PMAP_H_
|
|
|
|
|
2002-10-01 02:50:26 +00:00
|
|
|
#include <sys/queue.h>
|
2004-08-10 20:53:26 +00:00
|
|
|
#include <sys/_lock.h>
|
|
|
|
#include <sys/_mutex.h>
|
2003-03-19 06:55:37 +00:00
|
|
|
#include <machine/cache.h>
|
2001-07-31 06:05:05 +00:00
|
|
|
#include <machine/tte.h>
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2001-07-31 06:05:05 +00:00
|
|
|
#define PMAP_CONTEXT_MAX 8192
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2001-07-31 06:05:05 +00:00
|
|
|
typedef struct pmap *pmap_t;
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2001-09-05 05:18:35 +00:00
|
|
|
struct md_page {
|
2002-12-21 22:43:19 +00:00
|
|
|
TAILQ_HEAD(, tte) tte_list;
|
|
|
|
struct pmap *pmap;
|
|
|
|
uint32_t colors[DCACHE_COLORS];
|
|
|
|
int32_t color;
|
|
|
|
uint32_t flags;
|
2001-07-31 06:05:05 +00:00
|
|
|
};
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2001-09-05 05:18:35 +00:00
|
|
|
struct pmap {
|
2004-08-10 20:53:26 +00:00
|
|
|
struct mtx pm_mtx;
|
2001-12-29 08:19:24 +00:00
|
|
|
struct tte *pm_tsb;
|
|
|
|
vm_object_t pm_tsb_obj;
|
2001-07-31 06:05:05 +00:00
|
|
|
u_int pm_active;
|
2002-02-26 06:57:30 +00:00
|
|
|
u_int pm_context[MAXCPU];
|
2001-07-31 06:05:05 +00:00
|
|
|
struct pmap_statistics pm_stats;
|
|
|
|
};
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2004-08-10 20:53:26 +00:00
|
|
|
#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
|
|
|
|
#define PMAP_LOCK_ASSERT(pmap, type) \
|
|
|
|
mtx_assert(&(pmap)->pm_mtx, (type))
|
|
|
|
#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
|
|
|
|
#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
|
|
|
|
NULL, MTX_DEF)
|
|
|
|
#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx)
|
|
|
|
#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
|
|
|
|
#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
|
|
|
|
#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
|
|
|
|
|
2001-10-20 16:17:04 +00:00
|
|
|
void pmap_bootstrap(vm_offset_t ekva);
|
2003-04-08 06:35:09 +00:00
|
|
|
vm_paddr_t pmap_kextract(vm_offset_t va);
|
|
|
|
void pmap_kenter(vm_offset_t va, vm_page_t m);
|
2003-03-16 04:16:03 +00:00
|
|
|
void pmap_kremove(vm_offset_t);
|
2003-04-08 06:35:09 +00:00
|
|
|
void pmap_kenter_flags(vm_offset_t va, vm_paddr_t pa, u_long flags);
|
2002-06-25 15:13:09 +00:00
|
|
|
void pmap_kremove_flags(vm_offset_t va);
|
2004-05-09 19:09:14 +00:00
|
|
|
boolean_t pmap_page_is_mapped(vm_page_t m);
|
2001-10-12 15:49:51 +00:00
|
|
|
|
2001-12-29 08:19:24 +00:00
|
|
|
int pmap_cache_enter(vm_page_t m, vm_offset_t va);
|
|
|
|
void pmap_cache_remove(vm_page_t m, vm_offset_t va);
|
|
|
|
|
2002-05-29 06:08:45 +00:00
|
|
|
int pmap_remove_tte(struct pmap *pm1, struct pmap *pm2, struct tte *tp,
|
|
|
|
vm_offset_t va);
|
|
|
|
int pmap_protect_tte(struct pmap *pm1, struct pmap *pm2, struct tte *tp,
|
|
|
|
vm_offset_t va);
|
|
|
|
|
2002-01-08 05:06:39 +00:00
|
|
|
void pmap_map_tsb(void);
|
|
|
|
|
2002-05-29 06:08:45 +00:00
|
|
|
void pmap_clear_write(vm_page_t m);
|
|
|
|
|
2002-08-16 01:35:00 +00:00
|
|
|
#define vtophys(va) pmap_kextract(((vm_offset_t)(va)))
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
|
2001-12-29 08:19:24 +00:00
|
|
|
extern struct pmap kernel_pmap_store;
|
|
|
|
#define kernel_pmap (&kernel_pmap_store)
|
2003-04-08 06:35:09 +00:00
|
|
|
extern vm_paddr_t phys_avail[];
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
extern vm_offset_t virtual_avail;
|
|
|
|
extern vm_offset_t virtual_end;
|
2001-12-29 08:19:24 +00:00
|
|
|
|
2003-04-08 06:35:09 +00:00
|
|
|
extern vm_paddr_t msgbuf_phys;
|
2001-10-20 16:17:04 +00:00
|
|
|
|
2001-08-03 01:27:15 +00:00
|
|
|
static __inline int
|
2001-12-29 08:19:24 +00:00
|
|
|
pmap_track_modified(pmap_t pm, vm_offset_t va)
|
2001-08-03 01:27:15 +00:00
|
|
|
{
|
2001-12-29 08:19:24 +00:00
|
|
|
if (pm == kernel_pmap)
|
|
|
|
return ((va < kmi.clean_sva) || (va >= kmi.clean_eva));
|
|
|
|
else
|
|
|
|
return (1);
|
2001-08-03 01:27:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-05 05:30:40 +00:00
|
|
|
#ifdef PMAP_STATS
|
|
|
|
|
|
|
|
SYSCTL_DECL(_debug_pmap_stats);
|
|
|
|
|
|
|
|
#define PMAP_STATS_VAR(name) \
|
|
|
|
static long name; \
|
2003-04-06 18:17:31 +00:00
|
|
|
SYSCTL_LONG(_debug_pmap_stats, OID_AUTO, name, CTLFLAG_RW, \
|
2003-01-05 05:30:40 +00:00
|
|
|
&name, 0, "")
|
|
|
|
|
|
|
|
#define PMAP_STATS_INC(var) \
|
|
|
|
atomic_add_long(&var, 1)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define PMAP_STATS_VAR(name)
|
|
|
|
#define PMAP_STATS_INC(var)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
Add skeleton machine dependent headers and c files for a port of freebsd
to a new architecture. This is the base of the sparc64 port, but contains
limited machine dependent code, and can be used a base for ports. Included
are:
- standard machine dependent headers, tweaked for a 64 bit, big endian
architecture, including empty versions of all the machine dependent
structures
- a machine independent atomic.h, which can be used until a port has
support for interrupts and the operations really need to be atomic
- stub versions of all the machine dependent functions, which panic
when called and print out the name of the function that needs to
be implemented. functions which are normally in assembly files are
not included, but this should reduce the number of different undefined
references on the first few compiles from hundreds to 5 or 6
Given minimal startup code and console support it should be trivial to
make this compile and run the first few sysinits on almost any architecture.
Requested by: alfred, imp, jhb
2001-07-31 05:45:16 +00:00
|
|
|
#endif /* !_MACHINE_PMAP_H_ */
|