Commit 96f4e513 authored by Fabrice Bellard's avatar Fabrice Bellard
Browse files

added external cpuid code to solve -fPIC and gcc unclear constraints problems

Originally committed as revision 25 to svn://
parent 0725406c
.file "cpuid.s"
.version "01.01"
.align 4
.globl cpuid
.type cpuid,@function
pushl %ebp
movl %esp,%ebp
pushl %edi
pushl %esi
pushl %ebx
movl 8(%ebp),%eax
movl 12(%ebp),%edi
movl 24(%ebp),%esi
movl %eax,(%edi)
movl 16(%ebp),%eax
movl %ebx,(%eax)
movl 20(%ebp),%eax
movl %ecx,(%eax)
movl %edx,(%esi)
popl %ebx
popl %esi
popl %edi
.size cpuid,.Lfe1-cpuid
.align 4
......@@ -4,18 +4,8 @@
#include <stdlib.h>
#include "../dsputil.h"
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
static inline void cpuid(int index, int *eax, int *ebx, int *ecx, int *edx)
asm ("pushl %%ebx\n\t"
"movl %%ebx, %1\n\t"
"popl %%ebx\n\t"
: "=a" (*eax), "=m" (*ebx),
"=c" (*ecx), "=d" (*edx)
: "a" (index)
: "cc");
/* need this external function to solve -fPIC ebx issues ! */
extern void cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
/* Function to test if multimedia instructions are supported... */
int mm_support(void)
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