diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-09-09 09:24:25 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-09-09 09:24:25 +0000 |
commit | cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8 (patch) | |
tree | 414d05b171df34e0125f29731a8ba12e280297d9 /extras/mini-os/include/mm.h | |
parent | c125eb9c047b908b2bb18e5cf4a88355a1526a25 (diff) | |
download | xen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.tar.gz xen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.tar.bz2 xen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.zip |
Xenbus implementation ported from Linux to Mini-os, simple thread support introduced
to simplify the porting. 64 bit version of Mini-os now compiles, but does not work
because of the pagetables and some bits of scheduler not being written.
Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Diffstat (limited to 'extras/mini-os/include/mm.h')
-rw-r--r-- | extras/mini-os/include/mm.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/extras/mini-os/include/mm.h b/extras/mini-os/include/mm.h index 27af789315..613fe29dfa 100644 --- a/extras/mini-os/include/mm.h +++ b/extras/mini-os/include/mm.h @@ -25,6 +25,15 @@ #ifndef _MM_H_ #define _MM_H_ +#ifdef __i386__ +#include <xen/arch-x86_32.h> +#endif + +#ifdef __x86_64__ +#include <xen/arch-x86_64.h> +#endif + + #ifdef __x86_64__ #define L1_PAGETABLE_SHIFT 12 @@ -56,6 +65,8 @@ #define L1_PAGETABLE_ENTRIES 1024 #define L2_PAGETABLE_ENTRIES 1024 + +#elif defined(__x86_64__) #endif /* Given a virtual address, get an entry offset into a page table. */ @@ -97,13 +108,15 @@ extern unsigned long *phys_to_machine_mapping; #define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)]) -#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)]) static __inline__ unsigned long phys_to_machine(unsigned long phys) { unsigned long machine = pfn_to_mfn(phys >> L1_PAGETABLE_SHIFT); machine = (machine << L1_PAGETABLE_SHIFT) | (phys & ~PAGE_MASK); return machine; } + + +#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)]) static __inline__ unsigned long machine_to_phys(unsigned long machine) { unsigned long phys = mfn_to_pfn(machine >> L1_PAGETABLE_SHIFT); @@ -119,16 +132,15 @@ static __inline__ unsigned long machine_to_phys(unsigned long machine) #define to_phys(x) ((unsigned long)(x)-VIRT_START) #define to_virt(x) ((void *)((unsigned long)(x)+VIRT_START)) -#define __va to_virt -#define __pa to_phys #define virt_to_pfn(_virt) (PFN_DOWN(to_phys(_virt))) +#define mach_to_virt(_mach) (to_virt(machine_to_phys(_mach))) +#define mfn_to_virt(_mfn) (mach_to_virt(_mfn << PAGE_SHIFT)) void init_mm(void); unsigned long alloc_pages(int order); #define alloc_page() alloc_pages(0); void free_pages(void *pointer, int order); -//int is_mfn_mapped(unsigned long mfn); static __inline__ int get_order(unsigned long size) { |