1 ;;;; MIPS compiler support for the debugger
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
15 (define-vop (debug-cur-sp)
16 (:translate sb!di::current-sp)
18 (:results (res :scs (sap-reg)))
19 (:result-types system-area-pointer)
23 (define-vop (debug-cur-fp)
24 (:translate sb!di::current-fp)
26 (:results (res :scs (sap-reg)))
27 (:result-types system-area-pointer)
31 (define-vop (read-control-stack)
32 (:translate sb!kernel:stack-ref)
34 (:args (object :scs (sap-reg) :target sap)
35 (offset :scs (any-reg)))
36 (:arg-types system-area-pointer positive-fixnum)
37 (:temporary (:scs (sap-reg) :from :eval) sap)
38 (:results (result :scs (descriptor-reg)))
41 (inst addu sap object offset)
42 (inst lw result sap 0)
45 (define-vop (read-control-stack-c)
46 (:translate sb!kernel:stack-ref)
48 (:args (object :scs (sap-reg)))
50 (:arg-types system-area-pointer (:constant (signed-byte 14)))
51 (:results (result :scs (descriptor-reg)))
54 (inst lw result object (* offset n-word-bytes))
57 (define-vop (write-control-stack)
58 (:translate sb!kernel:%set-stack-ref)
60 (:args (object :scs (sap-reg) :target sap)
61 (offset :scs (any-reg))
62 (value :scs (descriptor-reg) :target result))
63 (:arg-types system-area-pointer positive-fixnum *)
64 (:results (result :scs (descriptor-reg)))
66 (:temporary (:scs (sap-reg) :from (:argument 1)) sap)
68 (inst addu sap object offset)
72 (define-vop (write-control-stack-c)
73 (:translate %set-stack-ref)
75 (:args (sap :scs (sap-reg))
76 (value :scs (descriptor-reg) :target result))
78 (:arg-types system-area-pointer (:constant (signed-byte 14)) *)
79 (:results (result :scs (descriptor-reg)))
82 (inst sw value sap (* offset n-word-bytes))
86 (define-vop (code-from-mumble)
88 (:args (thing :scs (descriptor-reg)))
89 (:results (code :scs (descriptor-reg)))
90 (:temporary (:scs (non-descriptor-reg)) temp)
91 (:variant-vars lowtag)
93 (let ((bogus (gen-label))
95 (loadw temp thing 0 lowtag)
96 (inst srl temp n-widetag-bits)
98 (inst sll temp (1- (integer-length n-word-bytes)))
99 (unless (= lowtag other-pointer-lowtag)
100 (inst addu temp (- lowtag other-pointer-lowtag)))
101 (inst subu code thing temp)
103 (assemble (*elsewhere*)
106 (move code null-tn t)))))
108 (define-vop (code-from-lra code-from-mumble)
109 (:translate sb!di::lra-code-header)
110 (:variant other-pointer-lowtag))
112 (define-vop (code-from-fun code-from-mumble)
113 (:translate sb!di::fun-code-header)
114 (:variant fun-pointer-lowtag))
116 (define-vop (make-lisp-obj)
118 (:translate sb!di::make-lisp-obj)
119 (:args (value :scs (unsigned-reg) :target result))
120 (:arg-types unsigned-num)
121 (:results (result :scs (descriptor-reg)))
123 (move result value)))
125 (define-vop (get-lisp-obj-address)
127 (:translate sb!di::get-lisp-obj-address)
128 (:args (thing :scs (descriptor-reg) :target result))
129 (:results (result :scs (unsigned-reg)))
130 (:result-types unsigned-num)
132 (move result thing)))
134 (define-vop (fun-word-offset)
136 (:translate sb!di::fun-word-offset)
137 (:args (fun :scs (descriptor-reg)))
138 (:results (res :scs (unsigned-reg)))
139 (:result-types positive-fixnum)
141 (loadw res fun 0 fun-pointer-lowtag)
142 (inst srl res n-widetag-bits)))