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 (def!constant n-word-bits 32
17 "Number of bits per word where a word holds one lisp descriptor.")
19 ;;; the natural width of a machine word (as seen in e.g. register width,
21 (def!constant n-machine-word-bits 32)
23 (def!constant n-byte-bits 8
25 "Number of bits per byte where a byte is the smallest addressable object.")
27 (def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits)))
29 "Number of bits to shift between word addresses and byte addresses.")
31 (def!constant n-word-bytes (/ n-word-bits n-byte-bits)
33 "Number of bytes in a word.")
35 (def!constant float-sign-shift 31)
37 (def!constant single-float-bias 126)
38 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
39 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
40 (def!constant single-float-normal-exponent-min 1)
41 (def!constant single-float-normal-exponent-max 254)
42 (def!constant single-float-hidden-bit (ash 1 23))
43 (def!constant single-float-trapping-nan-bit (ash 1 22))
45 (def!constant double-float-bias 1022)
46 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
47 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
48 (def!constant double-float-normal-exponent-min 1)
49 (def!constant double-float-normal-exponent-max #x7FE)
50 (def!constant double-float-hidden-bit (ash 1 20))
51 (def!constant double-float-trapping-nan-bit (ash 1 19))
54 ;;; X These values are for the x86 80 bit format and are no doubt
55 ;;; incorrect for the sparc.
57 (def!constant long-float-bias 16382)
58 (defconstant-eqx long-float-exponent-byte (byte 15 0) #'equalp)
59 (defconstant-eqx long-float-significand-byte (byte 31 0) #'equalp)
60 (def!constant long-float-normal-exponent-min 1)
61 (def!constant long-float-normal-exponent-max #x7FFE)
62 (def!constant long-float-hidden-bit (ash 1 31))
63 (def!constant long-float-trapping-nan-bit (ash 1 30))
65 (def!constant single-float-digits
66 (+ (byte-size single-float-significand-byte) 1))
68 (def!constant double-float-digits
69 (+ (byte-size double-float-significand-byte) n-word-bits 1))
71 ;;; This looks wrong - CSR
72 (def!constant long-float-digits
73 (+ (byte-size long-float-significand-byte) n-word-bits 1))
75 (def!constant float-inexact-trap-bit (ash 1 0))
76 (def!constant float-divide-by-zero-trap-bit (ash 1 1))
77 (def!constant float-underflow-trap-bit (ash 1 2))
78 (def!constant float-overflow-trap-bit (ash 1 3))
79 (def!constant float-invalid-trap-bit (ash 1 4))
81 (def!constant float-round-to-nearest 0)
82 (def!constant float-round-to-zero 1)
83 (def!constant float-round-to-positive 2)
84 (def!constant float-round-to-negative 3)
86 (defconstant-eqx float-rounding-mode (byte 2 30) #'equalp) ; RD
87 (defconstant-eqx float-sticky-bits (byte 5 5) #'equalp) ; aexc
88 (defconstant-eqx float-traps-byte (byte 5 23) #'equalp) ; TEM
89 (defconstant-eqx float-exceptions-byte (byte 5 0) #'equalp) ; cexc
91 ;;; According to the SPARC doc (as opposed to FPU doc), the fast mode
92 ;;; bit (EFM) is "reserved", and should always be zero. However, for
93 ;;; sparc-V8 and sparc-V9, it appears to work, causing denormals to
94 ;;; be truncated to 0 silently.
95 (def!constant float-fast-bit (ash 1 22))
99 ;;; NUMBER-STACK-DISPLACEMENT
101 ;;; The number of bytes reserved above the number stack pointer. These
102 ;;; slots are required by architecture for a place to spill register windows.
104 ;;; FIXME: Where is this used?
105 (def!constant number-stack-displacement
109 ;;;; Description of the target address space.
111 ;;; Where to put the different spaces. Must match the C code!
114 (def!constant read-only-space-start #x10000000)
115 (def!constant read-only-space-end #x15000000)
117 (def!constant static-space-start #x28000000)
118 (def!constant static-space-end #x2c000000)
120 ;; From alpha/parms.lisp:
121 ;; this is used in PURIFY as part of a sloppy check to see if a pointer
122 ;; is in dynamic space. Chocolate brownie for the first person to fix it
124 (def!constant dynamic-space-start #x30000000)
125 (def!constant dynamic-space-end #x38000000)
127 (def!constant dynamic-0-space-start #x30000000)
128 (def!constant dynamic-0-space-end #x38000000)
130 (def!constant dynamic-1-space-start #x40000000)
131 (def!constant dynamic-1-space-end #x48000000))
133 #!+sunos ; might as well start by trying the same numbers
135 (def!constant read-only-space-start #x10000000)
136 (def!constant read-only-space-end #x15000000)
138 (def!constant static-space-start #x28000000)
139 (def!constant static-space-end #x2c000000)
141 (def!constant dynamic-space-start #x30000000)
142 (def!constant dynamic-space-end #x38000000)
144 (def!constant dynamic-0-space-start #x30000000)
145 (def!constant dynamic-0-space-end #x38000000)
147 (def!constant dynamic-1-space-start #x40000000)
148 (def!constant dynamic-1-space-end #x48000000))
151 ;;;; other random constants.
153 (defenum (:suffix -trap :start 8)
162 (defenum (:prefix object-not- :suffix -trap :start 16)
166 (defenum (:prefix trace-table-)
174 ;;; These symbols are loaded into static space directly after NIL so
175 ;;; that the system can compute their address by adding a constant
178 ;;; The fdefn objects for the static functions are loaded into static
179 ;;; space directly after the static symbols. That way, the raw-addr
180 ;;; can be loaded directly out of them by indirecting relative to NIL.
182 (defparameter *static-symbols*
185 ;; The C startup code must fill these in.
187 sb!impl::*!initial-fdefn-objects*
189 ;; functions that the C code needs to call
191 sb!kernel::internal-error
192 sb!kernel::control-stack-exhausted-error
193 sb!di::handle-breakpoint
194 sb!di::handle-fun-end-breakpoint
197 *read-only-space-free-pointer*
198 *static-space-free-pointer*
199 *initial-dynamic-space-free-pointer*
201 ;; things needed for non-local exit
202 *current-catch-block*
203 *current-unwind-protect-block*
205 *binding-stack-start*
206 *control-stack-start*
209 ;; interrupt handling
210 *free-interrupt-context-index*
211 sb!unix::*interrupts-enabled*
212 sb!unix::*interrupt-pending*
215 (defparameter *static-funs*
217 two-arg-+ two-arg-- two-arg-* two-arg-/ two-arg-< two-arg-> two-arg-=
218 two-arg-<= two-arg->= two-arg-/= eql %negate
219 two-arg-and two-arg-ior two-arg-xor two-arg-eqv
220 two-arg-gcd two-arg-lcm
223 ;;;; Assembler parameters:
225 ;;; The number of bits per element in the assemblers code vector.
226 (defparameter *assembly-unit-length* 8)
229 ;;;; Pseudo-atomic trap number
231 ;;; KLUDGE: Linux on the SPARC doesn't seem to conform to any kind of
232 ;;; standards at all. So we use an explicitly undefined trap, because
233 ;;; that currently does the right thing. Expect this to break
234 ;;; eventually (but with luck, at that point we'll be able to revert
235 ;;; to the compliant trap number...
237 ;;; KLUDGE: Maybe this should be called pseudo-atomic-magic-number,
238 ;;; allowing other architectures (which don't necessarily use traps
239 ;;; for pseudo-atomic) to propagate a magic number to C land via
242 (def!constant pseudo-atomic-trap #x10)
244 (def!constant pseudo-atomic-trap #x40)