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