Changeset 6948


Ignore:
Timestamp:
Jul 21, 2007, 10:51:36 PM (13 years ago)
Author:
gb
Message:

Allocate callback trampolines via mmap on ppc, too.

Location:
trunk/ccl/level-1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/ppc-callback-support.lisp

    r4260 r6948  
    2121(in-package "CCL")
    2222
    23 ;;; Do nothing; it seems that we can safely be pretty casual about assuming
    24 ;;; that malloc()ed memory is executable on PPC.
    25 (defun reset-callback-storage ())
    2623
    2724
     
    4037               #.(subprim-name->offset '.SPpoweropen-callbackX)
    4138               #.(subprim-name->offset '.SPpoweropen-callback)))
    42            (p (malloc 12)))
     39           (p (%allocate-callback-pointer 12)))
    4340      (setf (%get-long p 0) (logior (ldb (byte 8 16) index)
    4441                                    (ppc-lap-word (lis 11 ??)))   ; unboxed index
     
    6259(defun make-callback-trampoline (index &optional monitor-exception-ports)
    6360  (declare (ignorable monitor-exception-ports))
    64   (let* ((p (malloc 16)))
     61  (let* ((p (%allocate-callback-pointer 16)))
    6562    (setf (%%get-unsigned-longlong p 0) #.(subprim-name->offset '.SPpoweropen-callback)
    6663          (%%get-unsigned-longlong p 8) index)
  • trunk/ccl/level-1/x86-callback-support.lisp

    r6201 r6948  
    1616
    1717(in-package "CCL")
    18 
    19 (defstatic *callback-alloc-lock* (make-lock))
    20 
    21 ;;;
    22 (defun %make-executable-page ()
    23   (#_mmap (%null-ptr)
    24           (#_getpagesize)
    25           (logior #$PROT_READ #$PROT_WRITE #$PROT_EXEC)
    26           (logior #$MAP_PRIVATE #$MAP_ANON)
    27           -1
    28           0))
    29 
    30 (defstatic *available-bytes-for-callbacks* 0)
    31 (defstatic *current-callback-page* nil)
    32 
    33 (defun reset-callback-storage ()
    34   (setq *available-bytes-for-callbacks* (#_getpagesize)
    35         *current-callback-page* (%make-executable-page)))
    36 
    37 (defun %allocate-callback-pointer (n)
    38   (with-lock-grabbed (*callback-alloc-lock*)
    39     (when (< *available-bytes-for-callbacks* n)
    40       (reset-callback-storage))
    41     (decf *available-bytes-for-callbacks* n)
    42     (values (%inc-ptr *current-callback-page* *available-bytes-for-callbacks*))))
    4318
    4419
Note: See TracChangeset for help on using the changeset viewer.