|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #ifndef ELFPHDR_H_ |
|
20 #define ELFPHDR_H_ |
|
21 #include <libelf.h> |
|
22 |
|
23 #include "romdetails.h" |
|
24 #include "elfheader.h" |
|
25 #include "e32romimage.h" |
|
26 #include "filefragment.h" |
|
27 #include "outputfile.h" |
|
28 |
|
29 class ElfPHdr : public FileFragmentOwner { |
|
30 public: |
|
31 ElfPHdr(){} |
|
32 |
|
33 ElfPHdr(const ElfPHdr & aPHdr); |
|
34 |
|
35 ElfPHdr & operator=(const ElfPHdr & aPHdr); |
|
36 |
|
37 Elf32_Word GetPhdrFilesz(){ return iElf32Phdr.p_filesz; } |
|
38 Elf32_Word GetPhdrOffset(){ return iElf32Phdr.p_offset; } |
|
39 Elf32_Addr GetPhdrPaddr(){ return iElf32Phdr.p_paddr; } |
|
40 |
|
41 void SetPhdrType(Elf32_Word x) { iElf32Phdr.p_type = x; } |
|
42 void SetPhdrOffset(Elf32_Off x) { iElf32Phdr.p_offset = x; } |
|
43 void SetPhdrVaddr(Elf32_Addr x) { iElf32Phdr.p_vaddr = x; } |
|
44 void SetPhdrPaddr(Elf32_Addr x) { iElf32Phdr.p_paddr = x; } |
|
45 void SetPhdrFilesz(Elf32_Word x) { iElf32Phdr.p_filesz = x; } |
|
46 void SetPhdrMemsz(Elf32_Word x) { iElf32Phdr.p_memsz = x; } |
|
47 void SetPhdrFlags(Elf32_Word x) { iElf32Phdr.p_flags = x; } |
|
48 void SetPhdrAlign(Elf32_Word x) { iElf32Phdr.p_align = x; } |
|
49 |
|
50 void InitRom(RomDetails * aRomDetails, size_t aOffset); |
|
51 |
|
52 virtual void GetFileFragmentData(FileFragmentData & aFileFragmentData ); |
|
53 virtual size_t Size() { return sizeof(Elf32_Phdr); }; |
|
54 virtual void DeleteFileFragmentData() {}; |
|
55 |
|
56 private: |
|
57 |
|
58 #if 0 |
|
59 typedef struct { |
|
60 Elf32_Word p_type; |
|
61 Elf32_Off p_offset; |
|
62 Elf32_Addr p_vaddr; |
|
63 Elf32_Addr p_paddr; |
|
64 Elf32_Word p_filesz; |
|
65 Elf32_Word p_memsz; |
|
66 Elf32_Word p_flags; |
|
67 Elf32_Word p_align; |
|
68 } Elf32_Phdr; |
|
69 #endif |
|
70 Elf32_Phdr iElf32Phdr; |
|
71 }; |
|
72 |
|
73 #endif /*ELFPHDR_H_*/ |