Commit 2c5e8fd7 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

zdtm/x86: Don't override %ebx in fpu00

%ebx, %ecx aren't specified as clobbers in chk_proc_fpu(),
while asm cpuid overwrites them.

In the turn, %ebx is used as a code position by gcc now:
    1661:       e8 9a 00 00 00          call   1700 <__x86.get_pc_thunk.bx>
    1666:       81 c3 46 68 00 00       add    $0x6846,%ebx

Which results in dereferencing some ugly garbage (result of cpuid).

Let's use zdtm/lib cpuid() function instead.
Signed-off-by: 's avatarDmitry Safonov <dima@arista.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent f25f9d57
......@@ -7,6 +7,9 @@ const char *test_doc = "Start a calculation, leaving FPU in a certain state,\n"
const char *test_author = "Pavel Emelianov <xemul@parallels.com>";
#if defined(__i386__) || defined(__x86_64__)
#include "cpuid.h"
void start(float a, float b, float c, float d)
{
__asm__ volatile (
......@@ -31,16 +34,15 @@ float finish(void)
return res;
}
#define CPUID_FEAT_EDX_FPU (1 << 0)
int chk_proc_fpu(void)
{
unsigned long fi;
uint32_t eax, ebx, ecx, edx;
__asm__ volatile (
"mov $1, %%eax\n"
"cpuid\n"
: "=d" (fi) : : "eax"
);
return fi & (1 << 0);
cpuid(1, &eax, &ebx, &ecx, &edx);
return edx & CPUID_FEAT_EDX_FPU;
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment