diff options
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 6557683c190e..97c84ebe3f24 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -218,6 +218,29 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /* | ||
222 | * 16-bit Linear Feedback Shift Register (LFSR) | ||
223 | * | ||
224 | * 16 14 13 11 | ||
225 | * Feedback polynomial = X + X + X + X + 1 | ||
226 | */ | ||
227 | static unsigned int lfsr_random(void) | ||
228 | { | ||
229 | static unsigned int lfsr_value = 0xF00D; | ||
230 | unsigned int bit; | ||
231 | |||
232 | /* Compute next bit to shift in */ | ||
233 | bit = ((lfsr_value >> 0) ^ | ||
234 | (lfsr_value >> 2) ^ | ||
235 | (lfsr_value >> 3) ^ | ||
236 | (lfsr_value >> 5)) & 0x0001; | ||
237 | |||
238 | /* Advance to next register value */ | ||
239 | lfsr_value = (lfsr_value >> 1) | (bit << 15); | ||
240 | |||
241 | return lfsr_value; | ||
242 | } | ||
243 | |||
221 | static inline void | 244 | static inline void |
222 | op_amd_handle_ibs(struct pt_regs * const regs, | 245 | op_amd_handle_ibs(struct pt_regs * const regs, |
223 | struct op_msrs const * const msrs) | 246 | struct op_msrs const * const msrs) |