Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356200
b: refs/heads/master
c: f763ad1
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Nov 17, 2012
1 parent f5c7269 commit 99b6e5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eceb3632ac85bc08fc27f7fc9ab85672681b2635
refs/heads/master: f763ad1d3870abb811ec7520b4c1adc56471a3a4
41 changes: 19 additions & 22 deletions trunk/arch/x86/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,40 +398,30 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
* Depending on the alignment of E820 ranges, this may possibly result in using
* smaller size (i.e. 4K instead of 2M or 1G) page tables.
*/
static void __init init_all_memory_mapping(void)
static void __init init_range_memory_mapping(unsigned long range_start,
unsigned long range_end)
{
unsigned long start_pfn, end_pfn;
int i;

/* the ISA range is always mapped regardless of memory holes */
init_memory_mapping(0, ISA_END_ADDRESS);

for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) {
u64 start = (u64)start_pfn << PAGE_SHIFT;
u64 end = (u64)end_pfn << PAGE_SHIFT;

if (end <= ISA_END_ADDRESS)
if (end <= range_start)
continue;

if (start < ISA_END_ADDRESS)
start = ISA_END_ADDRESS;
#ifdef CONFIG_X86_32
/* on 32 bit, we only map up to max_low_pfn */
if ((start >> PAGE_SHIFT) >= max_low_pfn)
if (start < range_start)
start = range_start;

if (start >= range_end)
continue;

if ((end >> PAGE_SHIFT) > max_low_pfn)
end = max_low_pfn << PAGE_SHIFT;
#endif
init_memory_mapping(start, end);
}
if (end > range_end)
end = range_end;

#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
init_memory_mapping(start, end);
}
#endif
}

void __init init_mem_mapping(void)
Expand Down Expand Up @@ -461,8 +451,15 @@ void __init init_mem_mapping(void)
(pgt_buf_top << PAGE_SHIFT) - 1);

max_pfn_mapped = 0; /* will get exact value next */
init_all_memory_mapping();

/* the ISA range is always mapped regardless of memory holes */
init_memory_mapping(0, ISA_END_ADDRESS);
init_range_memory_mapping(ISA_END_ADDRESS, end);
#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
}
#endif
/*
* Reserve the kernel pagetable pages we used (pgt_buf_start -
* pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top)
Expand Down

0 comments on commit 99b6e5a

Please sign in to comment.