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