mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
trace: comment x86 timestamp() implementations
Fixes genodelabs/genode#4243
This commit is contained in:
parent
31b049864c
commit
2b0bb6dda0
@ -26,16 +26,19 @@ namespace Genode { namespace Trace {
|
||||
{
|
||||
uint64_t t;
|
||||
__asm__ __volatile__ (
|
||||
"pushl %%ebx\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"cpuid\n\t"
|
||||
"pushl %%ebx\n\t" /* ebx is reserved in PIC mode, but clobbered by cpuid */
|
||||
"xorl %%eax,%%eax\n\t" /* provide constant argument to cpuid to reduce variance */
|
||||
"cpuid\n\t" /* synchronise, i.e. finish all preceeding instructions */
|
||||
"popl %%ebx\n\t"
|
||||
:
|
||||
:
|
||||
: "%eax", "%ecx", "%edx"
|
||||
);
|
||||
__asm__ __volatile__ (
|
||||
"rdtsc" : "=A" (t)
|
||||
"rdtsc"
|
||||
: "=A" (t)
|
||||
:
|
||||
: "memory" /* prevent reordering of asm statements */
|
||||
);
|
||||
|
||||
return t;
|
||||
|
@ -27,14 +27,17 @@ namespace Genode { namespace Trace {
|
||||
{
|
||||
uint32_t lo, hi;
|
||||
__asm__ __volatile__ (
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"cpuid\n\t"
|
||||
"xorl %%eax,%%eax\n\t" /* provide constant argument to cpuid to reduce variance */
|
||||
"cpuid\n\t" /* synchronise, i.e. finish all preceeding instructions */
|
||||
:
|
||||
:
|
||||
: "%rax", "%rbx", "%rcx", "%rdx"
|
||||
);
|
||||
__asm__ __volatile__ (
|
||||
"rdtsc" : "=a" (lo), "=d" (hi)
|
||||
"rdtsc"
|
||||
: "=a" (lo), "=d" (hi)
|
||||
:
|
||||
: "memory" /* prevent reordering of asm statements */
|
||||
);
|
||||
|
||||
return (uint64_t)hi << 32 | lo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user