diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-01-26 16:53:59 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-01-26 16:53:59 (GMT) |
commit | b1d6cbae6a390284d05b47a03be3780406f0e83b (patch) | |
tree | 99732543bf9cf5ac064afd46ad757c1104e72435 /unix/tclUnixCompat.c | |
parent | c6f76c3136ee2ee2e22a7c40b9418e9c7d881d83 (diff) | |
parent | 9a3f8c727d8a7d19d8f9c3173321fd6c2115a5d3 (diff) | |
download | tcl-b1d6cbae6a390284d05b47a03be3780406f0e83b.zip tcl-b1d6cbae6a390284d05b47a03be3780406f0e83b.tar.gz tcl-b1d6cbae6a390284d05b47a03be3780406f0e83b.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 905bc10..0fc51b7 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -987,11 +987,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; |