Mercurial > mplayer.hg
comparison TOOLS/cpuinfo.c @ 18534:cbcea803efa1
x86_64 only saves ebx, not rbx. Fix some potential compilation problem on amd64.
Patch by Zuxy Meng
author | gpoirier |
---|---|
date | Wed, 17 May 2006 20:15:02 +0000 |
parents | 31c96e2b64b4 |
children | 2d996eb065d4 |
comparison
equal
deleted
inserted
replaced
18533:6b92a27e247c | 18534:cbcea803efa1 |
---|---|
41 | 41 |
42 static cpuid_regs_t | 42 static cpuid_regs_t |
43 cpuid(int func) { | 43 cpuid(int func) { |
44 cpuid_regs_t regs; | 44 cpuid_regs_t regs; |
45 #define CPUID ".byte 0x0f, 0xa2; " | 45 #define CPUID ".byte 0x0f, 0xa2; " |
46 #ifdef __x86_64__ | |
47 asm("mov %%rbx, %%rsi\n\t" | |
48 #else | |
46 asm("mov %%ebx, %%esi\n\t" | 49 asm("mov %%ebx, %%esi\n\t" |
50 #endif | |
47 CPUID"\n\t" | 51 CPUID"\n\t" |
48 "xchg %%esi, %%ebx" | 52 #ifdef __x86_64__ |
53 "xchg %%rsi, %%rbx\n\t" | |
54 #else | |
55 "xchg %%esi, %%ebx\n\t" | |
56 #endif | |
49 : "=a" (regs.eax), "=S" (regs.ebx), "=c" (regs.ecx), "=d" (regs.edx) | 57 : "=a" (regs.eax), "=S" (regs.ebx), "=c" (regs.ecx), "=d" (regs.edx) |
50 : "0" (func)); | 58 : "0" (func)); |
51 return regs; | 59 return regs; |
52 } | 60 } |
53 | 61 |