source: trunk/source/lisp-kernel/image.h @ 14347

Last change on this file since 14347 was 14295, checked in by rme, 9 years ago

Eliminate some (but not all) warnings produced when building with
"-Wall -Wno-format". Also a couple of minor changes that enable
clang to build the lisp kernel (at least on x8632 and x8664).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/*
2   Copyright (C) 2002-2009 Clozure Associates
3   This file is part of Clozure CL. 
4
5   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with Clozure CL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with Clozure CL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   Clozure CL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17
18#define IMAGE_SIG0 (('O'<<24) | ('p'<<16) | ('e'<<8) | 'n')
19#define IMAGE_SIG1 (('M'<<24) | ('C'<<16) | ('L'<<8) | 'I')
20#define IMAGE_SIG2 (('m'<<24) | ('a'<<16) | ('g'<<8) | 'e')
21#define IMAGE_SIG3 (('F'<<24) | ('i'<<16) | ('l'<<8) | 'e')
22
23/*
24   An image file contains a header (which describes the type, size,
25   and nominal memory address of one or more sections) and data for
26   each section; each section's data is page-aligned within the image
27   file, so its disk address is implicit.  The header must reside
28   entirely within a page; the first section's data starts on the page
29   after the image header, and subsequent sections start on the pages
30   after the page which contains the last byte of their predecessor's
31   data.
32
33   The image header's position relative to the start of the file is
34   arbitrary.  The image header's position relative to the end of the
35   file is indicated by the last word in the file (which is preceded
36   by the first three signature words above.)  The last word contains
37   the distance from the end-of-file to the start of the header.
38
39   As long as these alignment constraints are met, the image file can
40   have arbitrary data (or executable programs, or shell scripts)
41   prepended to it.  This is supposed to simplify distribution.
42*/
43
44typedef struct {
45  natural code;
46  area *area;
47  natural memory_size;
48  natural static_dnodes;
49} openmcl_image_section_header;
50
51typedef struct {
52  unsigned sig0, sig1, sig2, sig3;
53  unsigned timestamp;
54  unsigned canonical_image_base_32; /* IMAGE_BASE_ADDRESS */
55  unsigned actual_image_base_32;        /* Hopefully the same */
56  unsigned nsections;
57  unsigned abi_version;
58#if WORD_SIZE == 64
59  int section_data_offset_high; /* signed offset from end of
60                                         section headers to first
61                                         section's data.  May be zero. */
62  unsigned section_data_offset_low;
63  unsigned flags; 
64  natural canonical_image_base_64;
65  natural actual_image_base_64;
66#else
67  unsigned pad0[2]; 
68  unsigned flags;
69  unsigned pad1[4];
70#endif
71} openmcl_image_file_header;
72
73#if WORD_SIZE == 64
74#define ACTUAL_IMAGE_BASE(header) ((header)->actual_image_base_64)
75#define CANONICAL_IMAGE_BASE(header) ((header)->canonical_image_base_64)
76#else
77#define ACTUAL_IMAGE_BASE(header) ((header)->actual_image_base_32)
78#define CANONICAL_IMAGE_BASE(header) ((header)->canonical_image_base_32)
79#endif
80
81typedef struct {
82  unsigned sig0, sig1, sig2;
83  int delta;
84} openmcl_image_file_trailer;
85
86LispObj
87load_openmcl_image(int, openmcl_image_file_header*);
88
89Boolean find_openmcl_image_file_header(int fd, openmcl_image_file_header *h);
90
91
92
93#define ABI_VERSION_MIN 1036
94#define ABI_VERSION_CURRENT 1036
95#define ABI_VERSION_MAX 1036
96
97#define NUM_IMAGE_SECTIONS 5    /* used to be 3 */
Note: See TracBrowser for help on using the repository browser.