0.9.9.22:
[sbcl.git] / src / compiler / ppc / parms.lisp
1 ;;;; This file contains some parameterizations of various VM
2 ;;;; attributes for the PPC.  This file is separate from other stuff so
3 ;;;; that it can be compiled and loaded earlier.
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
13
14 (in-package "SB!VM")
15
16 ;;; number of bits per word where a word holds one lisp descriptor
17 (def!constant n-word-bits 32)
18
19 ;;; the natural width of a machine word (as seen in e.g. register width,
20 ;;; address space)
21 (def!constant n-machine-word-bits 32)
22
23 ;;; number of bits per byte where a byte is the smallest addressable
24 ;;; object
25 (def!constant n-byte-bits 8)
26
27
28 (def!constant float-sign-shift 31)
29
30 (def!constant single-float-bias 126)
31 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
32 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
33 (def!constant single-float-normal-exponent-min 1)
34 (def!constant single-float-normal-exponent-max 254)
35 (def!constant single-float-hidden-bit (ash 1 23))
36 (def!constant single-float-trapping-nan-bit (ash 1 22))
37
38 (def!constant double-float-bias 1022)
39 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
40 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
41 (def!constant double-float-normal-exponent-min 1)
42 (def!constant double-float-normal-exponent-max #x7FE)
43 (def!constant double-float-hidden-bit (ash 1 20))
44 (def!constant double-float-trapping-nan-bit (ash 1 19))
45
46 (def!constant single-float-digits
47   (+ (byte-size single-float-significand-byte) 1))
48
49 (def!constant double-float-digits
50   (+ (byte-size double-float-significand-byte) n-word-bits 1))
51
52
53 (def!constant float-inexact-trap-bit (ash 1 0))
54 (def!constant float-divide-by-zero-trap-bit (ash 1 1))
55 (def!constant float-underflow-trap-bit (ash 1 2))
56 (def!constant float-overflow-trap-bit (ash 1 3))
57 (def!constant float-invalid-trap-bit (ash 1 4))
58
59 (def!constant float-round-to-nearest 0)
60 (def!constant float-round-to-zero 1)
61 (def!constant float-round-to-positive 2)
62 (def!constant float-round-to-negative 3)
63
64 (defconstant-eqx float-rounding-mode (byte 2 0) #'equalp)         ; RD
65 ;;; FIXME I: Beware, all ye who trespass here. Despite its name,
66 ;;; FLOAT-STICKY-BITS is not the byte specifier for sticky bits in the
67 ;;; floating point control word. It is more like "accrued exceptions"
68 ;;; where FLOAT-EXCEPTIONS-BYTE is "current exceptions". Consequently,
69 ;;; on architectures where there is no "current exceptions"
70 ;;; FLOAT-EXCEPTIONS-BYTE and FLOAT-STICKY-BITS had better be the
71 ;;; same.
72 ;;;
73 ;;; FIXME II: So, I've now documented this in comments in the PowerPC
74 ;;; tree. This may not make it easy to find for when new architectures
75 ;;; get backends written...
76 ;;;
77 ;;; CSR, 2002-06-11
78 (defconstant-eqx float-sticky-bits (byte 5 25) #'equalp)
79 (defconstant-eqx float-traps-byte (byte 5 3) #'equalp)
80 (defconstant-eqx float-exceptions-byte (byte 5 25) #'equalp)      ; cexc
81
82 (def!constant float-fast-bit 2)         ; Non-IEEE mode
83
84 \f
85 ;;; Where to put the different spaces.
86
87 (def!constant read-only-space-start #x01000000)
88 (def!constant read-only-space-end   #x04ff8000)
89
90 (def!constant static-space-start    #x08000000)
91 (def!constant static-space-end      #x097fff00)
92
93 #!+linux
94 (progn
95   (def!constant dynamic-0-space-start #x20000000)
96   (def!constant dynamic-0-space-end   #x3ffff000)
97   (def!constant dynamic-1-space-start #x50000000)
98   (def!constant dynamic-1-space-end   #x6ffff000)
99
100   (def!constant linkage-table-space-start #x0a000000)
101   (def!constant linkage-table-space-end   #x0b000000)
102   (def!constant linkage-table-entry-size 16))
103
104 #!+darwin
105 (progn
106   ;;; nothing _seems_ to be using these addresses
107   (def!constant dynamic-0-space-start #x10000000)
108   (def!constant dynamic-0-space-end   #x3ffff000)
109   (def!constant dynamic-1-space-start #x40000000)
110   (def!constant dynamic-1-space-end   #x6ffff000)
111
112   (def!constant linkage-table-space-start #x0a000000)
113   (def!constant linkage-table-space-end   #x0b000000)
114   (def!constant linkage-table-entry-size 16))
115 \f
116 ;;;; Other miscellaneous constants.
117
118 (defenum (:suffix -trap :start 8)
119   halt
120   pending-interrupt
121   error
122   cerror
123   breakpoint
124   fun-end-breakpoint
125   after-breakpoint
126   fixnum-additive-overflow)
127
128 (defenum (:prefix object-not- :suffix -trap :start 16)
129   list
130   instance)
131
132 (defenum (:prefix trace-table-)
133   normal
134   call-site
135   fun-prologue
136   fun-epilogue)
137
138 \f
139 ;;;; Static symbols.
140
141
142 ;;; These symbols are loaded into static space directly after NIL so
143 ;;; that the system can compute their address by adding a constant
144 ;;; amount to NIL.
145 ;;;
146 ;;; The fdefn objects for the static functions are loaded into static
147 ;;; space directly after the static symbols.  That way, the raw-addr
148 ;;; can be loaded directly out of them by indirecting relative to NIL.
149 ;;;
150 (defparameter *static-symbols*
151   '(t
152
153     ;; The C startup code must fill these in.
154     *posix-argv*
155
156     ;; functions that the C code needs to call
157     sb!impl::sub-gc
158     sb!kernel::internal-error
159     sb!kernel::control-stack-exhausted-error
160     sb!kernel::undefined-alien-variable-error
161     sb!kernel::undefined-alien-function-error
162     sb!di::handle-breakpoint
163     sb!impl::fdefinition-object
164
165     ;; free pointers
166     *read-only-space-free-pointer*
167     *static-space-free-pointer*
168     *initial-dynamic-space-free-pointer*
169
170     ;; things needed for non-local exit
171     *current-catch-block*
172     *current-unwind-protect-block*
173
174     *binding-stack-start*
175     *control-stack-start*
176     *control-stack-end*
177
178     ;; interrupt handling
179     *free-interrupt-context-index*
180     sb!unix::*interrupts-enabled*
181     sb!unix::*interrupt-pending*
182     *gc-inhibit*
183     *gc-pending*))
184
185 (defparameter *static-funs*
186   '(length
187     sb!kernel:two-arg-+
188     sb!kernel:two-arg--
189     sb!kernel:two-arg-*
190     sb!kernel:two-arg-/
191     sb!kernel:two-arg-<
192     sb!kernel:two-arg->
193     sb!kernel:two-arg-=
194     sb!kernel:two-arg-<=
195     sb!kernel:two-arg->=
196     sb!kernel:two-arg-/=
197     eql
198     sb!kernel:%negate
199     sb!kernel:two-arg-and
200     sb!kernel:two-arg-ior
201     sb!kernel:two-arg-xor
202     sb!kernel:two-arg-eqv
203     sb!kernel:two-arg-gcd
204     sb!kernel:two-arg-lcm))
205
206 \f
207 ;;;; Assembler parameters:
208
209 ;;; The number of bits per element in the assemblers code vector.
210 ;;;
211 (defparameter *assembly-unit-length* 8)