1 | ;;;-*- Mode: Lisp; Package: CCL -*- |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 1994-2001 Digitool, Inc |
---|
4 | ;;; This file is part of OpenMCL. |
---|
5 | ;;; |
---|
6 | ;;; OpenMCL is licensed under the terms of the Lisp Lesser GNU Public |
---|
7 | ;;; License , known as the LLGPL and distributed with OpenMCL as the |
---|
8 | ;;; file "LICENSE". The LLGPL consists of a preamble and the LGPL, |
---|
9 | ;;; which is distributed with OpenMCL as the file "LGPL". Where these |
---|
10 | ;;; conflict, the preamble takes precedence. |
---|
11 | ;;; |
---|
12 | ;;; OpenMCL is referenced in the preamble as the "LIBRARY." |
---|
13 | ;;; |
---|
14 | ;;; The LLGPL is also available online at |
---|
15 | ;;; http://opensource.franz.com/preamble.html |
---|
16 | (in-package "CCL") |
---|
17 | (eval-when (:compile-toplevel :load-toplevel :execute) |
---|
18 | (require "BACKEND")) |
---|
19 | |
---|
20 | (eval-when (:compile-toplevel :execute) |
---|
21 | (require "NXENV") |
---|
22 | (require "PPCENV") |
---|
23 | (require "PPC32-ARCH")) |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | (defvar *ppc32-vinsn-templates* (make-hash-table :test #'eq)) |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | (defvar *known-ppc32-backends* ()) |
---|
35 | |
---|
36 | |
---|
37 | #+linuxppc-target |
---|
38 | (defvar *linuxppc32-backend* |
---|
39 | (make-backend :lookup-opcode #'lookup-ppc-opcode |
---|
40 | :lookup-macro #'ppc::ppc-macro-function |
---|
41 | :lap-opcodes ppc::*ppc-opcodes* |
---|
42 | :define-vinsn 'define-ppc-vinsn |
---|
43 | :platform-syscall-mask (logior platform-os-linux platform-cpu-ppc) |
---|
44 | :p2-dispatch *ppc2-specials* |
---|
45 | :p2-vinsn-templates *ppc32-vinsn-templates* |
---|
46 | :p2-template-hash-name '*ppc32-vinsn-templates* |
---|
47 | :p2-compile 'ppc2-compile |
---|
48 | :target-specific-features |
---|
49 | '(:powerpc :ppc-target :eabi-target :linux-target :linuxppc-target :ppc32-target :32-bit-target :big-endian-target) |
---|
50 | :target-fasl-pathname (make-pathname :type "pfsl") |
---|
51 | :target-platform (logior platform-word-size-32 |
---|
52 | platform-cpu-ppc |
---|
53 | platform-os-linux) |
---|
54 | :target-os :linuxppc |
---|
55 | :name :linuxppc32 |
---|
56 | :target-arch-name :ppc32 |
---|
57 | :target-foreign-type-data nil |
---|
58 | :target-arch ppc32::*ppc32-target-arch*)) |
---|
59 | |
---|
60 | |
---|
61 | #+darwinppc-target |
---|
62 | (defvar *darwinppc32-backend* |
---|
63 | (make-backend :lookup-opcode #'lookup-ppc-opcode |
---|
64 | :lookup-macro #'ppc::ppc-macro-function |
---|
65 | :lap-opcodes ppc::*ppc-opcodes* |
---|
66 | :define-vinsn 'define-ppc-vinsn |
---|
67 | :platform-syscall-mask (logior platform-os-darwin platform-cpu-ppc) |
---|
68 | :p2-dispatch *ppc2-specials* |
---|
69 | :p2-vinsn-templates *ppc32-vinsn-templates* |
---|
70 | :p2-template-hash-name '*ppc32-vinsn-templates* |
---|
71 | :p2-compile 'ppc2-compile |
---|
72 | :target-specific-features |
---|
73 | '(:powerpc :ppc-target :darwin-target :darwinppc-target :ppc32-target :32-bit-target :big-endian-target) |
---|
74 | :target-fasl-pathname (make-pathname :type "dfsl") |
---|
75 | :target-platform (logior platform-word-size-32 |
---|
76 | platform-cpu-ppc |
---|
77 | platform-os-darwin) |
---|
78 | :target-os :darwinppc |
---|
79 | :name :darwinppc32 |
---|
80 | :target-arch-name :ppc32 |
---|
81 | :target-foreign-type-data nil |
---|
82 | :target-arch ppc32::*ppc32-target-arch*)) |
---|
83 | |
---|
84 | #+linuxppc-target |
---|
85 | (pushnew *linuxppc32-backend* *known-ppc32-backends* :key #'backend-name) |
---|
86 | |
---|
87 | |
---|
88 | #+darwinppc-target |
---|
89 | (pushnew *darwinppc32-backend* *known-ppc32-backends* :key #'backend-name) |
---|
90 | |
---|
91 | (defvar *ppc32-backend* (car *known-ppc32-backends*)) |
---|
92 | |
---|
93 | (defun fixup-ppc32-backend () |
---|
94 | (dolist (b *known-ppc32-backends*) |
---|
95 | (setf (backend-lap-opcodes b) ppc::*ppc-opcodes* |
---|
96 | (backend-p2-dispatch b) *ppc2-specials* |
---|
97 | (backend-p2-vinsn-templates b) *ppc32-vinsn-templates*) |
---|
98 | (or (backend-lap-macros b) (setf (backend-lap-macros b) |
---|
99 | (make-hash-table :test #'equalp))))) |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | (fixup-ppc32-backend) |
---|
104 | |
---|
105 | #+ppc32-target |
---|
106 | (setq *host-backend* *ppc32-backend* *target-backend* *ppc32-backend*) |
---|
107 | #-ppc32-target |
---|
108 | (unless (backend-target-foreign-type-data *ppc32-backend*) |
---|
109 | (let* ((ftd (make-ftd |
---|
110 | :interface-db-directory |
---|
111 | #+darwinppc-target "ccl:darwin-headers;" |
---|
112 | #+linuxppc-target "ccl:headers;" |
---|
113 | :interface-package-name |
---|
114 | #+darwinppc-target "DARWIN32" |
---|
115 | #+linuxppc-target "LINUX32" |
---|
116 | :attributes |
---|
117 | #+darwinppc-target |
---|
118 | '(:signed-char t |
---|
119 | :struct-by-value t |
---|
120 | :prepend-underscores t |
---|
121 | :bits-per-word 32 |
---|
122 | :poweropen-alignment t) |
---|
123 | #+linuxppc-target |
---|
124 | '(:bits-per-word 32) |
---|
125 | :ff-call-expand-function |
---|
126 | #+linuxppc-target |
---|
127 | 'linux32::expand-ff-call |
---|
128 | #+darwinppc-target |
---|
129 | 'darwin32::expand-ff-call |
---|
130 | :ff-call-struct-return-by-implicit-arg-function |
---|
131 | #+linuxppc-target |
---|
132 | linux32::record-type-returns-structure-as-first-arg |
---|
133 | #+darwinppc-target |
---|
134 | darwin32::record-type-returns-structure-as-first-arg |
---|
135 | :callback-bindings-function |
---|
136 | #+linuxppc-target |
---|
137 | linux32::generate-callback-bindings |
---|
138 | #+darwinppc-target |
---|
139 | darwin32::generate-callback-bindings |
---|
140 | :callback-return-value-function |
---|
141 | #+linuxppc-target |
---|
142 | linux32::generate-callback-return-value |
---|
143 | #+darwinppc-target |
---|
144 | darwin32::generate-callback-return-value |
---|
145 | ))) |
---|
146 | (install-standard-foreign-types ftd) |
---|
147 | (use-interface-dir :libc ftd) |
---|
148 | (setf (backend-target-foreign-type-data *ppc32-backend*) ftd))) |
---|
149 | |
---|
150 | (pushnew *ppc32-backend* *known-backends* :key #'backend-name) |
---|
151 | |
---|
152 | #+ppc32-target |
---|
153 | (require "PPC32-VINSNS") |
---|
154 | (provide "PPC32-BACKEND") |
---|