From 7db30a1e7a97493df7b5dae0507cdf6d24bf15f0 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Tue, 6 Jan 2015 23:07:49 -0500 Subject: [PATCH] Really really properly access cpuid_fn1_ecx, courtesy of pvk. --- src/assembly/x86-64/arith.lisp | 5 ++++- src/runtime/x86-64-arch.c | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/assembly/x86-64/arith.lisp b/src/assembly/x86-64/arith.lisp index f685eb361..bfb9240d8 100644 --- a/src/assembly/x86-64/arith.lisp +++ b/src/assembly/x86-64/arith.lisp @@ -458,7 +458,10 @@ #!-win32 (progn ;; POPCNT = ECX bit 23 = bit 7 of byte index 2 - (emit-foreign-logbitp 23 "cpuid_fn1_ecx" rdx) + ;; this use of 'rcx' is as the temporary register for performing + ;; a reference to foreign data with dynamic core. It has to be + ;; a register that conflicts with 'arg' lest we clobber it. + (emit-foreign-logbitp 23 "cpuid_fn1_ecx" rcx) (inst jmp :z slow) ;; Intel's implementation of POPCNT on some models treats it as ;; a 2-operand ALU op in the manner of ADD,SUB,etc which means that diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index bcf5e6a2a..5f63444ce 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -57,7 +57,6 @@ void arch_init(void) { #ifndef LISP_FEATURE_WIN32 unsigned int eax, ebx, ecx, edx; - int i; cpuid(0, &eax, &ebx, &ecx, &edx); if (eax >= 1) { // see if we can execute basic id function 1 -- 2.11.4.GIT