Changeset 13266 for branches/purify


Ignore:
Timestamp:
Dec 9, 2009, 12:36:21 AM (10 years ago)
Author:
gb
Message:

Changes for new x86 purification scheme; need testing. Depends on
kernel changes (to write pure area to image file before dynamic
area.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/purify/source/library/elf.lisp

    r13256 r13266  
     1;;; Copyright 2009 Clozure Associates
     2;;; This file is part of Clozure CL. 
     3;;;
     4;;; Clozure CL is licensed under the terms of the Lisp Lesser GNU
     5;;; Public License , known as the LLGPL and distributed with Clozure
     6;;; CL as the file "LICENSE".  The LLGPL consists of a preamble and
     7;;; the LGPL, which is distributed with Clozure CL as the file "LGPL".
     8;;; Where these conflict, the preamble takes precedence.
     9;;;
     10;;; Clozure CL is referenced in the preamble as the "LIBRARY."
     11;;;
     12;;; The LLGPL is also available online at
     13;;; http://opensource.franz.com/preamble.html
     14
    115(in-package "CCL")
    216
     
    519
    620
     21(defloadvar *readonly-area*
     22    (do-consing-areas (a)
     23      (when (eql (%fixnum-ref a target::area.code)
     24                 ccl::area-readonly)
     25        (return a))))
    726
    827;;; String tables: used both for symbol names and for section names.
     
    156175    (purify)
    157176    (block walk
    158       (let* ((frozen-dnodes (frozen-space-dnodes)))
    159         (%map-areas (lambda (o)
    160                       (when (typep o
    161                                    #+x8664-target 'function-vector
    162                                    #-x8664-target 'function)
    163                         (functions (function-vector-to-function o))))
    164                     ccl::area-readonly
    165                     ccl::area-readonly
    166                     )))
     177      (%map-areas (lambda (o)
     178                    (when (typep o
     179                                 #+x8664-target 'function-vector
     180                                 #-x8664-target 'function)
     181                      (functions (function-vector-to-function o))))
     182                  ccl::area-readonly
     183                  ccl::area-readonly
     184                  ))
    167185    (functions)))
    168186
     
    281299      (fd-read fd shdr (record-length #+64-bit-target :<E>lf64_<S>hdr
    282300                                      #+32-bit-target :<E>lf32_<S>hdr))
     301      ;; On 64-bit platforms, the section data precedes the image
     302      ;; header; on 32-bit platforms, the image header and image
     303      ;; section table precede the image data for the first (static)
     304      ;; section.  With alignment, the header/section headers are
     305      ;; one 4K page, and the static section size is 8K ...
    283306      (setf (pref shdr #+64-bit-target :<E>lf64_<S>hdr.sh_offset
    284307                  #+32-bit-target :<E>lf32_<S>hdr.sh_offset)
    285             (+ #x2000 (logandc2 (+ eof 4095) 4095))) ; #x2000 for nilreg-area
     308            (+ #+32-bit-target #x1000 #+64-bit-target 0  #x2000 (logandc2 (+ eof 4095) 4095)))
     309      (setf (pref shdr #+64-bit-target :<E>lf64_<S>hdr.sh_type
     310                  #+32-bit-target :<E>lf32_<S>hdr.sh_type)
     311            #$SHT_PROGBITS)
    286312      (fd-lseek fd pos #$SEEK_SET)
    287313      (fd-write fd shdr (record-length #+64-bit-target :<E>lf64_<S>hdr
     
    322348                #+32-bit-target :<E>lf32_<S>hdr.sh_flags) (logior #$SHF_WRITE #$SHF_ALLOC #$SHF_EXECINSTR)
    323349          (pref lisp-section-header #+64-bit-target :<E>lf64_<S>hdr.sh_addr
    324                 #+32-bit-target :<E>lf32_<S>hdr.sh_addr) (ash (%get-kernel-global heap-start) target::fixnumshift)
     350                #+32-bit-target :<E>lf32_<S>hdr.sh_addr) (ash (%fixnum-ref *readonly-area* target::area.low) target::fixnumshift)
    325351          (pref lisp-section-header #+64-bit-target :<E>lf64_<S>hdr.sh_size
    326                 #+32-bit-target :<E>lf32_<S>hdr.sh_size) (ash (frozen-space-dnodes) target::dnode-shift)
     352                #+32-bit-target :<E>lf32_<S>hdr.sh_size) (ash (- (%fixnum-ref *readonly-area* target::area.active) (%fixnum-ref *readonly-area* target::area.low) )target::fixnumshift)
    327353          (pref lisp-section-header #+64-bit-target :<E>lf64_<S>hdr.sh_offset
    328354                #+32-bit-target :<E>lf32_<S>hdr.sh_offset) 0
     
    350376          (pref shstrtab-section-header #+64-bit-target :<E>lf64_<S>hdr.sh_flags
    351377                #+32-bit-target :<E>lf32_<S>hdr.sh_flags) (logior #$SHF_STRINGS #$SHF_ALLOC))
    352     (elf-make-empty-data-for-section object lisp-section (ash (frozen-space-dnodes) target::dnode-shift))
     378    (elf-make-empty-data-for-section object lisp-section (ash (- (%fixnum-ref *readonly-area* target::area.active) (%fixnum-ref *readonly-area* target::area.low) )target::fixnumshift))
    353379    (elf-init-section-data-from-string-table object strings-section (elf-symbol-table-strings symbols))
    354380    (elf-init-section-data-from-string-table object shstrtab-section section-names)
Note: See TracChangeset for help on using the changeset viewer.