source: trunk/source/level-1/arm-callback-support.lisp @ 15018

Last change on this file since 15018 was 14119, checked in by gb, 9 years ago

Changes from ARM branch. Need testing ...

File size: 1.5 KB
Line 
1;;;-*-Mode: LISP; Package: CCL -*-
2;;;
3;;;   Copyright (C) 2010 Clozure Associates
4;;;   This file is part of Clozure CL. 
5;;;
6;;;   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with Clozure CL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with Clozure CL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   Clozure CL 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
17(in-package "CCL")
18
19(defun make-callback-trampoline (index &optional info)
20  (declare (ignore info))
21  (let* ((p (%allocate-callback-pointer 16)))
22    (macrolet ((arm-lap-word (instruction-form)
23                 (uvref (uvref (compile nil `(lambda (&lap 0) (arm-lap-function () ((?? 0)) ,instruction-form))) 1) 0)))
24      (setf (%get-unsigned-long p 0)
25            (dpb (ldb (byte 12 0) index)
26                 (byte 12 0)
27                 (dpb (ldb (byte 4 12) index)
28                      (byte 4 16)
29                      (arm-lap-word (movw r12 (:$ ??)))))
30            (%get-unsigned-long p 4)
31            (arm-lap-word (ldr pc (:@ pc (:$ -4))))
32            (%get-unsigned-long p 8)
33             #.(subprim-name->offset '.SPeabi-callback))
34      (ff-call (%kernel-import #.arm::kernel-import-makedataexecutable) 
35               :address p 
36               :unsigned-fullword 12
37               :void)
38      p)))
39                   
Note: See TracBrowser for help on using the repository browser.