0.9.5.22:
[sbcl.git] / src / compiler / mips / 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 \f
12 ;;;; Machine Architecture parameters:
13 (eval-when (:compile-toplevel :load-toplevel :execute)
14
15 ;;; number of bits per word where a word holds one lisp descriptor
16 (def!constant n-word-bits 32)
17
18 ;;; the natural width of a machine word (as seen in e.g. register width,
19 ;;; address space)
20 (def!constant n-machine-word-bits 32)
21
22 ;;; number of bits per byte where a byte is the smallest addressable
23 ;;; object
24 (def!constant n-byte-bits 8)
25
26 (def!constant float-sign-shift 31)
27
28 (def!constant single-float-bias 126)
29 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
30 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
31 (def!constant single-float-normal-exponent-min 1)
32 (def!constant single-float-normal-exponent-max 254)
33 (def!constant single-float-hidden-bit (ash 1 23))
34 (def!constant single-float-trapping-nan-bit (ash 1 22))
35
36 (def!constant double-float-bias 1022)
37 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
38 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
39 (def!constant double-float-normal-exponent-min 1)
40 (def!constant double-float-normal-exponent-max #x7FE)
41 (def!constant double-float-hidden-bit (ash 1 20))
42 (def!constant double-float-trapping-nan-bit (ash 1 19))
43
44 (def!constant single-float-digits
45   (+ (byte-size single-float-significand-byte) 1))
46
47 (def!constant double-float-digits
48   (+ (byte-size double-float-significand-byte) n-word-bits 1))
49
50 (def!constant float-inexact-trap-bit (ash 1 0))
51 (def!constant float-underflow-trap-bit (ash 1 1))
52 (def!constant float-overflow-trap-bit (ash 1 2))
53 (def!constant float-divide-by-zero-trap-bit (ash 1 3))
54 (def!constant float-invalid-trap-bit (ash 1 4))
55
56 (def!constant float-round-to-nearest 0)
57 (def!constant float-round-to-zero 1)
58 (def!constant float-round-to-positive 2)
59 (def!constant float-round-to-negative 3)
60
61 (defconstant-eqx float-rounding-mode (byte 2 0) #'equalp)
62 (defconstant-eqx float-sticky-bits (byte 5 2) #'equalp)
63 (defconstant-eqx float-traps-byte (byte 5 7) #'equalp)
64 (defconstant-eqx float-exceptions-byte (byte 5 12) #'equalp)
65 (defconstant-eqx float-condition-bit (ash 1 23) #'equalp)
66 (def!constant float-fast-bit (ash 1 24))
67 ;(def!constant float-fast-bit 0)
68
69 ;;;; Description of the target address space.
70
71 #!+irix
72 (progn
73   ;; Where to put the different spaces.
74   ;; Old definitions, might be still relevant for an IRIX port.
75   ;;
76   (def!constant read-only-space-start #x01000000)
77   (def!constant read-only-space-end   #x05000000)
78
79   (def!constant static-space-start    #x06000000)
80   (def!constant static-space-end      #x08000000)
81
82   (def!constant dynamic-0-space-start #x08000000)
83   (def!constant dynamic-0-space-end   #x0c000000)
84   (def!constant dynamic-1-space-start #x0c000000)
85   (def!constant dynamic-1-space-end   #x10000000))
86
87 #!+linux
88 (progn
89   ;; Where to put the address spaces on Linux.
90   ;;
91   ;; C runtime executable segment starts at 0x00400000
92   (def!constant read-only-space-start #x01000000)
93   (def!constant read-only-space-end   #x08000000)
94
95   (def!constant static-space-start    #x08000000)
96   (def!constant static-space-end      #x10000000)
97   ;; C runtime read/write segment starts at 0x10000000, heap and DSOs
98   ;; start at 0x2a000000
99   (def!constant dynamic-0-space-start #x30000000)
100   (def!constant dynamic-0-space-end   #x50000000)
101   (def!constant dynamic-1-space-start #x50000000)
102   (def!constant dynamic-1-space-end   #x70000000)
103
104   (def!constant linkage-table-space-start #x70000000)
105   (def!constant linkage-table-space-end   #x71000000)
106   (def!constant linkage-table-entry-size 16)
107
108   ;; C stack grows downward from 0x80000000
109   )
110
111 ); eval-when
112
113 \f
114 ;;;; Other non-type constants.
115
116 (defenum (:suffix -flag)
117   atomic
118   interrupted)
119
120 (defenum (:suffix -trap :start 8)
121   halt
122   pending-interrupt
123   error
124   cerror
125   breakpoint
126   fun-end-breakpoint
127   after-breakpoint
128   unused
129   pseudo-atomic
130   object-not-list
131   object-not-instance)
132
133 (defenum (:prefix trace-table-)
134   normal
135   call-site
136   fun-prologue
137   fun-epilogue)
138 \f
139 ;;;; Static symbols.
140
141 ;;; Static symbols are loaded into static space directly after NIL so
142 ;;; that the system can compute their address by adding a constant
143 ;;; amount to NIL.
144 ;;;
145 ;;; The fdefn objects for the static functions are loaded into static
146 ;;; space directly after the static symbols.  That way, the raw-addr
147 ;;; can be loaded directly out of them by indirecting relative to NIL.
148 ;;;
149 (defparameter *static-symbols*
150   '(t
151
152     *posix-argv*
153
154     sb!impl::sub-gc
155     sb!kernel::internal-error
156     sb!kernel::control-stack-exhausted-error
157     sb!kernel::undefined-alien-variable-error
158     sb!kernel::undefined-alien-function-error
159     sb!di::handle-breakpoint
160     sb!impl::fdefinition-object
161
162     ;; Free Pointers
163     *read-only-space-free-pointer*
164     *static-space-free-pointer*
165     *initial-dynamic-space-free-pointer*
166
167     ;; Things needed for non-local-exit.
168     *current-catch-block*
169     *current-unwind-protect-block*
170
171     *binding-stack-start*
172     *control-stack-start*
173     *control-stack-end*
174
175     ;; Interrupt Handling
176     *free-interrupt-context-index*
177     sb!unix::*interrupts-enabled*
178     sb!unix::*interrupt-pending*
179     *gc-inhibit*
180     *gc-pending*))
181
182 (defparameter *static-funs*
183   '(sb!kernel:two-arg-+
184     sb!kernel:two-arg--
185     sb!kernel:two-arg-*
186     sb!kernel:two-arg-/
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     eql
194     sb!kernel:%negate
195     sb!kernel:two-arg-and
196     sb!kernel:two-arg-ior
197     sb!kernel:two-arg-xor
198     length
199     sb!kernel:two-arg-gcd
200     sb!kernel:two-arg-lcm))