aboutsummaryrefslogtreecommitdiffstats
path: root/com32/sysdump/cpuid.c
diff options
context:
space:
mode:
authorchandramouli narayanan <mouli@linux.intel.com>2012-06-25 12:50:11 -0700
committerchandramouli narayanan <mouli@linux.intel.com>2012-06-25 12:50:11 -0700
commita5759fa44611e372eccc01d85f2db1bc7050c77d (patch)
tree4c8d3d4396187cfb8f58fa9f7dd907e3d988c1e7 /com32/sysdump/cpuid.c
parent357d40435e62ee1e8b3a96107375282fdc1dd6e6 (diff)
downloadsyslinux-a5759fa44611e372eccc01d85f2db1bc7050c77d.tar.gz
syslinux-a5759fa44611e372eccc01d85f2db1bc7050c77d.tar.xz
syslinux-a5759fa44611e372eccc01d85f2db1bc7050c77d.zip
Archicture-dependent get_cpuid in sysdump/cpuid is fixed.
In the following sample programs zzjson.c, advdump.c, entrydump.c, hello.c, resolv.c, serialinfo.c in com32/samples, the following code call hangs the program: openconsole(&dev_null_r, &dev_stdcon_w); The following fix works: openconsole(&dev_rawcon_r, &dev_ansiserial_w); Remanants of the unused old i386-only files, if any, need to be pruned.
Diffstat (limited to 'com32/sysdump/cpuid.c')
-rw-r--r--com32/sysdump/cpuid.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/com32/sysdump/cpuid.c b/com32/sysdump/cpuid.c
index e7fc5767..846b5408 100644
--- a/com32/sysdump/cpuid.c
+++ b/com32/sysdump/cpuid.c
@@ -20,10 +20,21 @@ struct cpuid_info {
static void get_cpuid(uint32_t eax, uint32_t ecx, struct cpuid_data *data)
{
+#if __SIZEOF_POINTER__ == 4
asm("pushl %%ebx ; cpuid ; movl %%ebx,%1 ; popl %%ebx"
: "=a" (data->eax), "=r" (data->ebx),
"=c" (data->ecx), "=d" (data->edx)
: "a" (eax), "c" (ecx));
+#elif __SIZEOF_POINTER__ == 8
+ asm volatile("push %%rbx; cpuid; movl %%ebx, %1; pop %%rbx"
+ : "=a" (data->eax),
+ "=b" (data->ebx),
+ "=c" (data->ecx),
+ "=d" (data->edx)
+ : "a" (eax), "c" (ecx));
+#else
+#error "unsupported architecture"
+#endif
}
#define CPUID_CHUNK 128