diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-26 16:50:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-26 16:50:22 (GMT) |
commit | 6fe094e1ef1e4653b1d7472bf2ed49820c3873fe (patch) | |
tree | cb43554bb60f7d2d6609a482a0838fcd1a437ba9 /unix/tclUnixCompat.c | |
parent | 35cf66b42dab2aa4c628328adb5ae3a068c8318f (diff) | |
download | tcl-6fe094e1ef1e4653b1d7472bf2ed49820c3873fe.zip tcl-6fe094e1ef1e4653b1d7472bf2ed49820c3873fe.tar.gz tcl-6fe094e1ef1e4653b1d7472bf2ed49820c3873fe.tar.bz2 |
[Bug 3601804]: platformCPUID segmentation fault on Darwin
Diffstat (limited to 'unix/tclUnixCompat.c')
-rw-r--r-- | unix/tclUnixCompat.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 5a3ccd4..4ca7da9 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -693,11 +693,19 @@ TclWinCPUID( /* See: <http://en.wikipedia.org/wiki/CPUID> */ #if defined(HAVE_CPUID) +#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64) + __asm__ __volatile__("movq %%rbx, %%rsi \n\t" /* save %rbx */ + "cpuid \n\t" + "xchgq %%rsi, %%rbx \n\t" /* restore the old %rbx */ + : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3]) + : "a"(index)); +#else __asm__ __volatile__("mov %%ebx, %%esi \n\t" /* save %ebx */ "cpuid \n\t" "xchg %%esi, %%ebx \n\t" /* restore the old %ebx */ : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3]) : "a"(index)); +#endif status = TCL_OK; #endif return status; |