diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2009-03-11 17:47:38 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-03-11 17:47:38 -0700 |
commit | 458f7a2e40f35316863a17599e1813e1d9d77bbd (patch) | |
tree | 4dd9915dd76b244537d0cccf8ce96b444efaf404 | |
parent | 13bfd0409c646f1c7be3a1de54b6a78371dabfb9 (diff) | |
download | syslinux-elf-458f7a2e40f35316863a17599e1813e1d9d77bbd.tar.gz syslinux-elf-458f7a2e40f35316863a17599e1813e1d9d77bbd.tar.xz syslinux-elf-458f7a2e40f35316863a17599e1813e1d9d77bbd.zip |
runkernel: when computing initrd address, skip fractional pages
Make sure no part of the initrd extends into memory that is in a
fractional page at the end of memory. The kernel may not be able to
map such a fractional page, and therefore will be unable to access
that memory.
-rw-r--r-- | core/runkernel.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/runkernel.inc b/core/runkernel.inc index 143920d0..f42abf08 100644 --- a/core/runkernel.inc +++ b/core/runkernel.inc @@ -1,6 +1,6 @@ ;; ----------------------------------------------------------------------- ;; -;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved +;; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -536,10 +536,16 @@ parse_load_initrd: je .get_chunk ; Compute the initrd target location + ; Note: we round to a page boundary twice here. The first + ; time it is to make sure we don't use any fractional page + ; which may be valid RAM but which will be ignored by the + ; kernel (and therefore is inaccessible.) The second time + ; it is to make sure we start out on page boundary. mov edx,[cs:InitRDEnd] sub edx,[cs:InitRDStart] mov [su_ramdisklen],edx mov eax,[cs:MyHighMemSize] + and ax,0F000h ; Round to a page boundary sub eax,edx and ax,0F000h ; Round to a page boundary mov [su_ramdiskat],eax |