debuggers.hg
changeset 21268:11d20f17f82c
HAP 1GB: Add corner case handling for 1GB super page.
- Without the check, guest memory allocation will never reach the
boundary of a 1GB super page.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
- Without the check, guest memory allocation will never reach the
boundary of a 1GB super page.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Thu Apr 22 09:41:36 2010 +0100 (2010-04-22) |
parents | a4489cf8de22 |
children | 5b72f9832cc2 |
files | tools/libxc/xc_hvm_build.c |
line diff
1.1 --- a/tools/libxc/xc_hvm_build.c Thu Apr 22 09:39:58 2010 +0100 1.2 +++ b/tools/libxc/xc_hvm_build.c Thu Apr 22 09:41:36 2010 +0100 1.3 @@ -203,6 +203,14 @@ static int setup_guest(int xc_handle, 1.4 if ( count > max_pages ) 1.5 count = max_pages; 1.6 1.7 + /* Take care the corner cases of super page tails */ 1.8 + if ( ((cur_pages & (SUPERPAGE_1GB_NR_PFNS-1)) != 0) && 1.9 + (count > (-cur_pages & (SUPERPAGE_1GB_NR_PFNS-1))) ) 1.10 + count = -cur_pages & (SUPERPAGE_1GB_NR_PFNS-1); 1.11 + else if ( ((count & (SUPERPAGE_1GB_NR_PFNS-1)) != 0) && 1.12 + (count > SUPERPAGE_1GB_NR_PFNS) ) 1.13 + count &= ~(SUPERPAGE_1GB_NR_PFNS - 1); 1.14 + 1.15 /* Attemp to allocate 1GB super page. Because in each pass we only 1.16 * allocate at most 1GB, we don't have to clip super page boundaries. 1.17 */