This module handles the ability to load an execution image from an ELF file.
◆ CLUSTERSIZE_OSDEFAULT
| #define CLUSTERSIZE_OSDEFAULT 4096 |
Default memory cluster size as found in the environment.
◆ ENVFLAGS_OSDEFAULT
| #define ENVFLAGS_OSDEFAULT 0 |
◆ GEL_ENV_CLUSTERISED_MEMORY
| #define GEL_ENV_CLUSTERISED_MEMORY 0x00000001 |
Passed in the gel_env_t flags, activate the use of a clusterized memory scheme.
◆ GEL_ENV_NO_STACK
| #define GEL_ENV_NO_STACK 0x00000002 |
Passed in the gel_env_t flags, disable the allocation of a stack (often used in embedded code).
◆ GEL_IMAGE_CLOSE_EXEC
| #define GEL_IMAGE_CLOSE_EXEC 0x00000001 |
◆ GEL_IMAGE_CLOSE_LIBS
| #define GEL_IMAGE_CLOSE_LIBS 0x00000002 |
◆ GEL_IMAGE_PLTBLOCK_LAZY
| #define GEL_IMAGE_PLTBLOCK_LAZY 0x00000004 |
gel_image_load() flag. Do not relocate the PLT, use a predefined block instead allowing lazy resolution.
◆ GEL_IMAGE_PLTBLOCK_NOW
| #define GEL_IMAGE_PLTBLOCK_NOW 0x00000008 |
◆ STACKADDR_OSDEFAULT
| #define STACKADDR_OSDEFAULT 0 |
◆ STACKSIZE_OSDEFAULT
| #define STACKSIZE_OSDEFAULT 0 |
◆ gel_image_info_t
Public information of an image, extracted from the image descriptor. Provided by the function gel_image_infos().
◆ gel_image_t
◆ gel_memory_cluster_info_t
Public information of an image, got using gel_image_cluster_infos().
◆ gel_memory_cluster_t
Descriptor of a contiguous memory area.
◆ gel_memory_image_info_t
Public information of an image memory. Provided by the function gel_image_memory_infos().
◆ gel_memory_image_t
◆ gel_block2cursor()
Create a cursor on a memory block.
- Parameters
-
| f | Block descriptor. |
| c | Cursor instance. |
- Returns
- Error code (0 for success, -1 for failure)
◆ gel_default_env()
Return the default environment that is initialized as below :
- libpath = { "./", "/lib", "/usr/lib", "/usr/local/lib", "/usr/X11R6/lib"}
- argv = {}
- envp = {}
- pltblock = NULL
- pltblocksize = 0
- stackaddr = STACKADDR_OSDEFAULT
- stacksize = STACKSIZE_OSDEFAULT
- clustersize = CLUSTERSIZE_OSDEFAULT
- flags = ENVFLAGS_OSDEFAULT
- Returns
- Environment initialized with default values or NULL if there is no more memory.
◆ gel_file_load_info()
Get information about loading segments (virtual and physical addresses).
- Parameters
-
| file | ELF file |
| base_vaddr | current base addresse |
- Returns
- 0 for success, -1 else
◆ gel_image_close()
Close the image and unallocated its ressources (including opened execitable file and program headers).
- Parameters
-
◆ gel_image_close_only()
Close only the image data structure, not the opened files. The latter must be closed by hand by the user.
- Parameters
-
◆ gel_image_env()
Return the execution environment configuration of the current image. The returned information becomes invalid as soon as the image is closed.
- Parameters
-
- Returns
- Image environment.
◆ gel_image_infos()
Extract public information from the image. Got information becomes invalided as soon as the image is released.
- Parameters
-
| i | Image descriptor. |
| ii | Structure to get image information. |
- Returns
- 0 for sucess, -f for error (code in gel_errno).
◆ gel_image_load()
Load the given file used as the executable and build the matching execution image. According the needs of the executable, load also the required libraries. The built image must be released using gel_image_close().
- Parameters
-
| e | Executable file to load the image of. |
| flags | Miscalleneous flags (GEL_IMAGE_CLOSE_EXEC, GEL_IMAGE_CLOSE_LIBS, GEL_IMAGE_PLTBLOCK_LAZY, GEL_IMAGE_PLTBLOCK_NOW). |
| env | Used environment. |
- Returns
- Built image or NULL if there is an error (code in gel_errno).
◆ gel_memory_cluster_infos()
Extract public information of an image memory cluster. Got information becomes invalid as soon as the image is closed.
- Parameters
-
| mc | pointeur vers le descripteur du cluster memoire |
| mci | pointeur vers la structure devant �tre remplie par les infos |
- Returns
- Code d'erreur (0 pour succes, -1 pour erreur)
◆ gel_memory_image_infos()
Extract public information about the image memory. Got information becomes invalid as soon as the image is released.
- Parameters
-
| mi | Image memory descriptor. |
| mii | Structure to store image memory information in. |
- Returns
- 0 for sucess, -1 else (error code in gel_errno).
◆ gel_raddr_to_vaddr()
Convert a real address to the matching virtual address.
- Parameters
-
| a | Real address to convert. |
| im | Image containing the real address. |
- Returns
- Converted virtual address.
◆ gel_vaddr_to_raddr()
Convert virtual relocated address to a real address.
- Parameters
-
| a | Virtual address to convert. |
| im | Image containing the virtual address. |
- Returns
- Converted real address.