GEL  0.99
image.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * This file is part of the GEL library.
5  * Copyright (c) 2008, IRIT- UPS
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef GEL_IMAGE_H_
22 #define GEL_IMAGE_H_
23 
24 #include <gel/common.h>
25 #include <gel/types.h>
26 #include <gel/file.h>
27 
29 
30 /* auxiliairy vector */
31 typedef struct auxv_t {
32  int a_type;
33  union {
34  int32_t a_val;
35  void *a_ptr;
36  void (*a_fcn)();
37  } a_un;
39 
40 
41 /* environment flags */
42 #define GEL_ENV_CLUSTERISED_MEMORY 0x00000001
43 #define GEL_ENV_NO_STACK 0x00000002
44 
45 
46 /* environment default values */
47 #define STACKADDR_OSDEFAULT 0
48 #define STACKSIZE_OSDEFAULT 0
49 #define ENVFLAGS_OSDEFAULT 0
50 #define CLUSTERSIZE_OSDEFAULT 4096
51 
52 
53 /* environment */
54 typedef struct gel_env_s {
55  char **libpath;
56  char **argv;
57  char **envp;
58  char *pltblock;
70  struct auxv_t *auxv;
72 
73 
74 /* other types */
75 typedef struct gel_image_s gel_image_t;
76 typedef struct gel_memory_image_s gel_memory_image_t;
77 typedef struct gel_memory_cluster_s gel_memory_cluster_t;
78 
79 
80 /* cluster information */
81 typedef struct gel_memory_cluster_info_t {
86 
87 
88 /* image memory information */
89 typedef struct gel_memory_image_info_t {
90  struct gel_memory_cluster_s** clusters;
93 
94 
95 /* image information */
96 typedef struct gel_image_info_t {
104 
105 
106 /* image block information */
107 typedef struct gel_block_info_t {
113 
114 
115 /* gel_image_load flags */
116 #define GEL_IMAGE_CLOSE_EXEC 0x00000001
117 #define GEL_IMAGE_CLOSE_LIBS 0x00000002
118 #define GEL_IMAGE_PLTBLOCK_LAZY 0x00000004
119 #define GEL_IMAGE_PLTBLOCK_NOW 0x00000008
120 
121 
122 /* primitives */
124 void gel_close_libs(gel_image_t *im);
132 gel_image_t *gel_image_load(gel_file_t *e, gel_env_t *env, int flags);
139 void gel_replacesym(gel_image_t *im, char *symname, gel_sym_t *newsym);
140 
142 
143 #endif /* GEL_IMAGE_H_ */
#define __END_DECLS
Definition: common.h:29
#define __BEGIN_DECLS
Definition: common.h:28
struct gel_block_info_t gel_block_info_t
int gel_block_infos(gel_block_t *b, gel_block_info_t *bi)
Definition: block.c:61
struct gel_memory_cluster_s gel_memory_cluster_t
Definition: image.h:77
gel_env_t * gel_image_env(gel_image_t *i)
Definition: image.c:803
int gel_memory_image_infos(gel_memory_image_t *mi, gel_memory_image_info_t *mii)
Definition: image.c:1094
struct gel_memory_image_s gel_memory_image_t
Definition: image.h:76
void gel_image_close(gel_image_t *i)
Definition: image.c:456
struct gel_memory_cluster_info_t gel_memory_cluster_info_t
gel_env_t * gel_default_env()
Definition: image.c:93
struct gel_image_info_t gel_image_info_t
gel_image_t * gel_image_load(gel_file_t *e, gel_env_t *env, int flags)
Definition: image.c:543
int gel_image_infos(gel_image_t *i, gel_image_info_t *ii)
Definition: image.c:1073
int gel_memory_cluster_infos(gel_memory_cluster_t *mc, gel_memory_cluster_info_t *mci)
Definition: image.c:1114
struct gel_memory_image_info_t gel_memory_image_info_t
vaddr_t gel_raddr_to_vaddr(raddr_t a, gel_image_t *i)
Definition: image.c:749
void gel_image_close_only(gel_image_t *i)
Definition: image.c:469
struct gel_image_s gel_image_t
Definition: image.h:75
raddr_t gel_vaddr_to_raddr(vaddr_t a, gel_image_t *i)
Definition: image.c:730
gel_sym_t * gel_find_glob_symbol(gel_image_t *i, char *name)
Definition: gel_load.c:191
void gel_close_libs(gel_image_t *im)
Definition: image.c:438
int gel_test_raddr(raddr_t a, gel_image_t *i)
Definition: image.c:785
void gel_replacesym(gel_image_t *im, char *symname, gel_sym_t *newsym)
Definition: gel_base.c:190
int gel_test_vaddr(vaddr_t a, gel_image_t *i)
Definition: image.c:767
struct gel_env_s gel_env_t
__BEGIN_DECLS struct auxv_t auxv_t
gel_enum_t * gel_enum_glob_symbol(gel_image_t *im)
Definition: gel_load.c:203
Definition: image.h:31
int a_type
Definition: image.h:32
void * a_ptr
Definition: image.h:35
union auxv_t::@1 a_un
void(* a_fcn)()
Definition: image.h:36
int32_t a_val
Definition: image.h:34
Definition: image.h:107
gel_file_t * container
Definition: image.h:108
vaddr_t base_vaddr
Definition: image.h:109
raddr_t base_raddr
Definition: image.h:110
u32_t vreloc
Definition: image.h:111
Definition: gel_types_plugin.h:74
Definition: image.h:54
char ** argv
Definition: image.h:56
int argc_return
Definition: image.h:65
char ** envp
Definition: image.h:57
u32_t flags
Definition: image.h:64
u32_t clustersize
Definition: image.h:63
vaddr_t sp_return
Definition: image.h:68
vaddr_t auxv_return
Definition: image.h:69
char ** libpath
Definition: image.h:55
vaddr_t stackaddr
Definition: image.h:60
struct auxv_t * auxv
Definition: image.h:70
char * pltblock
Definition: image.h:58
vaddr_t argv_return
Definition: image.h:66
vaddr_t envp_return
Definition: image.h:67
u32_t stacksize
Definition: image.h:62
vaddr_t stacktop
Definition: image.h:61
u32_t pltblocksize
Definition: image.h:59
Definition: file.h:31
Definition: image.h:96
gel_block_t ** members
Definition: image.h:97
raddr_t rentry
Definition: image.h:100
vaddr_t ventry
Definition: image.h:99
gel_memory_image_t * memory
Definition: image.h:102
vaddr_t stack_pointer
Definition: image.h:101
u32_t membersnum
Definition: image.h:98
Definition: image.h:81
u32_t size
Definition: image.h:84
vaddr_t vaddr
Definition: image.h:83
u8_t * raddr
Definition: image.h:82
Definition: image.h:89
struct gel_memory_cluster_s ** clusters
Definition: image.h:90
u32_t nb_clusters
Definition: image.h:91
uint32_t u32_t
Definition: types.h:32
uint8_t u8_t
Definition: types.h:34
struct gel_enum_s gel_enum_t
Definition: types.h:42
uint32_t vaddr_t
Definition: types.h:36
void * raddr_t
Definition: types.h:37
struct gel_sym_s gel_sym_t
Definition: types.h:45