-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathelf_file.hsl
112 lines (101 loc) · 3.26 KB
/
elf_file.hsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include "standard-types.hsl"
#pragma enumsize(4);
#pragma ptrsize(4);
#pragma byteorder(little_endian);
#pragma displayname("Elf (*.so)") ;
#pragma fileextensions(".so") ;
typedef unsigned long Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef unsigned long Elf32_Off;
typedef long Elf32_Sword;
typedef unsigned long Elf32_Word;
#pragma enumsize(1);
typedef enum tagClass_types
{
_32bit = 1,
_64bit = 2
}Class_types;
#pragma enumsize(4);
struct Elf32_Sym{
Elf32_Word st_name;
Elf32_Addr st_value;
Elf32_Word st_size;
unsigned char st_info; /* bind, type: ELF_32_ST_... */
unsigned char st_other;
Elf32_Half st_shndx; /* SHN_... */
};
struct Elf32_Shdr{
Elf32_Word sh_name; /* section name */
Elf32_Word sh_type; /* SHT_... */
Elf32_Word sh_flags; /* SHF_... */
Elf32_Addr sh_addr; /* virtual address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* misc info */
Elf32_Word sh_info; /* misc info */
Elf32_Word sh_addralign; /* memory alignment */
Elf32_Word sh_entsize; /* entry size if table */
} ;
struct Elf32_Phdr{
Elf32_Word p_type; /* Segment type */
Elf32_Off p_offset; /* Segment file offset */
Elf32_Addr p_vaddr; /* Segment virtual address */
Elf32_Addr p_paddr; /* Segment physical address */
Elf32_Word p_filesz; /* Segment size in file */
Elf32_Word p_memsz; /* Segment size in memory */
Elf32_Word p_flags; /* Segment flags */
Elf32_Word p_align; /* Segment alignment */
} ;
struct Elf32_Ehdr
{
unsigned char e_ident[16]; /* ident bytes */
Elf32_Half e_type; /* file type */
Elf32_Half e_machine; /* target machine */
Elf32_Word e_version; /* file version */
Elf32_Addr e_entry; /* start address */
Elf32_Off e_phoff; /* phdr file offset */
Elf32_Off e_shoff; /* shdr file offset */
Elf32_Word e_flags; /* file flags */
Elf32_Half e_ehsize; /* sizeof ehdr */
Elf32_Half e_phentsize; /* sizeof phdr */
Elf32_Half e_phnum; /* number phdrs */
Elf32_Half e_shentsize; /* sizeof shdr */
Elf32_Half e_shnum; /* number shdrs */
Elf32_Half e_shstrndx; /* shdr string index */
};
typedef struct Elf32_Nhdr
{
Elf32_Word n_namesz; /* Length of the note's name. */
Elf32_Word n_descsz; /* Length of the note's descriptor. */
Elf32_Word n_type; /* Type of the note. */
} Elf32_Nhdr;
typedef struct mu
{
Elf32_Off length;
char data[length];
}mu;
struct eflFile
{
//blob elfheader[4100];
#pragma lockAt(0x00000000)
struct Elf32_Ehdr elfheader;
mu muh;
muh.length = elfheader.e_shoff - elfheader.e_phoff;
//struct Elf32_Phdr proghdr[elfheader.e_phnum];
char holderPhdr[elfheader.e_shoff - elfheader.e_phoff];
char holderShdr[elfheader.e_shentsize * elfheader.e_shnum];
//struct Elf32_Shdr sectionHeader[elfheader.e_shnum];
//struct Elf32_Nhdr nameHeader[elfheader.e_shstrndx];
//__addStructureAt(elfheader.e_shoff, "Elf32_Shdr", "");
//Elf32_Shdr sectionHeader;
//char programmheader[elfheader.e_phnum + elfheader.e_phentsize];
//char sectionHeader[elfheader.e_shnum + elfheader.e_shentsize];
//char hofsett[elfheader];
//struct Elf32_Phdr programmheader;
//Elf32_Sym symbol;
//char symlength[26300];
//blob headersize[header.e_shoff/2];
//struct tagElf32_Shdr section[header.];
//char symlength[4*256];
//struct Elf32_Sym sym[section.sh_link];
};