Move definition of N-BYTE-BITS.
[sbcl.git] / src / compiler / arm / parms.lisp
blob71bf98c7d63fb857d50c02fb20df77b5beead8e9
1 ;;;; This file contains some parameterizations of various VM
2 ;;;; attributes for the ARM. This file is separate from other stuff so
3 ;;;; that it can be compiled and loaded earlier.
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.
14 (in-package "SB!VM")
16 ;;; number of bits per word where a word holds one lisp descriptor
17 (defconstant n-word-bits 32)
19 ;;; the natural width of a machine word (as seen in e.g. register width,
20 ;;; address space)
21 (defconstant n-machine-word-bits 32)
23 ;;; Floating-point related constants, both format descriptions and FPU
24 ;;; control register descriptions. These don't exactly match up with
25 ;;; what the machine manuals say because the Common Lisp standard
26 ;;; defines floating-point values somewhat differently than the IEEE
27 ;;; standard does.
29 (defconstant float-sign-shift 31)
31 (defconstant single-float-bias 126)
32 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
33 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
34 (defconstant single-float-normal-exponent-min 1)
35 (defconstant single-float-normal-exponent-max 254)
36 (defconstant single-float-hidden-bit (ash 1 23))
37 (defconstant single-float-trapping-nan-bit (ash 1 22))
39 (defconstant double-float-bias 1022)
40 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
41 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
42 (defconstant double-float-normal-exponent-min 1)
43 (defconstant double-float-normal-exponent-max #x7FE)
44 (defconstant double-float-hidden-bit (ash 1 20))
45 (defconstant double-float-trapping-nan-bit (ash 1 19))
47 (defconstant single-float-digits
48 (+ (byte-size single-float-significand-byte) 1))
50 (defconstant double-float-digits
51 (+ (byte-size double-float-significand-byte) n-word-bits 1))
53 #!+arm-vfp
54 (progn
55 (defconstant float-invalid-trap-bit (ash 1 0))
56 (defconstant float-divide-by-zero-trap-bit (ash 1 1))
57 (defconstant float-overflow-trap-bit (ash 1 2))
58 (defconstant float-underflow-trap-bit (ash 1 3))
59 (defconstant float-inexact-trap-bit (ash 1 4))
60 (defconstant float-input-denormal-trap-bit (ash 1 7))
62 (defconstant float-round-to-nearest 0)
63 (defconstant float-round-to-positive 1)
64 (defconstant float-round-to-negative 2)
65 (defconstant float-round-to-zero 3)
67 (defconstant-eqx float-rounding-mode (byte 2 22) #'equalp)
69 (defconstant-eqx float-sticky-bits (byte 8 0) #'equalp)
70 (defconstant-eqx float-traps-byte (byte 8 8) #'equalp)
71 (defconstant-eqx float-exceptions-byte (byte 8 0) #'equalp)
73 (defconstant float-fast-bit (ash 1 24))) ;; Flush-to-zero mode
74 ;; NOTE: As with the FLOAT-REGISTERS SB in vm.lisp, if you define this
75 ;; for non-VFP systems, please use a specific positive feature
76 ;; conditional.
77 #!-arm-vfp
78 (error "Don't know how to set the FPU control word layout on non-VFP systems")
80 ;;;; Where to put the different spaces.
82 ;;; On non-gencgc we need large dynamic and static spaces for PURIFY
83 #!-gencgc
84 (progn
85 (defconstant read-only-space-start #x04000000)
86 (defconstant read-only-space-end #x07ff8000)
87 (defconstant static-space-start #x08000000)
88 (defconstant static-space-end #x097fff00)
90 (defconstant linkage-table-space-start #x0a000000)
91 (defconstant linkage-table-space-end #x0b000000))
93 #!+gencgc
94 (progn
95 (defconstant linkage-table-space-start #x0a000000)
96 (defconstant linkage-table-space-end #x0b000000)
98 (defconstant read-only-space-start #x04000000)
99 (defconstant read-only-space-end #x07ff8000)
101 (defconstant static-space-start #x08000000)
102 (defconstant static-space-end #x097fff00)
104 (defconstant dynamic-space-start #x4f000000)
105 (defconstant dynamic-space-end (!configure-dynamic-space-end)))
107 (defconstant linkage-table-entry-size 16)
109 #!+(or linux netbsd)
110 (progn
111 #!-gencgc
112 (progn
113 (defconstant dynamic-0-space-start #x4f000000)
114 (defconstant dynamic-0-space-end #x66fff000)
115 (defconstant dynamic-1-space-start #x67000000)
116 (defconstant dynamic-1-space-end #x7efff000)))
118 ;;;; other miscellaneous constants
120 (defenum (:start 8)
121 halt-trap
122 pending-interrupt-trap
123 error-trap
124 cerror-trap
125 breakpoint-trap
126 fun-end-breakpoint-trap
127 single-step-around-trap
128 single-step-before-trap)
130 ;;;; Static symbols.
132 ;;; These symbols are loaded into static space directly after NIL so
133 ;;; that the system can compute their address by adding a constant
134 ;;; amount to NIL.
136 ;;; The fdefn objects for the static functions are loaded into static
137 ;;; space directly after the static symbols. That way, the raw-addr
138 ;;; can be loaded directly out of them by indirecting relative to NIL.
140 (defparameter *static-symbols*
141 (append
142 *common-static-symbols*
143 *c-callable-static-symbols*
144 '(*allocation-pointer*
146 *control-stack-pointer*
147 *binding-stack-pointer*
148 *interrupted-control-stack-pointer*
150 ;; interrupt handling
151 *pseudo-atomic-atomic*
152 *pseudo-atomic-interrupted*
154 ;; Needed for callbacks to work across saving cores. see
155 ;; ALIEN-CALLBACK-ASSEMBLER-WRAPPER in c-call.lisp for gory
156 ;; details.
157 sb!alien::*enter-alien-callback*
158 #!+gencgc *restart-lisp-function*)))
160 (defparameter *static-funs*
161 '(two-arg-gcd two-arg-lcm
162 two-arg-+ two-arg-- two-arg-* two-arg-/
163 two-arg-< two-arg-> two-arg-=
164 two-arg-and two-arg-ior two-arg-xor two-arg-eqv
167 sb!kernel:%negate))
170 ;;;; Assembler parameters:
172 ;;; The number of bits per element in the assemblers code vector.
174 (defparameter *assembly-unit-length* 8)
176 (defvar *allocation-pointer*)