ia64/xen-unstable

changeset 16728:be960a84e492

hvm: Allocate an unmapped guard page to separate ordinary low RAM
from special pages (ioreq, xenstore, etc). This will stop some probe
functions (e.g., embedded in memtest) from stomping on the special
pages.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 17 12:59:10 2008 +0000 (2008-01-17)
parents f17b34df974f
children 0a88a8fe5e97
files tools/libxc/xc_hvm_build.c
line diff
     1.1 --- a/tools/libxc/xc_hvm_build.c	Wed Jan 16 15:55:57 2008 +0000
     1.2 +++ b/tools/libxc/xc_hvm_build.c	Thu Jan 17 12:59:10 2008 +0000
     1.3 @@ -77,13 +77,19 @@ static void build_e820map(void *e820_pag
     1.4      e820entry[nr_map].type = E820_RESERVED;
     1.5      nr_map++;
     1.6  
     1.7 -    /* Low RAM goes here. Remove 3 pages for ioreq, bufioreq, and xenstore. */
     1.8 +    /*
     1.9 +     * Low RAM goes here. Remove 4 pages for: ioreq, bufioreq, and xenstore.
    1.10 +     *  1. Guard page.
    1.11 +     *  2. Buffered ioreq.
    1.12 +     *  3. Xenstore.
    1.13 +     *  4. Normal ioreq.
    1.14 +     */
    1.15      e820entry[nr_map].addr = 0x100000;
    1.16 -    e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE * 3;
    1.17 +    e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE * 4;
    1.18      e820entry[nr_map].type = E820_RAM;
    1.19      nr_map++;
    1.20  
    1.21 -    /* Explicitly reserve space for special pages (ioreq and xenstore). */
    1.22 +    /* Explicitly reserve space for special pages. */
    1.23      e820entry[nr_map].addr = mem_size - PAGE_SIZE * 3;
    1.24      e820entry[nr_map].size = PAGE_SIZE * 3;
    1.25      e820entry[nr_map].type = E820_RESERVED;
    1.26 @@ -244,6 +250,15 @@ static int setup_guest(int xc_handle,
    1.27      else
    1.28          shared_page_nr = (v_end >> PAGE_SHIFT) - 1;
    1.29  
    1.30 +    /* Free the guard page that separates low RAM from special pages. */
    1.31 +    rc = xc_domain_memory_decrease_reservation(
    1.32 +            xc_handle, dom, 1, 0, &page_array[shared_page_nr-3]);
    1.33 +    if ( rc != 0 )
    1.34 +    {
    1.35 +        PERROR("Could not deallocate guard page for HVM guest.\n");
    1.36 +        goto error_out;
    1.37 +    }
    1.38 +
    1.39      /* Paranoia: clean pages. */
    1.40      if ( xc_clear_domain_page(xc_handle, dom, shared_page_nr) ||
    1.41           xc_clear_domain_page(xc_handle, dom, shared_page_nr-1) ||