# elf.c File Reference

`#include <ubixos/elf.h>`
`#include <ubixos/kpanic.h>`
`#include <lib/kmalloc.h>`
`#include <vmm/vmm.h>`

Include dependency graph for elf.c:

Go to the source code of this file.

## Functions

int | elf_loadfile (kTask_t *p, const char *file, u_int32_t *addr, u_int32_t *entry)
char * | elfGetPhType (int phType)
char * | elfGetRelType (int relType)
char * | elfGetShType (int shType)

## Variables

struct {
uInt32 id
char * phTypeName
} | elfPhType []
struct {
uInt32 id
char * relTypeName
} | elfRelType []
struct {
uInt32 id
char * shTypeName
} | elfShType []
struct {
char * elfTypeName
uInt32 id
} | elfType []

## Function Documentation

int elf_loadfile | ( | kTask_t * | p,
|  | const char * | file,
|  | u_int32_t * | addr,
|  | u_int32_t * | entry |
| ) |  |  |

Definition at line 111 of file elf.c.

References _current, elfHeader::eEntry, elfHeader::eIdent, elfHeader::ePhnum, elfHeader::ePhoff, ET_DYN, ET_EXEC, elfHeader::eType, fclose(), fopen(), fread(), fseek(), taskStruct::id, K_PANIC, kfree(), kmalloc(), kprintf(), memset(), PAGE_DEFAULT, PAGE_PRESENT, PAGE_USER, elfProgramHeader::phMemsz, elfProgramHeader::phVaddr, PT_LOAD, vmm_remapPage(), vmm_setPageAttributes(), vmmFindFreePage(), and x1000.

Here is the call graph for this function:

char* elfGetPhType | ( | int | phType | ) |

Definition at line 103 of file elf.c.

References elfPhType, and phTypeName.

char* elfGetRelType | ( | int | relType | ) |

Definition at line 107 of file elf.c.

References elfRelType, and relTypeName.

Referenced by kmod_load(), and ldEnable().

char* elfGetShType | ( | int | shType | ) |

Definition at line 99 of file elf.c.

References elfShType, and shTypeName.

## Variable Documentation

struct { ... } elfPhType[]

Referenced by elfGetPhType().

struct { ... } elfRelType[]

Referenced by elfGetRelType().

struct { ... } elfShType[]

Referenced by elfGetShType().

struct { ... } elfType[]

char* elfTypeName

Definition at line 36 of file elf.c.

uInt32 id

Definition at line 83 of file elf.c.

uInt32 id

Definition at line 65 of file elf.c.

uInt32 id

Definition at line 50 of file elf.c.

uInt32 id

Definition at line 37 of file elf.c.

char* phTypeName

Definition at line 49 of file elf.c.

Referenced by elfGetPhType().

char* relTypeName

Definition at line 82 of file elf.c.

Referenced by elfGetRelType().

char* shTypeName

Definition at line 64 of file elf.c.

Referenced by elfGetShType().