[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] memory manager in Mini-os - are initial page tables still placed at the top of memory ???


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
  • From: Richard <judicator3@xxxxxxxxx>
  • Date: Thu, 24 Feb 2005 19:09:35 -0500
  • Delivery-date: Fri, 25 Feb 2005 00:11:44 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=Q0RHnMEPU1O2S3u86TWlL6mQQJQCxTAIoq+XblQfnb8u0nMcown4sYNKoOxRFIdrE1Dny9C8f9x03DpUNyDtFdbvnmhAvoEB3vWZVQEO3TOsxhhOfTJN0Zx2KYEfYnnjI6W455eXz/zXrtn98gXJCh8J/vh1jrPJHgwGJF9qJv0=
  • List-id: List for Xen developers <xen-devel.lists.sourceforge.net>

Hello,

I am still working on mini-os :).
I think that the memory manager (file mm.c) for mini-os is pretty
outdated. I just want to confirm something. In the function init_mm()
in file mm.c, it is assumed that XEN places the initial page tables at
the TOP of the available memory. Mini-os uses that information to
calculate the number of free page frames available to use. Is that
still the case nowadays ?

Below is part of the function init_mm() and the comments inside init_mm()
=========================================================================
   unsigned long *pgd = (unsigned long *)start_info.pt_base;

    /* set up minimal memory infos */
    start_pfn = PFN_UP(to_phys(&_end));
    max_pfn = start_info.nr_pages;

    printk("  start_pfn:    %lx\n", start_pfn);
    printk("  max_pfn:      %lx\n", max_pfn);

    /*
     * we know where free tables start (start_pfn) and how many we 
     * have (max_pfn). 
     * 
     * Currently the hypervisor stores page tables it providesin the
     * high region of the this memory range.
     * 
     * next we work out how far down this goes (max_free_pfn)
     * 
     * XXX this assumes the hypervisor provided page tables to be in
     * the upper region of our initial memory. I don't know if this 
     * is always true.
     */

    max_free_pfn = PFN_DOWN(to_phys(pgd));
    {
        unsigned long *pgd = (unsigned long *)start_info.pt_base;
        unsigned long  pte;
        int i;
        printk("  pgd(pa(pgd)): %lx(%lx)", (u_long)pgd, to_phys(pgd));

        for ( i = 0; i < (HYPERVISOR_VIRT_START>>22); i++ )
        {
            unsigned long pgde = *pgd++;
            if ( !(pgde & 1) ) continue;
            pte = machine_to_phys(pgde & PAGE_MASK);
            printk("  PT(%x): %lx(%lx)", i, (u_long)to_virt(pte), pte);
            if (PFN_DOWN(pte) <= max_free_pfn) 
                max_free_pfn = PFN_DOWN(pte);
        }
    }
    max_free_pfn--;
    printk("  max_free_pfn: %lx\n", max_free_pfn);
=========================================================================

Thanks
Richard


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.