Skip to content

Commit

Permalink
i386: fix PGE mask
Browse files Browse the repository at this point in the history
cr4 is a 32-bit register, so casting the mask to an unsigned char is wrong,
as it clears more than the PGE bit.

Signed-off-by: Brian Gerst <bgerst@didntduck.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Brian Gerst authored and Linus Torvalds committed May 21, 2007
1 parent d0aff6e commit 1730438
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/i386/kernel/cpu/mtrr/cyrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void prepare_set(void)
/* Save value of CR4 and clear Page Global Enable (bit 7) */
if ( cpu_has_pge ) {
cr4 = read_cr4();
write_cr4(cr4 & (unsigned char) ~(1 << 7));
write_cr4(cr4 & ~X86_CR4_PGE);
}

/* Disable and flush caches. Note that wbinvd flushes the TLBs as
Expand Down
2 changes: 1 addition & 1 deletion arch/i386/kernel/cpu/mtrr/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void set_mtrr_prepare_save(struct set_mtrr_context *ctxt)
/* Save value of CR4 and clear Page Global Enable (bit 7) */
if ( cpu_has_pge ) {
ctxt->cr4val = read_cr4();
write_cr4(ctxt->cr4val & (unsigned char) ~(1 << 7));
write_cr4(ctxt->cr4val & ~X86_CR4_PGE);
}

/* Disable and flush caches. Note that wbinvd flushes the TLBs as
Expand Down

0 comments on commit 1730438

Please sign in to comment.