Fix ticket:63.
authorRaymond Toy <toy.raymond@gmail.com>
Wed, 26 Sep 2012 04:09:46 +0000 (21:09 -0700)
committerRaymond Toy <toy.raymond@gmail.com>
Wed, 26 Sep 2012 04:09:46 +0000 (21:09 -0700)
src/compiler/x86/system.lisp

index edd4aad..bb32332 100644 (file)
@@ -1,4 +1,4 @@
-;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: x86 -*-
+4;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: x86 -*-
 ;;;
 ;;; **********************************************************************
 ;;; This code was written as part of the CMU Common Lisp project at
   (:result-types unsigned-num unsigned-num)
   (:temporary (:sc unsigned-reg :offset eax-offset :target lo) eax)
   (:temporary (:sc unsigned-reg :offset edx-offset :target hi) edx)
+  ;; CPUID writes to eax, ebx, ecx, and edx.  We need temporaries for
+  ;; ebx and ecx so we don't destroy any live uses of ebx and ecx.
+  (:temporary (:sc unsigned-reg :offset ebx-offset
+                  :from (:eval 0) :to (:result 1))
+             ebx)
+  (:temporary (:sc unsigned-reg :offset ecx-offset
+                  :from (:eval 0) :to (:result 2))
+             ecx)
+  (:ignore ebx ecx)
   (:generator 1
-     (inst cpuid)
-     (inst rdtsc)
-     (move hi edx)
-     (move lo eax)))
+    (inst mov eax 0)
+    (inst cpuid)
+    (inst rdtsc)
+    (move hi edx)
+    (move lo eax)))
 
 #+pentium
 (defun read-cycle-counter ()