summaryrefslogtreecommitdiff
path: root/i386/intel/pmap.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-03 00:50:33 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-03 00:57:24 +0100
commitb9a59e483225093dec4e28ee5841b5b7f5e73562 (patch)
tree3b4b57251c769a90792e4cc10433863497635c89 /i386/intel/pmap.h
parent241317985705f7a4cc81286692322c23fce03104 (diff)
Keep two virtual pages as mapping windows to access physical memory
PCI devices expose their memory etc. way beyond last_phys_addr. Userland drivers opening /dev/mem need to open those too, even if phystokv() will not work for them. * i386/intel/pmap.h (pmap_mapwindow_t): New type. (pmap_get_mapwindow, pmap_put_mapwindow): New prototypes. (PMAP_NMAPWINDOWS): New macro. * i386/intel/pmap.c (mapwindows): New array. (pmap_get_mapwindow, pmap_put_mapwindow): New functions. (pmap_bootstrap, pmap_virtual_space): Reserve virtual pages for the mapping windows. * i386/i386/phys.c: Include <i386/model_dep.h> (INTEL_PTE_W, INTEL_PTE_R): New macros (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Use `pmap_get_mapwindow' to temporarily map physical pages beyond last_phys_addr.
Diffstat (limited to 'i386/intel/pmap.h')
-rw-r--r--i386/intel/pmap.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/i386/intel/pmap.h b/i386/intel/pmap.h
index 047a384..382cd5f 100644
--- a/i386/intel/pmap.h
+++ b/i386/intel/pmap.h
@@ -192,6 +192,16 @@ extern void pmap_clear_bootstrap_pagetable(pt_entry_t *addr);
#define set_pmap(pmap) set_cr3(kvtophys((vm_offset_t)(pmap)->dirbase))
#endif /* PAE */
+typedef struct {
+ pt_entry_t *entry;
+ vm_offset_t vaddr;
+} pmap_mapwindow_t;
+
+extern pmap_mapwindow_t *pmap_get_mapwindow(pt_entry_t entry);
+extern void pmap_put_mapwindow(pmap_mapwindow_t *map);
+
+#define PMAP_NMAPWINDOWS 2
+
#if NCPUS > 1
/*
* List of cpus that are actively using mapped memory. Any