1 | ;;;-*- Mode: Lisp; Package: CCL -*- |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 1994-2001 Digitool, Inc |
---|
4 | ;;; Portions copyright (C) 2001-2009 Clozure Associates |
---|
5 | ;;; This file is part of Clozure CL. |
---|
6 | ;;; |
---|
7 | ;;; Clozure CL is licensed under the terms of the Lisp Lesser GNU Public |
---|
8 | ;;; License , known as the LLGPL and distributed with Clozure CL as the |
---|
9 | ;;; file "LICENSE". The LLGPL consists of a preamble and the LGPL, |
---|
10 | ;;; which is distributed with Clozure CL as the file "LGPL". Where these |
---|
11 | ;;; conflict, the preamble takes precedence. |
---|
12 | ;;; |
---|
13 | ;;; Clozure CL is referenced in the preamble as the "LIBRARY." |
---|
14 | ;;; |
---|
15 | ;;; The LLGPL is also available online at |
---|
16 | ;;; http://opensource.franz.com/preamble.html |
---|
17 | |
---|
18 | (in-package "CCL") |
---|
19 | |
---|
20 | (eval-when (:compile-toplevel :execute) |
---|
21 | (require "FASLENV" "ccl:xdump;faslenv") |
---|
22 | (require "X86-LAP")) |
---|
23 | |
---|
24 | (eval-when (:compile-toplevel :load-toplevel :execute) |
---|
25 | (require "XFASLOAD" "ccl:xdump;xfasload")) |
---|
26 | |
---|
27 | (defun xload-x8664-lap-code (instructions) |
---|
28 | (let* ((f (%define-x86-lap-function nil instructions))) |
---|
29 | (if (= (typecode f) target::subtag-xfunction) |
---|
30 | (uvref f 0) |
---|
31 | f))) |
---|
32 | |
---|
33 | (defparameter *x8664-macro-apply-code* |
---|
34 | #xc9cd0000000000) |
---|
35 | |
---|
36 | |
---|
37 | (defun x8664-fixup-macro-apply-code () |
---|
38 | *x8664-macro-apply-code*) |
---|
39 | |
---|
40 | |
---|
41 | (defparameter *x8664-closure-trampoline-code* |
---|
42 | (xload-x8664-lap-code '((jmp-subprim .SPcall-closure)))) |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | ;;; For now, do this with a UUO so that the kernel can catch it. |
---|
47 | (defparameter *x8664-udf-code* |
---|
48 | #xc7cd0000000000) |
---|
49 | |
---|
50 | |
---|
51 | (defun x8664-initialize-static-space () |
---|
52 | (xload-make-ivector *xload-static-space* |
---|
53 | (xload-target-subtype :unsigned-64-bit-vector) |
---|
54 | (1- (/ 4096 8))) |
---|
55 | (xload-make-cons *xload-target-nil* 0 *xload-static-space*) |
---|
56 | (xload-make-cons 0 *xload-target-nil* *xload-static-space*)) |
---|
57 | |
---|
58 | |
---|
59 | (defparameter *x8664-linux-xload-backend* |
---|
60 | (make-backend-xload-info |
---|
61 | :name :linuxx8664 |
---|
62 | :macro-apply-code-function 'x8664-fixup-macro-apply-code |
---|
63 | :closure-trampoline-code *x8664-closure-trampoline-code* |
---|
64 | :udf-code *x8664-udf-code* |
---|
65 | :default-image-name "ccl:ccl;x86-boot64" |
---|
66 | :default-startup-file-name "level-1.lx64fsl" |
---|
67 | :subdirs '("ccl:level-0;X86;X8664;" "ccl:level-0;X86;") |
---|
68 | :compiler-target-name :linuxx8664 |
---|
69 | :image-base-address #x300000000000 |
---|
70 | :nil-relative-symbols x86::*x86-nil-relative-symbols* |
---|
71 | :static-space-init-function 'x8664-initialize-static-space |
---|
72 | :purespace-reserve (ash 1 30) |
---|
73 | :static-space-address (+ (ash 1 16) (ash 2 12)) |
---|
74 | )) |
---|
75 | |
---|
76 | |
---|
77 | (add-xload-backend *x8664-linux-xload-backend*) |
---|
78 | |
---|
79 | |
---|
80 | (defparameter *x8664-freebsd-xload-backend* |
---|
81 | (make-backend-xload-info |
---|
82 | :name :freebsdx8664 |
---|
83 | :macro-apply-code-function 'x8664-fixup-macro-apply-code |
---|
84 | :closure-trampoline-code *x8664-closure-trampoline-code* |
---|
85 | :udf-code *x8664-udf-code* |
---|
86 | :default-image-name "ccl:ccl;fx86-boot64" |
---|
87 | :default-startup-file-name "level-1.fx64fsl" |
---|
88 | :subdirs '("ccl:level-0;X86;X8664;" "ccl:level-0;X86;") |
---|
89 | :compiler-target-name :freebsdx8664 |
---|
90 | :image-base-address #x300000000000 |
---|
91 | :nil-relative-symbols x86::*x86-nil-relative-symbols* |
---|
92 | :static-space-init-function 'x8664-initialize-static-space |
---|
93 | :purespace-reserve (ash 1 30) |
---|
94 | :static-space-address (+ (ash 1 16) (ash 2 12)) |
---|
95 | )) |
---|
96 | |
---|
97 | (add-xload-backend *x8664-freebsd-xload-backend*) |
---|
98 | |
---|
99 | (defparameter *x8664-darwin-xload-backend* |
---|
100 | (make-backend-xload-info |
---|
101 | :name :darwinx8664 |
---|
102 | :macro-apply-code-function 'x8664-fixup-macro-apply-code |
---|
103 | :closure-trampoline-code *x8664-closure-trampoline-code* |
---|
104 | :udf-code *x8664-udf-code* |
---|
105 | :default-image-name "ccl:ccl;x86-boot64.image" |
---|
106 | :default-startup-file-name "level-1.dx64fsl" |
---|
107 | :subdirs '("ccl:level-0;X86;X8664;" "ccl:level-0;X86;") |
---|
108 | :compiler-target-name :darwinx8664 |
---|
109 | :image-base-address #x300000000000 |
---|
110 | :nil-relative-symbols x86::*x86-nil-relative-symbols* |
---|
111 | :static-space-init-function 'x8664-initialize-static-space |
---|
112 | :purespace-reserve (ash 1 30) |
---|
113 | :static-space-address (+ (ash 1 16) (ash 2 12)) |
---|
114 | )) |
---|
115 | |
---|
116 | (add-xload-backend *x8664-darwin-xload-backend*) |
---|
117 | |
---|
118 | (defparameter *x8664-solaris-xload-backend* |
---|
119 | (make-backend-xload-info |
---|
120 | :name :solarisx8664 |
---|
121 | :macro-apply-code-function 'x8664-fixup-macro-apply-code |
---|
122 | :closure-trampoline-code *x8664-closure-trampoline-code* |
---|
123 | :udf-code *x8664-udf-code* |
---|
124 | :default-image-name "ccl:ccl;sx86-boot64" |
---|
125 | :default-startup-file-name "level-1.sx64fsl" |
---|
126 | :subdirs '("ccl:level-0;X86;X8664;" "ccl:level-0;X86;") |
---|
127 | :compiler-target-name :solarisx8664 |
---|
128 | :image-base-address #x300000000000 |
---|
129 | :nil-relative-symbols x86::*x86-nil-relative-symbols* |
---|
130 | :static-space-init-function 'x8664-initialize-static-space |
---|
131 | :purespace-reserve (ash 1 30) |
---|
132 | :static-space-address (+ (ash 1 16) (ash 2 12)) |
---|
133 | )) |
---|
134 | |
---|
135 | (add-xload-backend *x8664-solaris-xload-backend*) |
---|
136 | |
---|
137 | (defparameter *x8664-windows-xload-backend* |
---|
138 | (make-backend-xload-info |
---|
139 | :name :win64 |
---|
140 | :macro-apply-code-function 'x8664-fixup-macro-apply-code |
---|
141 | :closure-trampoline-code *x8664-closure-trampoline-code* |
---|
142 | :udf-code *x8664-udf-code* |
---|
143 | :default-image-name "ccl:ccl;wx86-boot64.image" |
---|
144 | :default-startup-file-name "level-1.wx64fsl" |
---|
145 | :subdirs '("ccl:level-0;X86;X8664;" "ccl:level-0;X86;") |
---|
146 | :compiler-target-name :win64 |
---|
147 | :image-base-address #x100000000 |
---|
148 | :nil-relative-symbols x86::*x86-nil-relative-symbols* |
---|
149 | :static-space-init-function 'x8664-initialize-static-space |
---|
150 | :purespace-reserve (ash 1 30) |
---|
151 | :static-space-address (+ (ash 1 16) (ash 2 12)) |
---|
152 | )) |
---|
153 | |
---|
154 | (add-xload-backend *x8664-windows-xload-backend*) |
---|
155 | |
---|
156 | #+x8664-target |
---|
157 | (progn |
---|
158 | #+linux-target |
---|
159 | (setq *xload-default-backend* *x8664-linux-xload-backend*) |
---|
160 | #+freebsd-target |
---|
161 | (setq *xload-default-backend* *x8664-freebsd-xload-backend*) |
---|
162 | #+darwin-target |
---|
163 | (setq *xload-default-backend* *x8664-darwin-xload-backend*) |
---|
164 | #+solaris-target |
---|
165 | (setq *xload-default-backend* *x8664-solaris-xload-backend*) |
---|
166 | #+windows-target |
---|
167 | (setq *xload-default-backend* *x8664-windows-xload-backend*)) |
---|
168 | |
---|
169 | |
---|
170 | |
---|
171 | |
---|