Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109043
b: refs/heads/master
c: 38cc1c3
h: refs/heads/master
i:
  109041: e0293f5
  109039: b90c4a8
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Aug 22, 2008
1 parent ea321e4 commit 8413bb6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 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: 8323444b5dba3fe55e56a95d20d8f55c1d6745af
refs/heads/master: 38cc1c3df77c1bb739a4766788eb9fa49f16ffdf
15 changes: 13 additions & 2 deletions trunk/arch/x86/kernel/cpu/mtrr/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
unsigned long *size, mtrr_type *type)
{
unsigned int mask_lo, mask_hi, base_lo, base_hi;
unsigned int tmp, hi;

rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
if ((mask_lo & 0x800) == 0) {
Expand All @@ -392,8 +393,18 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);

/* Work out the shifted address mask. */
mask_lo = size_or_mask | mask_hi << (32 - PAGE_SHIFT)
| mask_lo >> PAGE_SHIFT;
tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
mask_lo = size_or_mask | tmp;
/* Expand tmp with high bits to all 1s*/
hi = fls(tmp);
if (hi > 0) {
tmp |= ~((1<<(hi - 1)) - 1);

if (tmp != mask_lo) {
WARN_ON("mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
mask_lo = tmp;
}
}

/* This works correctly if size is a power of two, i.e. a
contiguous range. */
Expand Down

0 comments on commit 8413bb6

Please sign in to comment.