aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/x86
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-18 16:20:13 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-18 16:20:13 +0000
commit04383f9c0fe6f18446c8f273d9200fdda4f1afe3 (patch)
tree56fd028d8180f14f7fcf62ebb34a096f738a8479 /extras/mini-os/include/x86
parent0747f6e56ec0c2a019f6c76cadb34feca6e0f103 (diff)
downloadxen-04383f9c0fe6f18446c8f273d9200fdda4f1afe3.tar.gz
xen-04383f9c0fe6f18446c8f273d9200fdda4f1afe3.tar.bz2
xen-04383f9c0fe6f18446c8f273d9200fdda4f1afe3.zip
minios: support COW for a zero page
Permits to support sparse data. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/include/x86')
-rw-r--r--extras/mini-os/include/x86/arch_mm.h4
-rw-r--r--extras/mini-os/include/x86/traps.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/extras/mini-os/include/x86/arch_mm.h b/extras/mini-os/include/x86/arch_mm.h
index 8ae845131a..1ed2755be7 100644
--- a/extras/mini-os/include/x86/arch_mm.h
+++ b/extras/mini-os/include/x86/arch_mm.h
@@ -144,12 +144,14 @@ typedef unsigned long pgentry_t;
#if defined(__i386__)
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
+#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
#if defined(CONFIG_X86_PAE)
#define L3_PROT (_PAGE_PRESENT)
#endif /* CONFIG_X86_PAE */
#elif defined(__x86_64__)
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
+#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
@@ -190,6 +192,7 @@ typedef unsigned long maddr_t;
extern unsigned long *phys_to_machine_mapping;
extern char _text, _etext, _erodata, _edata, _end;
+extern unsigned long mfn_zero;
#define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
static __inline__ maddr_t phys_to_machine(paddr_t phys)
{
@@ -224,5 +227,6 @@ static __inline__ paddr_t machine_to_phys(maddr_t machine)
#define pte_to_virt(_pte) to_virt(mfn_to_pfn(pte_to_mfn(_pte)) << PAGE_SHIFT)
#define map_frames(f, n) map_frames_ex(f, n, 1, 0, 1, DOMID_SELF, 0, L1_PROT)
+#define map_zero(n, a) map_frames_ex(&mfn_zero, n, 0, 0, a, DOMID_SELF, 0, L1_PROT_RO)
#endif /* _ARCH_MM_H_ */
diff --git a/extras/mini-os/include/x86/traps.h b/extras/mini-os/include/x86/traps.h
index 2f54fd28f0..c3b504b986 100644
--- a/extras/mini-os/include/x86/traps.h
+++ b/extras/mini-os/include/x86/traps.h
@@ -70,4 +70,8 @@ struct pt_regs {
void dump_regs(struct pt_regs *regs);
+#define TRAP_PF_PROT 0x1
+#define TRAP_PF_WRITE 0x2
+#define TRAP_PF_USER 0x4
+
#endif /* _TRAPS_H_ */