aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ds.c')
-rw-r--r--arch/x86/kernel/ds.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index 996a7c4f5963..e7855def97c3 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -167,23 +167,13 @@ static inline void set_info_type(char *base, unsigned char value)
167{ 167{
168 (*(unsigned char *)(base + ds_cfg.info_type.offset)) = value; 168 (*(unsigned char *)(base + ds_cfg.info_type.offset)) = value;
169} 169}
170/* 170static inline unsigned long get_info_data(char *base)
171 * The info data might overlap with the info type on some architectures.
172 * We therefore read and write the exact number of bytes.
173 */
174static inline unsigned long long get_info_data(char *base)
175{ 171{
176 unsigned long long value = 0; 172 return *(unsigned long *)(base + ds_cfg.info_data.offset);
177 memcpy(&value,
178 base + ds_cfg.info_data.offset,
179 ds_cfg.info_data.size);
180 return value;
181} 173}
182static inline void set_info_data(char *base, unsigned long long value) 174static inline void set_info_data(char *base, unsigned long value)
183{ 175{
184 memcpy(base + ds_cfg.info_data.offset, 176 (*(unsigned long *)(base + ds_cfg.info_data.offset)) = value;
185 &value,
186 ds_cfg.info_data.size);
187} 177}
188 178
189 179
@@ -282,8 +272,8 @@ int ds_read_bts(void *ds, size_t index, struct bts_struct *out)
282 272
283 memset(out, 0, sizeof(*out)); 273 memset(out, 0, sizeof(*out));
284 if (get_from_ip(bts) == BTS_ESCAPE_ADDRESS) { 274 if (get_from_ip(bts) == BTS_ESCAPE_ADDRESS) {
285 out->qualifier = get_info_type(bts); 275 out->qualifier = get_info_type(bts);
286 out->variant.timestamp = get_info_data(bts); 276 out->variant.jiffies = get_info_data(bts);
287 } else { 277 } else {
288 out->qualifier = BTS_BRANCH; 278 out->qualifier = BTS_BRANCH;
289 out->variant.lbr.from_ip = get_from_ip(bts); 279 out->variant.lbr.from_ip = get_from_ip(bts);
@@ -319,7 +309,7 @@ int ds_write_bts(void *ds, const struct bts_struct *in)
319 case BTS_TASK_DEPARTS: 309 case BTS_TASK_DEPARTS:
320 set_from_ip(bts, BTS_ESCAPE_ADDRESS); 310 set_from_ip(bts, BTS_ESCAPE_ADDRESS);
321 set_info_type(bts, in->qualifier); 311 set_info_type(bts, in->qualifier);
322 set_info_data(bts, in->variant.timestamp); 312 set_info_data(bts, in->variant.jiffies);
323 break; 313 break;
324 314
325 default: 315 default:
@@ -350,7 +340,7 @@ static const struct ds_configuration ds_cfg_netburst = {
350 .from_ip = { 0, 4 }, 340 .from_ip = { 0, 4 },
351 .to_ip = { 4, 4 }, 341 .to_ip = { 4, 4 },
352 .info_type = { 4, 1 }, 342 .info_type = { 4, 1 },
353 .info_data = { 5, 7 }, 343 .info_data = { 8, 4 },
354 .debugctl_mask = (1<<2)|(1<<3) 344 .debugctl_mask = (1<<2)|(1<<3)
355}; 345};
356 346
@@ -364,7 +354,7 @@ static const struct ds_configuration ds_cfg_pentium_m = {
364 .from_ip = { 0, 4 }, 354 .from_ip = { 0, 4 },
365 .to_ip = { 4, 4 }, 355 .to_ip = { 4, 4 },
366 .info_type = { 4, 1 }, 356 .info_type = { 4, 1 },
367 .info_data = { 5, 7 }, 357 .info_data = { 8, 4 },
368 .debugctl_mask = (1<<6)|(1<<7) 358 .debugctl_mask = (1<<6)|(1<<7)
369}; 359};
370#endif /* _i386_ */ 360#endif /* _i386_ */
@@ -379,7 +369,7 @@ static const struct ds_configuration ds_cfg_core2 = {
379 .from_ip = { 0, 8 }, 369 .from_ip = { 0, 8 },
380 .to_ip = { 8, 8 }, 370 .to_ip = { 8, 8 },
381 .info_type = { 8, 1 }, 371 .info_type = { 8, 1 },
382 .info_data = { 9, 7 }, 372 .info_data = { 16, 8 },
383 .debugctl_mask = (1<<6)|(1<<7)|(1<<9) 373 .debugctl_mask = (1<<6)|(1<<7)|(1<<9)
384}; 374};
385 375