Revision 28ab0e2e linux-user/main.c
b/linux-user/main.c | ||
---|---|---|
99 | 99 |
return -1; |
100 | 100 |
} |
101 | 101 |
|
102 |
/* timers for rdtsc */ |
|
103 |
|
|
104 |
#if defined(__i386__) |
|
105 |
|
|
106 |
int64_t cpu_get_real_ticks(void) |
|
107 |
{ |
|
108 |
int64_t val; |
|
109 |
asm volatile ("rdtsc" : "=A" (val)); |
|
110 |
return val; |
|
111 |
} |
|
112 |
|
|
113 |
#elif defined(__x86_64__) |
|
114 |
|
|
115 |
int64_t cpu_get_real_ticks(void) |
|
116 |
{ |
|
117 |
uint32_t low,high; |
|
118 |
int64_t val; |
|
119 |
asm volatile("rdtsc" : "=a" (low), "=d" (high)); |
|
120 |
val = high; |
|
121 |
val <<= 32; |
|
122 |
val |= low; |
|
123 |
return val; |
|
124 |
} |
|
125 |
|
|
126 |
#else |
|
127 |
|
|
128 |
static uint64_t emu_time; |
|
129 |
|
|
130 |
int64_t cpu_get_real_ticks(void) |
|
131 |
{ |
|
132 |
return emu_time++; |
|
133 |
} |
|
134 |
|
|
135 |
#endif |
|
136 |
|
|
102 | 137 |
#ifdef TARGET_I386 |
103 | 138 |
/***********************************************************/ |
104 | 139 |
/* CPUX86 core interface */ |
105 | 140 |
|
141 |
uint64_t cpu_get_tsc(CPUX86State *env) |
|
142 |
{ |
|
143 |
return cpu_get_real_ticks(); |
|
144 |
} |
|
145 |
|
|
106 | 146 |
static void write_dt(void *ptr, unsigned long addr, unsigned long limit, |
107 | 147 |
int flags) |
108 | 148 |
{ |
Also available in: Unified diff