-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 101720 b: refs/heads/master c: 51c52e8 h: refs/heads/master v: v3
- Loading branch information
Michael Ellerman
authored and
Paul Mackerras
committed
Jul 1, 2008
1 parent
bae5839
commit ea622c0
Showing
4 changed files
with
58 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: b7bcda631e87eb3466d0baa9885650ba7d7ed89d | ||
refs/heads/master: 51c52e86694f19e84600a40f6156889feafd8ae9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ endif | |
obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o | ||
|
||
obj-y += code-patching.o | ||
obj-y += feature-fixups.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org) | ||
* | ||
* Modifications for ppc64: | ||
* Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> | ||
* | ||
* Copyright 2008 Michael Ellerman, IBM Corporation. | ||
* | ||
* 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 the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <asm/cputable.h> | ||
#include <asm/code-patching.h> | ||
|
||
|
||
struct fixup_entry { | ||
unsigned long mask; | ||
unsigned long value; | ||
long start_off; | ||
long end_off; | ||
}; | ||
|
||
static void patch_feature_section(unsigned long value, struct fixup_entry *fcur) | ||
{ | ||
unsigned int *pstart, *pend, *p; | ||
|
||
if ((value & fcur->mask) == fcur->value) | ||
return; | ||
|
||
pstart = ((unsigned int *)fcur) + (fcur->start_off / 4); | ||
pend = ((unsigned int *)fcur) + (fcur->end_off / 4); | ||
|
||
for (p = pstart; p < pend; p++) { | ||
*p = PPC_NOP_INSTR; | ||
asm volatile ("dcbst 0, %0" : : "r" (p)); | ||
} | ||
asm volatile ("sync" : : : "memory"); | ||
for (p = pstart; p < pend; p++) | ||
asm volatile ("icbi 0,%0" : : "r" (p)); | ||
asm volatile ("sync; isync" : : : "memory"); | ||
} | ||
|
||
void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end) | ||
{ | ||
struct fixup_entry *fcur, *fend; | ||
|
||
fcur = fixup_start; | ||
fend = fixup_end; | ||
|
||
for (; fcur < fend; fcur++) | ||
patch_feature_section(value, fcur); | ||
} |