mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Linux has several instances of repeated code to do updates to a range of PTEs. Mapping memory between domains in Xen also tends to need to do this quite frequently, to ensure page tables have been constructed and to look up PTE addresses when making mapping-related hypercalls. This patch adds a generic PTE walk-and-fill operation that takes a function pointer to call on leaf entries. direct_remap_area_pages() is updated to use the new call, ass are abuses of __direct_remap_area_pages. This patch also introduces two new helper functions for working with page tables when mapping memory between domains: create_lookup_pte_addr() returns the machine address of a PTE, allocating intermediate page tables as necessary. touch_pte_range() ensures that page tables exist for a virtual address range. Many of the existing linux page table operations (e.g. zap/remap/etc) could be modified to use this interface, which would potentially shorten up mm/memory.c a bit.