[movitz-cvs] CVS update: movitz/losp/muerte/segments.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Thu Oct 21 20:51:13 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv4631

Modified Files:
	segments.lisp 
Log Message:
Add operator control-register to read the x86 CPU's control registers.

Date: Thu Oct 21 22:51:13 2004
Author: ffjeld

Index: movitz/losp/muerte/segments.lisp
diff -u movitz/losp/muerte/segments.lisp:1.3 movitz/losp/muerte/segments.lisp:1.4
--- movitz/losp/muerte/segments.lisp:1.3	Tue Apr  6 16:32:00 2004
+++ movitz/losp/muerte/segments.lisp	Thu Oct 21 22:51:13 2004
@@ -10,7 +10,7 @@
 ;;;; Author:        Frode Vatvedt Fjeld <frodef at acm.org>
 ;;;; Created at:    Thu May  8 14:25:06 2003
 ;;;;                
-;;;; $Id: segments.lisp,v 1.3 2004/04/06 14:32:00 ffjeld Exp $
+;;;; $Id: segments.lisp,v 1.4 2004/10/21 20:51:13 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -90,6 +90,16 @@
     (:lgdt (:ecx))))
 
 ;;;
+
+(defun control-register (name)
+  (macrolet ((creg (reg)
+	       `(with-inline-assembly (:returns :untagged-fixnum-ecx)
+		  (:movcr ,reg :ecx))))
+    (ecase name
+      (:cr0 (creg :cr0))
+      (:cr2 (creg :cr2))
+      (:cr3 (creg :cr3))
+      (:cr4 (creg :cr4)))))
 
 (defun control-register-lo12 (name)
   "Return the low 12 bits of an x86 control register, such as :cr0 or :cr1."





More information about the Movitz-cvs mailing list