Hello list,
I tried to fix some errors in cpuid.c ... wouldnt rely on it, my asms not very good and I havent tested it beyond seeing that it compiles. Basically it just makes the asm respect gcc using the ebx as a pic reg. Not sure about the \n\t stuff, it made it work tho.
--- virgin_code/oskit/libkern/x86/cpuid.c 2006-04-02 15:41:55.000000000 +0000 +++ cpuid.c 2006-04-10 17:14:57.000000000 +0000 @@ -39,12 +39,17 @@ unsigned i;
cicount++; - asm volatile("cpuid" + asm volatile( + "movl %%ebx, %%edi\n\t" + "cpuid\n\t" + "movl %1, %%ebx\n\t" + "movl %%edi, %%ebx\n\t" : "=a" (ci[0]), - "=b" (ci[1]), + "=r" (ci[1]), "=c" (ci[2]), "=d" (ci[3]) - : "a" (2)); + : "a" (2) + : "edi");
for (i = 0; i < 4; i++) { @@ -90,21 +95,29 @@ * CPUID is supported, so use it. * First get the vendor ID string. */ - asm volatile("cpuid" + asm volatile( + "movl %%ebx, %%edi\n\t" + "cpuid\n\t" + "movl %1, %%ebx\n\t" + "movl %%edi, %%ebx\n\t" : "=a" (highest_val), - "=b" (*((int*)(out_id->vendor_id+0))), + "=r" (*((int*)(out_id->vendor_id+0))), "=d" (*((int*)(out_id->vendor_id+4))), "=c" (*((int*)(out_id->vendor_id+8))) - : "a" (0)); + : "a" (0) + : "edi");
/* Now the feature information. */ if (highest_val >= 1) { - asm volatile("cpuid" - : "=a" (*((int*)out_id)), - "=d" (out_id->feature_flags) - : "a" (1) - : "ebx", "ecx"); + asm volatile( + "movl %%ebx, %%edi\n\t" + "cpuid\n\t" + "movl %%edi, %%ebx\n\t" + : "=a" (*((int*)out_id)), + "=d" (out_id->feature_flags) + : "a" (1) + : "ecx","edi"); }
/* Cache and TLB information. */
-- spooq
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello spoo(o)q,
spooq wrote on 10.04.2006 19:36 this:
I tried to fix some errors in cpuid.c ... wouldnt rely on it, my asms not very good and I havent tested it beyond seeing that it compiles. Basically it just makes the asm respect gcc using the ebx as a pic reg. Not sure about the \n\t stuff, it made it work tho.
Nice job. However, oskit is no longer supported as a libc for L4Env applications. Please use either dietlibc or uclibc.
Thanks, keep it up. Ron. - -- Mit freundlichen Gruessen / with regards ra3 @ inf.tu-dresden.de http://os.inf.tu-dresden.de/~ra3/
l4-hackers@os.inf.tu-dresden.de