| 1 |
/* { dg-do compile { target x86_64-*-* } } */ |
| 2 |
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */ |
| 3 |
|
| 4 |
#include "../analyzer-decls.h" |
| 5 |
|
| 6 |
/* Adapted from Linux: arch/x86/include/asm/msr.h (GPL-2.0) */ |
| 7 |
|
| 8 |
#ifdef __x86_64__ |
| 9 |
#define DECLARE_ARGS(val, low, high) unsigned long long low, high |
| 10 |
#define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32) |
| 11 |
#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) |
| 12 |
#else |
| 13 |
#define DECLARE_ARGS(val, low, high) unsigned long long val |
| 14 |
#define EAX_EDX_VAL(val, low, high) (val) |
| 15 |
#define EAX_EDX_RET(val, low, high) "=A" (val) |
| 16 |
#endif |
| 17 |
|
| 18 |
static unsigned long long __rdmsr(unsigned int msr) |
| 19 |
{ |
| 20 |
DECLARE_ARGS(val, low, high); |
| 21 |
|
| 22 |
asm volatile("1: rdmsr\n" |
| 23 |
"2:\n" |
| 24 |
: EAX_EDX_RET(val, low, high) : "c" (msr)); |
| 25 |
|
| 26 |
return EAX_EDX_VAL(val, low, high); |
| 27 |
} |
| 28 |
|
| 29 |
void test (void) |
| 30 |
{ |
| 31 |
__analyzer_eval (__rdmsr (0)); /* { dg-warning "UNKNOWN" } */ |
| 32 |
__analyzer_eval (__rdmsr (1)); /* { dg-warning "UNKNOWN" } */ |
| 33 |
} |