Changeset 5792
- Timestamp:
- Jan 25, 2007, 3:32:10 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lib/ffi-linuxppc32.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lib/ffi-linuxppc32.lisp
r5790 r5792 103 103 (setq argvars (cons struct-result-name argvars) 104 104 argspecs (cons :address argspecs) 105 rtype *void-foreign-type ))))105 rtype *void-foreign-type*)))) 106 106 (let* ((offset 96) 107 107 (gpr 0) … … 110 110 (argspecs argspecs (cdr argspecs))) 111 111 ((null argvars) 112 (values (rlets) (lets) (dynamic-extent-names) (inits)rtype))112 (values (rlets) (lets) (dynamic-extent-names) nil rtype)) 113 113 (let* ((name (car argvars)) 114 114 (spec (car argspecs)) … … 120 120 (argtype (parse-foreign-type spec))) 121 121 (if (typep argtype 'foreign-record-type) 122 (setq spec :address))122 (setq argtype (parse-foreign-type :address))) 123 123 (let* ((access-form 124 `(,(case spec 125 (:single-float 126 (incf nextfpr 8) 127 (if (< fpr 96) 128 (setq target fpr) 129 (setq target (+ offset (logand offset 4)) 130 nextoffset (+ target 8))) 131 '%get-single-float-from-double-ptr) 132 (:double-float 133 (incf nextfpr 8) 134 (if (< fpr 96) 135 (setq target fpr) 136 (setq target (+ offset (logand offset 4)) 137 nextoffset (+ target 8))) 138 '%get-double-float) 139 (:signed-doubleword 140 (if (< gpr 56) 124 `(,(cond 125 ((typep argtype 'foreign-single-float-type) 126 (incf nextfpr 8) 127 (if (< fpr 96) 128 (setq target fpr) 129 (setq target (+ offset (logand offset 4)) 130 nextoffset (+ target 8))) 131 '%get-single-float-from-double-ptr) 132 ((typep argtype 'foreign-double-float-type) 133 (incf nextfpr 8) 134 (if (< fpr 96) 135 (setq target fpr) 136 (setq target (+ offset (logand offset 4)) 137 nextoffset (+ target 8))) 138 '%get-double-float) 139 ((and (typep argtype 'foreign-integer-type) 140 (= (foreign-integer-type-bits argtype) 64) 141 (foreign-integer-type-signed argtype)) 142 (if (< gpr 56) 141 143 (setq target (+ gpr (logand gpr 4)) 142 144 nextgpr (+ 8 target)) … … 144 146 nextoffset (+ 8 offset))) 145 147 '%%get-signed-longlong) 146 (:unsigned-doubleword 147 (if (< gpr 56) 148 (setq target (+ gpr (logand gpr 4)) 149 nextgpr (+ 8 target)) 150 (setq target (+ offset (logand offset 4)) 151 nextoffset (+ 8 offset))) 152 '%%get-unsigned-longlong) 153 (t 154 (incf nextgpr 4) 155 (if (< gpr 64) 156 (setq target gpr) 157 (setq target offset nextoffset (+ offset 4))) 158 (ecase type 159 (:signed-fullword '%get-signed-long) 160 (:signed-halfword (setq bias 2) '%get-signed-word) 161 (:signed-byte (setq bias 3) '%get-signed-byte) 162 (:unsigned-fullword '%get-unsigned-long) 163 (:unsigned-halfword (setq bias 2) '%get-unsigned-word) 164 (:unsigned-byte (setq bias 3) '%get-unsigned-byte) 165 (:address '%get-ptr)))) 148 ((and (typep argtype 'foreign-integer-type) 149 (= (foreign-integer-type-bits argtype) 64) 150 (not (foreign-integer-type-signed argtype))) 151 (if (< gpr 56) 152 (setq target (+ gpr (logand gpr 4)) 153 nextgpr (+ 8 target)) 154 (setq target (+ offset (logand offset 4)) 155 nextoffset (+ 8 offset))) 156 '%%get-unsigned-longlong) 157 (t 158 (incf nextgpr 4) 159 (if (< gpr 64) 160 (setq target gpr) 161 (setq target offset nextoffset (+ offset 4))) 162 (cond ((typep argtype 'foreign-pointer-type) '%get-ptr) 163 ((typep argtype 'foreign-integer-type) 164 (let* ((bits (foreign-integer-type-bits argtype)) 165 (signed (foreign-integer-type-signed argtype))) 166 (cond ((<= bits 8) 167 (setq bias 3) 168 (if signed 169 '%get-signed-byte ' 170 '%get-unsigned-byte)) 171 ((<= bits 16) 172 (setq bias 2) 173 (if signed 174 '%get-signed-word ' 175 '%get-unsigned-word)) 176 ((<= bits 32) 177 (if signed 178 '%get-signed-long ' 179 '%get-unsigned-long)) 180 (t 181 (error "Don't know how to access foreign argument of type ~s" (unparse-foreign-type argtype)))))) 182 (t 183 (error "Don't know how to access foreign argument of type ~s" (unparse-foreign-type argtype)))))) 166 184 ,stack-ptr 167 185 ,(+ target bias)))) … … 169 187 (when (eq spec :address) 170 188 (dynamic-extent-names name)) 171 (setq gpr nextgpr fpr nextfpr offset nextoffset))))) 172 (values (rlets) 173 (lets) 174 (dynamic-extent-names) 175 nil 176 rtype)))) 189 (setq gpr nextgpr fpr nextfpr offset nextoffset)))))))) 177 190 178 191
Note:
See TracChangeset
for help on using the changeset viewer.
