annotate leo-obj/tool/intstruct.h @ 278:42575bc59702

benq-fw-disasm: dug a little into BenQ's M32 firmware
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Dec 2018 07:48:48 +0000
parents 71e25510f5af
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
71
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * The structures defined in this header file
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * are internal to our utility.
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 struct internal_scnhdr {
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 char *name;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 unsigned size;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 unsigned data_offset;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 unsigned reloc_offset;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 unsigned line_offset;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 unsigned nreloc;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 unsigned nlineent;
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 unsigned flags;
80
da103b9377e3 tiobjd: preparation for symbol sorting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 73
diff changeset
15 unsigned nsymbols;
da103b9377e3 tiobjd: preparation for symbol sorting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 73
diff changeset
16 struct internal_syment **sorted_symbols;
110
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
17 struct internal_reloc *int_relocs;
127
a314d6aa9bf1 tiobjd: section disasm mode hinting rethought
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 126
diff changeset
18 int disasm_mode;
126
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
19 struct hint *hints;
71
c15cd3d695c0 tiobjd: successful parsing of the section header table
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 };
73
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
21
127
a314d6aa9bf1 tiobjd: section disasm mode hinting rethought
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 126
diff changeset
22 #define DISASM_MODE_UNKNOWN 0
a314d6aa9bf1 tiobjd: section disasm mode hinting rethought
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 126
diff changeset
23 #define DISASM_MODE_CODE 1
a314d6aa9bf1 tiobjd: section disasm mode hinting rethought
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 126
diff changeset
24 #define DISASM_MODE_DATA 2
a314d6aa9bf1 tiobjd: section disasm mode hinting rethought
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 126
diff changeset
25 #define DISASM_MODE_BSS 3
126
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
26
73
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
27 struct internal_syment {
116
5f4141ee175b tiobjd: retain the original symtab order for symbols at the same position
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 110
diff changeset
28 unsigned number;
73
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
29 char *name;
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
30 unsigned value;
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
31 int scnum;
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
32 int type;
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
33 int class;
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
34 u_char *aux;
80
da103b9377e3 tiobjd: preparation for symbol sorting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 73
diff changeset
35 struct internal_scnhdr *section;
144
fd772de226cb tiobjd: started implementing rich symbolic info parsing
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 134
diff changeset
36 char *struct_name;
fd772de226cb tiobjd: started implementing rich symbolic info parsing
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 134
diff changeset
37 char *struct_name_raw;
73
10f3fbff5e97 tiobjd: symbol table parsing implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 71
diff changeset
38 };
110
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
39
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
40 struct internal_reloc {
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
41 unsigned location;
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
42 struct internal_syment *sym;
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
43 int type;
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
44 char *typestr;
e650fdc743fe tiobjd: higher-level reloc handling
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 80
diff changeset
45 };
126
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
46
211
71e25510f5af tiobjd disasm -ll: show the actual line numbers
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 144
diff changeset
47 struct internal_lineno {
71e25510f5af tiobjd disasm -ll: show the actual line numbers
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 144
diff changeset
48 unsigned location;
71e25510f5af tiobjd disasm -ll: show the actual line numbers
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 144
diff changeset
49 unsigned lineno;
71e25510f5af tiobjd disasm -ll: show the actual line numbers
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 144
diff changeset
50 };
71e25510f5af tiobjd disasm -ll: show the actual line numbers
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 144
diff changeset
51
126
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
52 struct hint {
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
53 unsigned pos;
134
c131238c56bf tiobjd: implemented parsing of the hint input files
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 130
diff changeset
54 unsigned endpos;
126
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
55 int type;
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
56 int linebrk;
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
57 struct hint *next;
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
58 };
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
59
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
60 #define HINT_D8 1
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
61 #define HINT_D16 2
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
62 #define HINT_ASCIZ 3
2c6b1319383b tiobjd: first preparations for adding disasm hints mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 116
diff changeset
63 #define HINT_D32 4