diff options
author | Robert Richter <robert.richter@amd.com> | 2009-07-07 19:30:25 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-07-14 15:30:03 +0200 |
commit | 8045a4c293d36c61656a20d581b11f7f0cd7acd5 (patch) | |
tree | 33d201b0916c44a3cf952f96d9fee10b7b6f857b /arch/x86/oprofile/op_model_amd.c | |
parent | debc6a6927dcd833a30750b07a4c2b456b71f1be (diff) | |
download | blackbird-obmc-linux-8045a4c293d36c61656a20d581b11f7f0cd7acd5.tar.gz blackbird-obmc-linux-8045a4c293d36c61656a20d581b11f7f0cd7acd5.zip |
x86/oprofile: Fix cast of counter value
When casting the counter value to a 64 bit value in 32 bit mode, sign
extension may lead to broken counter values. This patch fixes this by
casting to (u64) instead of (s64).
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile/op_model_amd.c')
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index e95268eb9220..7ca8306aefae 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c @@ -111,7 +111,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, if (counter_config[i].enabled && msrs->counters[i].addr) { reset_value[i] = counter_config[i].count; wrmsrl(msrs->counters[i].addr, - -(s64)counter_config[i].count); + -(u64)counter_config[i].count); rdmsrl(msrs->controls[i].addr, val); val &= model->reserved; val |= op_x86_get_ctrl(model, &counter_config[i]); @@ -237,7 +237,7 @@ static int op_amd_check_ctrs(struct pt_regs * const regs, if (val & OP_CTR_OVERFLOW) continue; oprofile_add_sample(regs, i); - wrmsrl(msrs->counters[i].addr, -(s64)reset_value[i]); + wrmsrl(msrs->counters[i].addr, -(u64)reset_value[i]); } op_amd_handle_ibs(regs, msrs); |