0.6.12.3:
[sbcl.git] / src / compiler / alpha / parms.lisp
1
2 (in-package "SB!VM")
3
4 (eval-when  (:compile-toplevel :load-toplevel :execute)
5
6 (defconstant word-bits 32
7   #!+sb-doc
8   "Number of bits per word where a word holds one lisp descriptor.")
9
10 (defconstant byte-bits 8
11   #!+sb-doc
12   "Number of bits per byte where a byte is the smallest addressable object.")
13
14 (defconstant word-shift (1- (integer-length (/ word-bits byte-bits)))
15   #!+sb-doc
16   "Number of bits to shift between word addresses and byte addresses.")
17
18 (defconstant word-bytes (/ word-bits byte-bits)
19   #!+sb-doc
20   "Number of bytes in a word.")
21
22 (defconstant float-sign-shift 31)
23
24 (defconstant single-float-bias 126)
25 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
26 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
27 (defconstant single-float-normal-exponent-min 1)
28 (defconstant single-float-normal-exponent-max 254)
29 (defconstant single-float-hidden-bit (ash 1 23))
30 (defconstant single-float-trapping-nan-bit (ash 1 22))
31
32 (defconstant double-float-bias 1022)
33 (defconstant-eqx double-float-exponent-byte (byte 11 20)   #'equalp)
34 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
35 (defconstant double-float-normal-exponent-min 1)
36 (defconstant double-float-normal-exponent-max #x7FE)
37 (defconstant double-float-hidden-bit (ash 1 20))
38 (defconstant double-float-trapping-nan-bit (ash 1 19))
39
40 (defconstant single-float-digits
41   (+ (byte-size single-float-significand-byte) 1))
42
43 (defconstant double-float-digits
44   (+ (byte-size double-float-significand-byte) word-bits 1))
45
46 ;; Values in 17f code seem to be same as HPPA. These values are from
47 ;; DEC Assembly Language Programmers guide. The active bits are
48 ;; actually in (byte 12 52) of the fpcr. (byte 6 52) contain the
49 ;; exception flags. Bit 63 is the bitwise logor of all exceptions.
50 ;; The enable and exception bytes are in a software control word
51 ;; manipulated via OS functions and the bits in the SCP match those
52 ;; defs. This mapping follows <machine/fpu.h>
53 (defconstant float-inexact-trap-bit        (ash 1 4)) ; rw
54 (defconstant float-underflow-trap-bit      (ash 1 3)) ; rw
55 (defconstant float-overflow-trap-bit       (ash 1 2)) ; ro
56 (defconstant float-divide-by-zero-trap-bit (ash 1 1)) ; ro
57 (defconstant float-invalid-trap-bit        (ash 1 0)) ; ro
58
59 (defconstant float-round-to-zero     0)
60 (defconstant float-round-to-negative 1)
61 (defconstant float-round-to-nearest  2)
62 (defconstant float-round-to-positive 3)
63
64 ;; These aren't quite correct yet. Work in progress.
65 (defconstant-eqx float-rounding-mode   (byte 2 58) #'equalp)    ; hardware fpcr
66 (defconstant-eqx float-exceptions-byte (byte 6 52)  #'equalp)   ; hardware fpcr
67 (defconstant-eqx float-sticky-bits     (byte 6 17) #'equalp)    ; software (clear only)
68 (defconstant-eqx float-traps-byte      (byte 6  1) #'equalp)    ; software fp control word
69 (defconstant float-condition-bit   (ash  1 63)) ; summary - not used?? XXX
70 (defconstant float-fast-bit 0)
71
72 ); eval-when
73
74
75 \f
76 ;;;; Description of the target address space.
77
78 ;;; Where to put the different spaces.
79 ;;;
80
81 #!+linux
82 (progn
83   (defconstant read-only-space-start #x20000000)
84   (defconstant read-only-space-end   #x24000000)
85
86   (defconstant static-space-start    #x28000000)
87   (defconstant static-space-end      #x2c000000)
88
89   ;; this is used in purify as part of a sloppy check to see if a pointer
90   ;; is in dynamic space.  Chocolate brownie for the first person to fix it
91   ;; -dan 20010502
92   (defconstant dynamic-space-start   #x30000000)
93   (defconstant dynamic-space-end     #x38000000)
94
95   (defconstant dynamic-0-space-start   #x30000000)
96   (defconstant dynamic-0-space-end     #x38000000)
97   
98   (defconstant dynamic-1-space-start   #x40000000)
99   (defconstant dynamic-1-space-end     #x48000000)
100
101   (defconstant control-stack-start   #x50000000)
102   (defconstant control-stack-end     #x51000000)
103
104   (defconstant binding-stack-start    #x70000000)
105   (defconstant binding-stack-end      #x71000000))
106
107 #!+osf1                                 ;as if
108 (progn
109   (defparameter read-only-space-start #x10000000)
110   (defparameter static-space-start    #x28000000)
111   (defparameter dynamic-space-start   #x30000000))
112
113
114 ;;; FIXME nothing refers to either of these in alpha or x86 cmucl
115 ;;; backend, so they could probably be removed.
116
117 ;; The space-register holding the lisp heap.
118 (defconstant lisp-heap-space 4)
119
120 ;; The space-register holding the C text segment.
121 (defconstant c-text-space 4)
122
123 ;;; the X86 port defines *nil-value* as (+ *target-static-space-start* #xB)
124 ;;; here, but it seems to be the only port that needs to know the
125 ;;; location of NIL from lisp.
126
127
128 \f
129 ;;;; Other random constants.
130
131 (defenum (:suffix -trap :start 8)
132   halt
133   pending-interrupt
134   error
135   cerror
136   breakpoint
137   function-end-breakpoint
138   single-step-breakpoint)
139
140 (defenum (:prefix trace-table-)
141   normal
142   call-site
143   function-prologue
144   function-epilogue)
145
146
147 \f
148 ;;;; Static symbols.
149
150 ;;; These symbols are loaded into static space directly after NIL so
151 ;;; that the system can compute their address by adding a constant
152 ;;; amount to NIL.
153 ;;;
154 ;;; The fdefn objects for the static functions are loaded into static
155 ;;; space directly after the static symbols.  That way, the raw-addr
156 ;;; can be loaded directly out of them by indirecting relative to NIL.
157 ;;;
158 (defparameter *static-symbols*
159   '(t
160
161     ;; The C startup code must fill these in.
162     *posix-argv*
163     ;;lisp::lisp-environment-list
164     ;;lisp::lisp-command-line-list
165     sb!impl::*!initial-fdefn-objects*
166
167     ;; Functions that the C code needs to call
168     sb!impl::%initial-function
169     sb!impl::maybe-gc
170     sb!kernel::internal-error
171     sb!di::handle-breakpoint
172     sb!di::handle-function-end-breakpoint
173     sb!impl::fdefinition-object
174
175     ;; Free Pointers.
176     *read-only-space-free-pointer*
177     *static-space-free-pointer*
178     *initial-dynamic-space-free-pointer*
179
180     ;; Things needed for non-local-exit.
181     sb!impl::*current-catch-block*
182     sb!impl::*current-unwind-protect-block*
183     sb!c::*eval-stack-top*
184
185     ;; Interrupt Handling
186     sb!impl::*free-interrupt-context-index*
187     sb!unix::*interrupts-enabled*
188     sb!unix::*interrupt-pending*
189     ))
190
191 (defparameter *static-functions*
192   '(length
193     sb!kernel:two-arg-+
194     sb!kernel:two-arg--
195     sb!kernel:two-arg-*
196     sb!kernel:two-arg-/
197     sb!kernel:two-arg-<
198     sb!kernel:two-arg->
199     sb!kernel:two-arg-=
200     ;; Probably need the following as they are defined in arith.lisp
201     ;; two-arg-<= two-arg->= two-arg-/= 
202     eql
203     sb!kernel:%negate
204     sb!kernel:two-arg-and
205     sb!kernel:two-arg-ior
206     sb!kernel:two-arg-xor
207     sb!kernel:two-arg-gcd
208     sb!kernel:two-arg-lcm))