minios: extend map_frames
PATCH 1/1 minios: extend map_frames
minios: extend map_frames into being able to map a series of contiguous frames, or the same frame several times, aligned, from another domain, with specific protection, and with potential failures.
Signed-off-by Samuel Thibault <[email protected]>
extras/mini-os/arch/ia64/mm.c +7 -2
@@ -124,9 +124,14 @@ arch_init_demand_mapping_area(unsigned l/* Helper function used in gnttab.c. */ void * -map_frames (unsigned long * frames,unsigned long n) +map_frames_ex (unsigned long * frames,unsigned long n,unsigned long stride, +unsigned long increment,unsigned long alignment,domid_t id, +int may_fail,unsigned long prot) { - n = n; +/* TODO: incomplete! */ +ASSERT (n ==1 || (stride ==0 && increment ==1 )); +ASSERT (id ==DOMID_SELF ); +ASSERT (prot ==0 );return (void *)__va (SWAP (frames[0 ]) <<PAGE_SHIFT ); }
extras/mini-os/arch/x86/mm.c +43 -21
93 lines not on this page · raw message
extras/mini-os/include/ia64/arch_mm.h +2 -0
@@ -36,4 +36,6 @@#define STACK_SIZE_PAGE_ORDER 1#define STACK_SIZE (PAGE_SIZE * (1 << STACK_SIZE_PAGE_ORDER)) +#define map_frames (f, n) map_frames_ex(f, n, 1, 0, 1, DOMID_SELF, 0, 0) +#endif /* __ARCH_MM_H__ */
extras/mini-os/include/mm.h +4 -1
@@ -57,6 +57,9 @@ void arch_init_mm(unsigned long* start_pvoid arch_init_mm (unsigned long * start_pfn_p,unsigned long * max_pfn_p);void arch_init_p2m (unsigned long max_pfn_p); -void *map_frames (unsigned long *f,unsigned long n); +/* map f[i*stride]+i*increment for i in 0..n-1, aligned on alignment pages */ +void *map_frames_ex (unsigned long *f,unsigned long n,unsigned long stride, +unsigned long increment,unsigned long alignment,domid_t id, +int may_fail,unsigned long prot);#endif /* _MM_H_ */
extras/mini-os/include/x86/arch_mm.h +1 -0
@@ -223,5 +223,6 @@ static __inline__ paddr_t machine_to_phy#define pte_to_mfn (_pte) (((_pte) & (PADDR_MASK&PAGE_MASK)) >> L1_PAGETABLE_SHIFT)#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)#endif /* _ARCH_MM_H_ */