summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-03-30 05:24:52 +0000
committerjake <jake@FreeBSD.org>2003-03-30 05:24:52 +0000
commitabd082c83338e1987726a6ef68574de92e2b5ce7 (patch)
tree41325c88af7f4552023a9b5c8da9296a899c3f45 /sys/amd64/include
parent751b8b88db5312dc1394b1ddadf537cbe79765d8 (diff)
downloadFreeBSD-src-abd082c83338e1987726a6ef68574de92e2b5ce7.zip
FreeBSD-src-abd082c83338e1987726a6ef68574de92e2b5ce7.tar.gz
- Add support for PAE and more than 4 gigs of ram on x86, dependent on the
kernel opition 'options PAE'. This will only work with device drivers which either use busdma, or are able to handle 64 bit physical addresses. Thanks to Lanny Baron from FreeBSD Systems for the loan of a test machine with 6 gigs of ram. Sponsored by: DARPA, Network Associates Laboratories, FreeBSD Systems
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/bus_amd64.h12
-rw-r--r--sys/amd64/include/bus_at386.h12
-rw-r--r--sys/amd64/include/pmap.h56
3 files changed, 74 insertions, 6 deletions
diff --git a/sys/amd64/include/bus_amd64.h b/sys/amd64/include/bus_amd64.h
index 20d21ec..e1f6e8e 100644
--- a/sys/amd64/include/bus_amd64.h
+++ b/sys/amd64/include/bus_amd64.h
@@ -92,15 +92,23 @@
/*
* Bus address and size types
*/
-typedef u_int bus_addr_t;
-typedef u_int bus_size_t;
+#ifdef PAE
+typedef uint64_t bus_addr_t;
+#else
+typedef uint32_t bus_addr_t;
+#endif
+typedef uint32_t bus_size_t;
#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
#define BUS_SPACE_MAXSIZE 0xFFFFFFFF
#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
+#ifdef PAE
+#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFULL
+#else
#define BUS_SPACE_MAXADDR 0xFFFFFFFF
+#endif
#define BUS_SPACE_UNRESTRICTED (~0)
diff --git a/sys/amd64/include/bus_at386.h b/sys/amd64/include/bus_at386.h
index 20d21ec..e1f6e8e 100644
--- a/sys/amd64/include/bus_at386.h
+++ b/sys/amd64/include/bus_at386.h
@@ -92,15 +92,23 @@
/*
* Bus address and size types
*/
-typedef u_int bus_addr_t;
-typedef u_int bus_size_t;
+#ifdef PAE
+typedef uint64_t bus_addr_t;
+#else
+typedef uint32_t bus_addr_t;
+#endif
+typedef uint32_t bus_size_t;
#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
#define BUS_SPACE_MAXSIZE 0xFFFFFFFF
#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
+#ifdef PAE
+#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFULL
+#else
#define BUS_SPACE_MAXADDR 0xFFFFFFFF
+#endif
#define BUS_SPACE_UNRESTRICTED (~0)
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index d7f0f66..8fcf2cb 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -88,8 +88,12 @@
* This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc).
*/
#ifndef KVA_PAGES
+#ifdef PAE
+#define KVA_PAGES 512
+#else
#define KVA_PAGES 256
#endif
+#endif
/*
* Pte related macros
@@ -97,8 +101,12 @@
#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT)))
#ifndef NKPT
+#ifdef PAE
+#define NKPT 120 /* actual number of kernel page tables */
+#else
#define NKPT 30 /* actual number of kernel page tables */
#endif
+#endif
#ifndef NKPDE
#ifdef SMP
#define NKPDE (KVA_PAGES - (NPGPTD + 1)) /* number of page tables/pde's */
@@ -134,12 +142,25 @@
#include <sys/queue.h>
-typedef u_int32_t pd_entry_t;
-typedef u_int32_t pt_entry_t;
+#ifdef PAE
+
+typedef uint64_t pdpt_entry_t;
+typedef uint64_t pd_entry_t;
+typedef uint64_t pt_entry_t;
+
+#define PTESHIFT (3)
+#define PDESHIFT (3)
+
+#else
+
+typedef uint32_t pd_entry_t;
+typedef uint32_t pt_entry_t;
#define PTESHIFT (2)
#define PDESHIFT (2)
+#endif
+
/*
* Address of current and alternate address space page table maps
* and directories.
@@ -149,6 +170,9 @@ extern pt_entry_t PTmap[], APTmap[];
extern pd_entry_t PTD[], APTD[];
extern pd_entry_t PTDpde[], APTDpde[];
+#ifdef PAE
+extern pdpt_entry_t *IdlePDPT;
+#endif
extern pd_entry_t *IdlePTD; /* physical address of "Idle" state directory */
#endif
@@ -183,6 +207,30 @@ pmap_kextract(vm_offset_t va)
}
#define vtophys(va) pmap_kextract(((vm_offset_t) (va)))
+
+#ifdef PAE
+
+static __inline pt_entry_t
+pte_load_clear(pt_entry_t *pte)
+{
+ pt_entry_t r;
+
+ r = *pte;
+ __asm __volatile(
+ "1:\n"
+ "\tcmpxchg8b %1\n"
+ "\tjnz 1b"
+ : "+A" (r)
+ : "m" (*pte), "b" (0), "c" (0));
+ return (r);
+}
+
+#else
+
+#define pte_load_clear(pte) atomic_readandclear_int(pte)
+
+#endif
+
#endif
/*
@@ -202,6 +250,10 @@ struct pmap {
int pm_active; /* active on cpus */
struct pmap_statistics pm_stats; /* pmap statistics */
LIST_ENTRY(pmap) pm_list; /* List of all pmaps */
+#ifdef PAE
+ pdpt_entry_t *pm_pdpt; /* KVA of page director pointer
+ table */
+#endif
};
#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
OpenPOWER on IntegriCloud