FreeNOS
ExecutableFormat.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBEXEC_EXECUTABLEFORMAT_H
19#define __LIBEXEC_EXECUTABLEFORMAT_H
20#ifndef __ASSEMBLER__
21
22#include <Memory.h>
23#include <Types.h>
24
35
38
43typedef ExecutableFormat * FormatDetector(u8 *image, Size size);
44
49{
50 public:
51
64
75
76 public:
77
84 ExecutableFormat(const u8 *image, const Size size);
85
89 virtual ~ExecutableFormat();
90
100 virtual Result regions(Region *regions, Size *count) const = 0;
101
108 virtual Result entry(Address *entry) const = 0;
109
121 static Result find(const u8 *image, const Size size, ExecutableFormat **fmt);
122
123 protected:
124
126 const u8 *m_image;
127
130};
131
137#endif /* __ASSEMBLER__ */
138#endif /* __LIBEXEC_EXECUTABLEFORMAT_H */
u32 entry[]
Definition IntelACPI.h:1
Abstraction class of various executable formats.
struct ExecutableFormat::Region Region
Memory region.
virtual ~ExecutableFormat()
Class destructor.
virtual Result regions(Region *regions, Size *count) const =0
Memory regions a program needs at runtime.
static Result find(const u8 *image, const Size size, ExecutableFormat **fmt)
Find a ExecutableFormat which can handle the given format.
const u8 * m_image
Input image raw data.
const Size m_size
Input image size in bytes.
virtual Result entry(Address *entry) const =0
Lookup the program entry point.
ExecutableFormat * FormatDetector(u8 *image, Size size)
Confirms if we understand the given format.
Address EntryPoint
Entry point of a program.
unsigned long Address
A memory address.
Definition Types.h:131
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
unsigned char u8
Unsigned 8-bit number.
Definition Types.h:59
Access
Memory access flags.
Definition Memory.h:39