X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fx86-vm.lisp;h=bd1935f08b43366ac7d2ad5ed5fac50f219628b1;hb=cd13034f9415f64cdaa05893a4ac5ff1e95c97bd;hp=0b15e821eafba503d2e997d4bec7a0e49bc57ab9;hpb=62e95b4e33a18683689820eb5c1d1fd54098828a;p=sbcl.git diff --git a/src/code/x86-vm.lisp b/src/code/x86-vm.lisp index 0b15e82..bd1935f 100644 --- a/src/code/x86-vm.lisp +++ b/src/code/x86-vm.lisp @@ -41,10 +41,25 @@ "Return a string describing the type of the local machine." "X86") -(defun machine-version () - #!+sb-doc - "Return a string describing the version of the local machine." - "X86") +;;; arch-specific support for CL:MACHINE-VERSION, defined OAOO elsewhere +(defun get-machine-version () + #!+linux + (with-open-file (stream "/proc/cpuinfo" + ;; Even on Linux it's an option to build + ;; kernels without /proc filesystems, so + ;; degrade gracefully. + :if-does-not-exist nil) + (loop with line while (setf line (read-line stream nil)) + ;; The field "model name" exists on kernel 2.4.21-rc6-ac1 + ;; anyway, with values e.g. + ;; "AMD Athlon(TM) XP 2000+" + ;; "Intel(R) Pentium(R) M processor 1300MHz" + ;; which seem comparable to the information in the example + ;; in the MACHINE-VERSION page of the ANSI spec. + when (eql (search "model name" line) 0) + return (string-trim " " (subseq line (1+ (position #\: line)))))) + #!-linux + nil) ;;;; :CODE-OBJECT fixups @@ -52,6 +67,13 @@ (defvar *num-fixups* 0) ;;; FIXME: When the system runs, it'd be interesting to see what this is. +(declaim (inline adjust-fixup-array)) +(defun adjust-fixup-array (array size) + (let ((length (length array)) + (new (make-array size :element-type '(unsigned-byte 32)))) + (replace new array) + new)) + ;;; This gets called by LOAD to resolve newly positioned objects ;;; with things (like code instructions) that have to refer to them. ;;; @@ -69,8 +91,7 @@ (let ((fixups (code-header-ref code code-constants-offset))) (cond ((typep fixups '(simple-array (unsigned-byte 32) (*))) (let ((new-fixups - (adjust-array fixups (1+ (length fixups)) - :element-type '(unsigned-byte 32)))) + (adjust-fixup-array fixups (1+ (length fixups))))) (setf (aref new-fixups (length fixups)) offset) (setf (code-header-ref code code-constants-offset) new-fixups))) @@ -80,7 +101,7 @@ (zerop fixups)) (format t "** Init. code FU = ~S~%" fixups)) ; FIXME (setf (code-header-ref code code-constants-offset) - (make-specializable-array + (make-array 1 :element-type '(unsigned-byte 32) :initial-element offset))))))) @@ -133,8 +154,7 @@ (let ((fixups (code-header-ref code code-constants-offset))) (cond ((typep fixups '(simple-array (unsigned-byte 32) (*))) (let ((new-fixups - (adjust-array fixups (1+ (length fixups)) - :element-type '(unsigned-byte 32)))) + (adjust-fixup-array fixups (1+ (length fixups))))) (setf (aref new-fixups (length fixups)) offset) (setf (code-header-ref code code-constants-offset) new-fixups))) @@ -144,7 +164,7 @@ (zerop fixups)) (sb!impl::!cold-lose "Argh! can't process fixup")) (setf (code-header-ref code code-constants-offset) - (make-specializable-array + (make-array 1 :element-type '(unsigned-byte 32) :initial-element offset)))))))