1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
12 ;;;; Machine Architecture parameters:
13 (eval-when (:compile-toplevel :load-toplevel :execute)
15 (defconstant n-word-bits 32
17 "Number of bits per word where a word holds one lisp descriptor.")
19 (defconstant n-byte-bits 8
21 "Number of bits per byte where a byte is the smallest addressable object.")
23 (defconstant word-shift (1- (integer-length (/ n-word-bits n-byte-bits)))
25 "Number of bits to shift between word addresses and byte addresses.")
27 (defconstant n-word-bytes (/ n-word-bits n-byte-bits)
29 "Number of bytes in a word.")
31 (defconstant n-fixnum-tag-bits (1- n-lowtag-bits)
33 "Number of tag bits used for a fixnum")
35 (defconstant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits))
37 "Mask to get the fixnum tag")
39 (defconstant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1)
41 "Maximum number of bits in a positive fixnum")
43 (defconstant float-sign-shift 31)
45 (defconstant single-float-bias 126)
46 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
47 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
48 (defconstant single-float-normal-exponent-min 1)
49 (defconstant single-float-normal-exponent-max 254)
50 (defconstant single-float-hidden-bit (ash 1 23))
51 (defconstant single-float-trapping-nan-bit (ash 1 22))
53 (defconstant double-float-bias 1022)
54 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
55 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
56 (defconstant double-float-normal-exponent-min 1)
57 (defconstant double-float-normal-exponent-max #x7FE)
58 (defconstant double-float-hidden-bit (ash 1 20))
59 (defconstant double-float-trapping-nan-bit (ash 1 19))
62 ;;; X These values are for the x86 80 bit format and are no doubt
63 ;;; incorrect for the sparc.
65 (defconstant long-float-bias 16382)
66 (defconstant-eqx long-float-exponent-byte (byte 15 0) #'equalp)
67 (defconstant-eqx long-float-significand-byte (byte 31 0) #'equalp)
68 (defconstant long-float-normal-exponent-min 1)
69 (defconstant long-float-normal-exponent-max #x7FFE)
70 (defconstant long-float-hidden-bit (ash 1 31))
71 (defconstant long-float-trapping-nan-bit (ash 1 30))
73 (defconstant single-float-digits
74 (+ (byte-size single-float-significand-byte) 1))
76 (defconstant double-float-digits
77 (+ (byte-size double-float-significand-byte) n-word-bits 1))
79 ;;; This looks wrong - CSR
80 (defconstant long-float-digits
81 (+ (byte-size long-float-significand-byte) n-word-bits 1))
83 (defconstant float-inexact-trap-bit (ash 1 0))
84 (defconstant float-divide-by-zero-trap-bit (ash 1 1))
85 (defconstant float-underflow-trap-bit (ash 1 2))
86 (defconstant float-overflow-trap-bit (ash 1 3))
87 (defconstant float-invalid-trap-bit (ash 1 4))
89 (defconstant float-round-to-nearest 0)
90 (defconstant float-round-to-zero 1)
91 (defconstant float-round-to-positive 2)
92 (defconstant float-round-to-negative 3)
94 (defconstant-eqx float-rounding-mode (byte 2 30) #'equalp) ; RD
95 (defconstant-eqx float-sticky-bits (byte 5 5) #'equalp) ; aexc
96 (defconstant-eqx float-traps-byte (byte 5 23) #'equalp) ; TEM
97 (defconstant-eqx float-exceptions-byte (byte 5 0) #'equalp) ; cexc
99 ;;; According to the SPARC doc (as opposed to FPU doc), the fast mode
100 ;;; bit (EFM) is "reserved", and should always be zero. However, for
101 ;;; sparc-V8 and sparc-V9, it appears to work, causing denormals to
102 ;;; be truncated to 0 silently.
103 (defconstant float-fast-bit (ash 1 22))
107 ;;; NUMBER-STACK-DISPLACEMENT
109 ;;; The number of bytes reserved above the number stack pointer. These
110 ;;; slots are required by architecture for a place to spill register windows.
112 ;;; FIXME: Where is this used?
113 (defconstant number-stack-displacement
117 ;;;; Description of the target address space.
119 ;;; Where to put the different spaces. Must match the C code!
122 (defconstant read-only-space-start #x10000000)
123 (defconstant read-only-space-end #x15000000)
125 (defconstant static-space-start #x28000000)
126 (defconstant static-space-end #x2c000000)
128 ;; From alpha/parms.lisp:
129 ;; this is used in PURIFY as part of a sloppy check to see if a pointer
130 ;; is in dynamic space. Chocolate brownie for the first person to fix it
132 (defconstant dynamic-space-start #x30000000)
133 (defconstant dynamic-space-end #x38000000)
135 (defconstant dynamic-0-space-start #x30000000)
136 (defconstant dynamic-0-space-end #x38000000)
138 (defconstant dynamic-1-space-start #x40000000)
139 (defconstant dynamic-1-space-end #x48000000)
141 (defconstant control-stack-start #x50000000)
142 (defconstant control-stack-end #x51000000)
144 (defconstant binding-stack-start #x60000000)
145 (defconstant binding-stack-end #x61000000))
147 #!+sunos ; might as well start by trying the same numbers
149 (defconstant read-only-space-start #x10000000)
150 (defconstant read-only-space-end #x15000000)
152 (defconstant static-space-start #x28000000)
153 (defconstant static-space-end #x2c000000)
155 (defconstant dynamic-space-start #x30000000)
156 (defconstant dynamic-space-end #x38000000)
158 (defconstant dynamic-0-space-start #x30000000)
159 (defconstant dynamic-0-space-end #x38000000)
161 (defconstant dynamic-1-space-start #x40000000)
162 (defconstant dynamic-1-space-end #x48000000)
164 (defconstant control-stack-start #x50000000)
165 (defconstant control-stack-end #x51000000)
167 (defconstant binding-stack-start #x60000000)
168 (defconstant binding-stack-end #x61000000))
171 ;;;; other random constants.
173 (defenum (:suffix -trap :start 8)
182 (defenum (:prefix object-not- :suffix -trap :start 16)
186 (defenum (:prefix trace-table-)
194 ;;; These symbols are loaded into static space directly after NIL so
195 ;;; that the system can compute their address by adding a constant
198 ;;; The fdefn objects for the static functions are loaded into static
199 ;;; space directly after the static symbols. That way, the raw-addr
200 ;;; can be loaded directly out of them by indirecting relative to NIL.
202 (defparameter *static-symbols*
205 ;; The C startup code must fill these in.
207 ;;lisp::lisp-environment-list
208 ;;lisp::lisp-command-line-list
209 sb!impl::*!initial-fdefn-objects*
211 ;; Functions that the C code needs to call
213 sb!kernel::internal-error
214 sb!di::handle-breakpoint
215 sb!di::handle-fun-end-breakpoint
218 *read-only-space-free-pointer*
219 *static-space-free-pointer*
220 *initial-dynamic-space-free-pointer*
222 ;; Things needed for non-local-exit.
223 *current-catch-block*
224 *current-unwind-protect-block*
226 ;; Interrupt Handling
227 *free-interrupt-context-index*
228 sb!unix::*interrupts-enabled*
229 sb!unix::*interrupt-pending*
232 (defparameter *static-funs*
234 two-arg-+ two-arg-- two-arg-* two-arg-/ two-arg-< two-arg-> two-arg-=
235 two-arg-<= two-arg->= two-arg-/= eql %negate
236 two-arg-and two-arg-ior two-arg-xor
237 two-arg-gcd two-arg-lcm
240 ;;;; Assembler parameters:
242 ;;; The number of bits per element in the assemblers code vector.
243 (defparameter *assembly-unit-length* 8)
246 ;;;; Pseudo-atomic trap number
248 ;;; KLUDGE: Linux on the SPARC doesn't seem to conform to any kind of
249 ;;; standards at all. So we use an explicitly undefined trap, because
250 ;;; that currently does the right thing. Expect this to break
251 ;;; eventually (but with luck, at that point we'll be able to revert
252 ;;; to the compliant trap number...
254 ;;; KLUDGE: Maybe this should be called pseudo-atomic-magic-number,
255 ;;; allowing other architectures (which don't necessarily use traps
256 ;;; for pseudo-atomic) to propagate a magic number to C land via
259 (defconstant pseudo-atomic-trap #x10)
261 (defconstant pseudo-atomic-trap #x40)