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 ;;; FIXME: The following three should probably be rationalized or at
32 ;;; least prefixed with n- where applicable
33 (defconstant fixnum-tag-bits (1- n-lowtag-bits)
35 "Number of tag bits used for a fixnum")
37 (defconstant fixnum-tag-mask (1- (ash 1 fixnum-tag-bits))
39 "Mask to get the fixnum tag")
41 (defconstant positive-fixnum-bits (- n-word-bits fixnum-tag-bits 1)
43 "Maximum number of bits in a positive fixnum")
45 (defconstant float-sign-shift 31)
47 (defconstant single-float-bias 126)
48 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
49 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
50 (defconstant single-float-normal-exponent-min 1)
51 (defconstant single-float-normal-exponent-max 254)
52 (defconstant single-float-hidden-bit (ash 1 23))
53 (defconstant single-float-trapping-nan-bit (ash 1 22))
55 (defconstant double-float-bias 1022)
56 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
57 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
58 (defconstant double-float-normal-exponent-min 1)
59 (defconstant double-float-normal-exponent-max #x7FE)
60 (defconstant double-float-hidden-bit (ash 1 20))
61 (defconstant double-float-trapping-nan-bit (ash 1 19))
64 ;;; X These values are for the x86 80 bit format and are no doubt
65 ;;; incorrect for the sparc.
67 (defconstant long-float-bias 16382)
68 (defconstant-eqx long-float-exponent-byte (byte 15 0) #'equalp)
69 (defconstant-eqx long-float-significand-byte (byte 31 0) #'equalp)
70 (defconstant long-float-normal-exponent-min 1)
71 (defconstant long-float-normal-exponent-max #x7FFE)
72 (defconstant long-float-hidden-bit (ash 1 31))
73 (defconstant long-float-trapping-nan-bit (ash 1 30))
75 (defconstant single-float-digits
76 (+ (byte-size single-float-significand-byte) 1))
78 (defconstant double-float-digits
79 (+ (byte-size double-float-significand-byte) n-word-bits 1))
81 ;;; This looks wrong - CSR
82 (defconstant long-float-digits
83 (+ (byte-size long-float-significand-byte) n-word-bits 1))
85 (defconstant float-inexact-trap-bit (ash 1 0))
86 (defconstant float-divide-by-zero-trap-bit (ash 1 1))
87 (defconstant float-underflow-trap-bit (ash 1 2))
88 (defconstant float-overflow-trap-bit (ash 1 3))
89 (defconstant float-invalid-trap-bit (ash 1 4))
91 (defconstant float-round-to-nearest 0)
92 (defconstant float-round-to-zero 1)
93 (defconstant float-round-to-positive 2)
94 (defconstant float-round-to-negative 3)
96 (defconstant-eqx float-rounding-mode (byte 2 30) #'equalp) ; RD
97 (defconstant-eqx float-sticky-bits (byte 5 5) #'equalp) ; aexc
98 (defconstant-eqx float-traps-byte (byte 5 23) #'equalp) ; TEM
99 (defconstant-eqx float-exceptions-byte (byte 5 0) #'equalp) ; cexc
101 ;;; According to the SPARC doc (as opposed to FPU doc), the fast mode
102 ;;; bit (EFM) is "reserved", and should always be zero. However, for
103 ;;; sparc-V8 and sparc-V9, it appears to work, causing denormals to
104 ;;; be truncated to 0 silently.
105 (defconstant float-fast-bit (ash 1 22))
109 ;;; NUMBER-STACK-DISPLACEMENT
111 ;;; The number of bytes reserved above the number stack pointer. These
112 ;;; slots are required by architecture for a place to spill register windows.
114 ;;; FIXME: Where is this used?
115 (defconstant number-stack-displacement
119 ;;;; Description of the target address space.
121 ;;; Where to put the different spaces. Must match the C code!
124 (defconstant read-only-space-start #x10000000)
125 (defconstant read-only-space-end #x15000000)
127 (defconstant static-space-start #x28000000)
128 (defconstant static-space-end #x2c000000)
130 ;; From alpha/parms.lisp:
131 ;; this is used in PURIFY as part of a sloppy check to see if a pointer
132 ;; is in dynamic space. Chocolate brownie for the first person to fix it
134 (defconstant dynamic-space-start #x30000000)
135 (defconstant dynamic-space-end #x38000000)
137 (defconstant dynamic-0-space-start #x30000000)
138 (defconstant dynamic-0-space-end #x38000000)
140 (defconstant dynamic-1-space-start #x40000000)
141 (defconstant dynamic-1-space-end #x48000000)
143 (defconstant control-stack-start #x50000000)
144 (defconstant control-stack-end #x51000000)
146 (defconstant binding-stack-start #x60000000)
147 (defconstant binding-stack-end #x61000000))
149 #!+solaris ; maybe someday.
151 (defparameter target-read-only-space-start #x10000000)
152 (defparameter target-static-space-start #x28000000)
153 (defparameter target-dynamic-space-start #x40000000))
155 ;;;; other random constants.
157 (defenum (:suffix -trap :start 8)
166 (defenum (:prefix object-not- :suffix -trap :start 16)
170 (defenum (:prefix trace-table-)
178 ;;; These symbols are loaded into static space directly after NIL so
179 ;;; that the system can compute their address by adding a constant
182 ;;; The fdefn objects for the static functions are loaded into static
183 ;;; space directly after the static symbols. That way, the raw-addr
184 ;;; can be loaded directly out of them by indirecting relative to NIL.
186 (defparameter *static-symbols*
189 ;; The C startup code must fill these in.
191 ;;lisp::lisp-environment-list
192 ;;lisp::lisp-command-line-list
193 sb!impl::*!initial-fdefn-objects*
195 ;; Functions that the C code needs to call
197 sb!kernel::internal-error
198 sb!di::handle-breakpoint
199 sb!di::handle-fun-end-breakpoint
202 *read-only-space-free-pointer*
203 *static-space-free-pointer*
204 *initial-dynamic-space-free-pointer*
206 ;; Things needed for non-local-exit.
207 *current-catch-block*
208 *current-unwind-protect-block*
210 ;; Interrupt Handling
211 *free-interrupt-context-index*
212 sb!unix::*interrupts-enabled*
213 sb!unix::*interrupt-pending*
216 (defparameter *static-funs*
218 two-arg-+ two-arg-- two-arg-* two-arg-/ two-arg-< two-arg-> two-arg-=
219 two-arg-<= two-arg->= two-arg-/= eql %negate
220 two-arg-and two-arg-ior two-arg-xor
221 two-arg-gcd two-arg-lcm
224 ;;;; Assembler parameters:
226 ;;; The number of bits per element in the assemblers code vector.
228 (defparameter *assembly-unit-length* 8)
231 ;;;; Pseudo-atomic trap number
234 (defconstant pseudo-atomic-trap 16)
236 (defconstant pseudo-atomic-trap #x40)