src/blfwk/GHSSecInfo.h
/*
* Copyright (c) 2013-14, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if !defined(_GHSSecInfo_h_)
#define _GHSSecInfo_h_
#include "StELFFile.h"
#include "smart_ptr.h"
namespace blfwk
{
class GHSSecInfo
{
public:
GHSSecInfo(StELFFile *elf);
bool hasSecinfo() const { return m_hasInfo; }
bool isSectionFilled(uint32_t addr, uint32_t length);
bool isSectionFilled(const Elf32_Shdr &section);
protected:
#pragma pack(1)
struct ghs_secinfo_t
{
uint32_t m_clearAddr;
uint32_t m_clearValue;
uint32_t m_numBytesToClear;
};
#pragma pack()
protected:
StELFFile *m_elf;
bool m_hasInfo;
smart_array_ptr<ghs_secinfo_t>
m_info;
unsigned m_entryCount;
};
}; // namespace blfwk
#endif // _GHSSecInfo_h_
Elf32_Shdr
ELF section header.
Definition: apps/elftosb/common/ELF.h:135
blfwk::GHSSecInfo::m_entryCount
unsigned m_entryCount
Number of entries in m_info.
Definition: src/blfwk/GHSSecInfo.h:88
blfwk::GHSSecInfo
Wrapper around the GHS-specific .secinfo ELF section.
Definition: src/blfwk/GHSSecInfo.h:54
blfwk::GHSSecInfo::m_hasInfo
bool m_hasInfo
Whether .secinfo is present in the ELF file.
Definition: src/blfwk/GHSSecInfo.h:85
blfwk
Definition: BlfwkErrors.h:16
blfwk::GHSSecInfo::hasSecinfo
bool hasSecinfo() const
Returns true if there is a .secinfo section present in the ELF file.
Definition: src/blfwk/GHSSecInfo.h:61
blfwk::GHSSecInfo::GHSSecInfo
GHSSecInfo(StELFFile *elf)
Default constructor.
Definition: src/blfwk/src/GHSSecInfo.cpp:22
blfwk::GHSSecInfo::isSectionFilled
bool isSectionFilled(uint32_t addr, uint32_t length)
Determines if a section should be filled.
Definition: src/blfwk/src/GHSSecInfo.cpp:65
blfwk::GHSSecInfo::ghs_secinfo_t
The structure of one .secinfo entry.
Definition: src/blfwk/GHSSecInfo.h:74
blfwk::GHSSecInfo::ghs_secinfo_t::m_clearValue
uint32_t m_clearValue
Value to fill with.
Definition: src/blfwk/GHSSecInfo.h:77
smart_array_ptr
Simple, standard smart pointer class that uses the array delete operator.
Definition: apps/elftosb/common/smart_ptr.h:121
blfwk::GHSSecInfo::ghs_secinfo_t::m_numBytesToClear
uint32_t m_numBytesToClear
Number of bytes to fill.
Definition: src/blfwk/GHSSecInfo.h:78
StELFFile
Parser for Executable and Linking Format (ELF) files.
Definition: apps/elftosb/common/StELFFile.h:42
blfwk::GHSSecInfo::m_info
smart_array_ptr< ghs_secinfo_t > m_info
Pointer to the .secinfo entries. Will be NULL if there is no .secinfo section in the file...
Definition: src/blfwk/GHSSecInfo.h:87
blfwk::GHSSecInfo::ghs_secinfo_t::m_clearAddr
uint32_t m_clearAddr
Address to start filling from.
Definition: src/blfwk/GHSSecInfo.h:76
blfwk::GHSSecInfo::m_elf
StELFFile * m_elf
The parser object for our ELF file.
Definition: src/blfwk/GHSSecInfo.h:84