liquid
2004-02-01, 19:53:35
ushort check_ID_proc(CPU_info_struct& info)
{
ushort cpu_type = 0xffff;
static char vendor_id[13] = "We love AMD!";
__asm__ __volatile__(
"xorl %%eax, %%eax \n\t" // clear EAX
"cpuid \n\t"
"pushl %%eax \n\t" // save EAX
// get pointer to vendor_id buffer into EAX
"movl %3, %%eax \n\t"
// copy vendor string out of EBX, EDX and ECX
"movl %%ebx, (%%eax) \n\t"
"movl %%edx, 4(%%eax) \n\t"
"movl %%ecx, 8(%%eax) \n\t"
"popl %%eax \n\t" // restore eax
// make sure 1 is valid input for CPUID
"cmpl $1, %%eax \n\t"
"jl 1f \n\t" // jump to end IF not
"xorl %%eax, %%eax \n\t" // clear EAX
"inc %%eax \n\t" // increment EAX
// get family/model/stepping features
"cpuid \n\t"
"movb %%al, %0 \n\t" // mov stepping, al
"andb $0x0f, %0 \n\t" // and stepping 0fh
"andb $0xf0, %%al \n\t"
"shrb $4, %%al \n\t"
"movb %%al, %1 \n\t" // model ID
"andl $0x0f00, %%eax \n\t"
"shrl $8, %%eax \n\t" // isolate family
"andl $0x0f, %%eax \n\t"
"movw %%ax, %2 \n\t" // CPU type
"1: \n\t" // END_DETECTION
"movw %2, %%ax \n\t"
// outputs
: "=m" (info.stepping),
"=m" (info.model),
"+m" (cpu_type)
// inputs
: "m" (vendor_id)
// clobbers
: "%eax", "%ebx", "%ecx", "%edx", "cc"
);
info.vendor_id = vendor_id;
info.cpu_type = cpu_type;
return info.cpu_type;
}
Der GCC meldet mir da immer ein "warning: use of memory input without lvalue in asm operand 3 is deprecated" - ich frage mich schon die ganze Zeit was er mir damit sagen will. Habt ihr ne Ahnung?
cya
liquid
{
ushort cpu_type = 0xffff;
static char vendor_id[13] = "We love AMD!";
__asm__ __volatile__(
"xorl %%eax, %%eax \n\t" // clear EAX
"cpuid \n\t"
"pushl %%eax \n\t" // save EAX
// get pointer to vendor_id buffer into EAX
"movl %3, %%eax \n\t"
// copy vendor string out of EBX, EDX and ECX
"movl %%ebx, (%%eax) \n\t"
"movl %%edx, 4(%%eax) \n\t"
"movl %%ecx, 8(%%eax) \n\t"
"popl %%eax \n\t" // restore eax
// make sure 1 is valid input for CPUID
"cmpl $1, %%eax \n\t"
"jl 1f \n\t" // jump to end IF not
"xorl %%eax, %%eax \n\t" // clear EAX
"inc %%eax \n\t" // increment EAX
// get family/model/stepping features
"cpuid \n\t"
"movb %%al, %0 \n\t" // mov stepping, al
"andb $0x0f, %0 \n\t" // and stepping 0fh
"andb $0xf0, %%al \n\t"
"shrb $4, %%al \n\t"
"movb %%al, %1 \n\t" // model ID
"andl $0x0f00, %%eax \n\t"
"shrl $8, %%eax \n\t" // isolate family
"andl $0x0f, %%eax \n\t"
"movw %%ax, %2 \n\t" // CPU type
"1: \n\t" // END_DETECTION
"movw %2, %%ax \n\t"
// outputs
: "=m" (info.stepping),
"=m" (info.model),
"+m" (cpu_type)
// inputs
: "m" (vendor_id)
// clobbers
: "%eax", "%ebx", "%ecx", "%edx", "cc"
);
info.vendor_id = vendor_id;
info.cpu_type = cpu_type;
return info.cpu_type;
}
Der GCC meldet mir da immer ein "warning: use of memory input without lvalue in asm operand 3 is deprecated" - ich frage mich schon die ganze Zeit was er mir damit sagen will. Habt ihr ne Ahnung?
cya
liquid