diff options
Diffstat (limited to 'arch/x86/kernel/e820_64.c')
-rw-r--r-- | arch/x86/kernel/e820_64.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index b74e83b214c..9f65b4cc323 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c | |||
@@ -171,12 +171,13 @@ int __init e820_all_mapped(unsigned long start, unsigned long end, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Find a free area in a specific range. | 174 | * Find a free area with specified alignment in a specific range. |
175 | */ | 175 | */ |
176 | unsigned long __init find_e820_area(unsigned long start, unsigned long end, | 176 | unsigned long __init find_e820_area(unsigned long start, unsigned long end, |
177 | unsigned size) | 177 | unsigned size, unsigned long align) |
178 | { | 178 | { |
179 | int i; | 179 | int i; |
180 | unsigned long mask = ~(align - 1); | ||
180 | 181 | ||
181 | for (i = 0; i < e820.nr_map; i++) { | 182 | for (i = 0; i < e820.nr_map; i++) { |
182 | struct e820entry *ei = &e820.map[i]; | 183 | struct e820entry *ei = &e820.map[i]; |
@@ -190,7 +191,8 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, | |||
190 | continue; | 191 | continue; |
191 | while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) | 192 | while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) |
192 | ; | 193 | ; |
193 | last = PAGE_ALIGN(addr) + size; | 194 | addr = (addr + align - 1) & mask; |
195 | last = addr + size; | ||
194 | if (last > ei->addr + ei->size) | 196 | if (last > ei->addr + ei->size) |
195 | continue; | 197 | continue; |
196 | if (last > end) | 198 | if (last > end) |