From e1db8fe08e135c1c421f94ffb34afc6864862fc1 Mon Sep 17 00:00:00 2001 From: wlott <wlott> Date: Tue, 23 Oct 1990 02:03:06 +0000 Subject: [PATCH] Initial revision --- code/pmax-vm.lisp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 code/pmax-vm.lisp diff --git a/code/pmax-vm.lisp b/code/pmax-vm.lisp new file mode 100644 index 000000000..23ae90ca4 --- /dev/null +++ b/code/pmax-vm.lisp @@ -0,0 +1,41 @@ +;;; -*- Package: VM -*- +;;; +;;; ********************************************************************** +;;; This code was written as part of the Spice Lisp project at +;;; Carnegie-Mellon University, and has been placed in the public domain. +;;; If you want to use this code or any part of Spice Lisp, please contact +;;; Scott Fahlman (FAHLMAN@CMUC). +;;; ********************************************************************** +;;; +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pmax-vm.lisp,v 1.1 1990/10/23 02:03:06 wlott Exp $ +;;; +;;; This file contains the PMAX specific runtime stuff. +;;; +(in-package "VM") + +(export '(fixup-code-object)) + +(defun fixup-code-object (code offset fixup kind) + ;; Currently, the only kind of fixup we can have is a lui followed by an + ;; addi. + (multiple-value-bind + (word-offset rem) + (truncate offset vm:word-bytes) + (unless (zerop rem) + (error "Unaligned instruction? offset=#x~X." offset)) + (system:without-gcing + (let ((sap (truly-the system-area-pointer + (%primitive c::code-instructions code)))) + (ecase kind + (:jump + (assert (zerop (ash fixup -26))) + (setf (ldb (byte 26 0) + (system:sap-ref-32 sap word-offset)) + (ash fixup -2))) + (:lui + (setf (sap-ref-16 sap (* word-offset 2)) + (+ (ash fixup -16) + (if (logbitp 15 fixup) 1 0)))) + (:addi + (setf (sap-ref-16 sap (* word-offset 2)) + (ldb (byte 16 0) fixup)))))))) -- GitLab