Simon Kagstrom
2006-Feb-10 10:28 UTC
[Xen-devel] [PATCH (Mini-OS, trivial)] documentation and questions for build_pagetable
Hello! A Mini-OS question for mm.c: I''m trying to understand what build_pagetable does, and if I''m not mistaken, the purpose is to map all the physical pages passed to the domain by Xen, right? And later these are used for the memory allocation. The patch adds documentation to build_pagetable and makes print_allocation and print_chunks non-static to allow the compilation to go through with MM_DEBUG enabled (-Werror is specified). // Simon Signed-off by: Simon Kagstrom <simon.kagstrom@bth.se> ===File ~/shared/mini-os.patch=============================diff -r 57e6d7218427 extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Fri Feb 3 18:45:14 2006 +++ b/extras/mini-os/hypervisor.c Fri Feb 10 11:26:48 2006 @@ -56,7 +56,7 @@ l2 &= ~(1 << l2i); port = (l1i << 5) + l2i; - do_event(port, regs); + do_event(port, regs); } } } diff -r 57e6d7218427 extras/mini-os/mm.c --- a/extras/mini-os/mm.c Fri Feb 3 18:45:14 2006 +++ b/extras/mini-os/mm.c Fri Feb 10 11:26:48 2006 @@ -150,7 +150,7 @@ * Prints allocation[0/1] for @nr_pages, starting at @start * address (virtual). */ -static void print_allocation(void *start, int nr_pages) +void print_allocation(void *start, int nr_pages) { unsigned long pfn_start = virt_to_pfn(start); int count; @@ -165,7 +165,7 @@ * Prints chunks (making them with letters) for @nr_pages starting * at @start (virtual). */ -static void print_chunks(void *start, int nr_pages) +void print_chunks(void *start, int nr_pages) { char chunks[1001], current=''A''; int order, count; @@ -366,6 +366,20 @@ free_head[order] = freed_ch; } + +/* Build an initial page table. This will fill in the page table with + * the physical pages passed to the Mini OS kernel and return the page + * frame numbers of the first free page. + * + * @param start_pfn a pointer to the first (physical) page frame + * number of the free physical pages. When the function returns, this + * will be updated to refer to the first free (unmapped) page frame + * that can be used by the memory allocator. + + * @param max_pfn a pointer to the last page frame number that was + * passed to this domain. This will be sanity checked and updated + * accordingly. + */ void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn) { unsigned long pfn_to_map, pt_frame; =========================================================== _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel