Max OS 0.3
Loading...
Searching...
No Matches
elf.h File Reference

Defines structures and enums for handling ELF (Executable and Linkable Format) files in MaxOS. More...

#include <cstdint>
#include <cstddef>
#include <memory/memorymanagement.h>
#include <memory/memoryIO.h>

Go to the source code of this file.

Classes

struct  MaxOS::processes::ELFHeader64
 The header of a 64-bit ELF file. More...
 
struct  MaxOS::processes::ELFProgramHeader64
 The header for the program segments in a 64-bit ELF file. More...
 
struct  MaxOS::processes::ELFSectionHeader64
 The header for the sections in a 64-bit ELF file. More...
 
class  MaxOS::processes::ELF64
 Handles the loading and parsing of 64-bit ELF files. More...
 

Typedefs

typedef struct MaxOS::processes::ELFHeader64 MaxOS::processes::elf_64_header_t
 Alias for ELFHeader64 struct.
 
typedef struct MaxOS::processes::ELFProgramHeader64 MaxOS::processes::elf_64_program_header_t
 Alias for ELFProgramHeader64 struct.
 
typedef struct MaxOS::processes::ELFSectionHeader64 MaxOS::processes::elf_64_section_header_t
 Alias for ELFSectionHeader64 struct.
 

Enumerations

enum class  MaxOS::processes::ELFIdentification {
  Magic0 , Magic1 , Magic2 , Magic3 ,
  Class , Data , Version , OSABI ,
  ABIVersion , Padding
}
 The indexes of the ELF identification array. More...
 
enum class  MaxOS::processes::ELFClass { Invalid , Bits32 , Bits64 }
 The class of the ELF file (32-bit or 64-bit) More...
 
enum class  MaxOS::processes::ELFData { InvalidData , LittleEndian , BigEndian }
 The data encoding of the ELF file (little-endian or big-endian) More...
 
enum class  MaxOS::processes::ELFType {
  None , Relocatable , Executable , Shared ,
  Core , ProcessorSpecificLow = 0xFF0 , ProcessorSpecificHigh = 0xFFF
}
 The type of the ELF file (executable, shared object, etc.) More...
 
enum class  MaxOS::processes::ELFMachine {
  NoMachine , ATnTWe32100 , SPARC , x86 ,
  MIPS = 0x8 , PowerPC = 0x14 , ARM = 0x28 , SuperH = 0x2A ,
  IA_64 = 0x32 , x86_64 = 0x3E , AArch64 = 0xB7 , RISC_V = 0xF3
}
 The target architecture of the ELF file. More...
 
enum class  MaxOS::processes::ELFVersion { Invalid , Current }
 The version of the ELF file. More...
 
enum class  MaxOS::processes::ELFProgramType {
  Null , Load , Dynamic , Interpreter ,
  Note , SharedLibrary , HeaderTable , TableProcessorSpecificLow = 0x70000000 ,
  TableProcessorSpecificHigh = 0x7FFFFFFF
}
 The type of a program header in the ELF file. More...
 
enum  MaxOS::processes::ELFProgramFlags { ELFExecute = (1 << 0) , ELFWrite = (1 << 1) , ELFRead = (1 << 2) }
 The flags of a program header in the ELF file. More...
 
enum class  MaxOS::processes::ELFSectionType {
  Null , ProgramBits , SymbolTable , StringTable ,
  RelocationAddends , SymbolHashTable , DynamicLinkingTable , SectionNote ,
  NoBits
}
 The type of a section in the ELF file. More...
 

Variables

constexpr char MaxOS::processes::ELF_MAGIC [4] = { 0x7F, 'E', 'L', 'F' }
 The expected ELF magic number at the start of the file.
 

Detailed Description

Defines structures and enums for handling ELF (Executable and Linkable Format) files in MaxOS.

Date
21st March 2025
Author
Max Tyson

Definition in file elf.h.

Enumeration Type Documentation

◆ ELFClass

enum class MaxOS::processes::ELFClass
strong

The class of the ELF file (32-bit or 64-bit)

Definition at line 45 of file elf.h.

45 {
46 Invalid,
47 Bits32,
48 Bits64
49 };

◆ ELFData

enum class MaxOS::processes::ELFData
strong

The data encoding of the ELF file (little-endian or big-endian)

Definition at line 55 of file elf.h.

55 {
56 InvalidData,
57 LittleEndian,
58 BigEndian
59 };

◆ ELFIdentification

The indexes of the ELF identification array.

Definition at line 28 of file elf.h.

28 {
29 Magic0,
30 Magic1,
31 Magic2,
32 Magic3,
33 Class,
34 Data,
35 Version,
36 OSABI,
37 ABIVersion,
38 Padding,
39 };

◆ ELFMachine

enum class MaxOS::processes::ELFMachine
strong

The target architecture of the ELF file.

Definition at line 79 of file elf.h.

79 {
80 NoMachine,
81 ATnTWe32100,
82 SPARC,
83 x86,
84 MIPS = 0x8,
85 PowerPC = 0x14,
86 ARM = 0x28,
87 SuperH = 0x2A,
88 IA_64 = 0x32,
89 x86_64 = 0x3E,
90 AArch64 = 0xB7,
91 RISC_V = 0xF3
92 };

◆ ELFProgramFlags

The flags of a program header in the ELF file.

Definition at line 149 of file elf.h.

149 {
150 ELFExecute = (1 << 0),
151 ELFWrite = (1 << 1),
152 ELFRead = (1 << 2)
153 };

◆ ELFProgramType

The type of a program header in the ELF file.

Definition at line 133 of file elf.h.

133 {
134 Null,
135 Load,
136 Dynamic,
137 Interpreter,
138 Note,
139 SharedLibrary,
140 HeaderTable,
141 TableProcessorSpecificLow = 0x70000000,
142 TableProcessorSpecificHigh = 0x7FFFFFFF
143 };

◆ ELFSectionType

The type of a section in the ELF file.

Definition at line 179 of file elf.h.

179 {
180 Null,
181 ProgramBits,
182 SymbolTable,
183 StringTable,
184 RelocationAddends,
185 SymbolHashTable,
186 DynamicLinkingTable,
187 SectionNote,
188 NoBits,
189 };

◆ ELFType

enum class MaxOS::processes::ELFType
strong

The type of the ELF file (executable, shared object, etc.)

Definition at line 65 of file elf.h.

65 {
66 None,
67 Relocatable,
68 Executable,
69 Shared,
70 Core,
71 ProcessorSpecificLow = 0xFF0,
72 ProcessorSpecificHigh = 0xFFF
73 };

◆ ELFVersion

enum class MaxOS::processes::ELFVersion
strong

The version of the ELF file.

Definition at line 98 of file elf.h.

98 {
99 Invalid,
100 Current
101 };

Variable Documentation

◆ ELF_MAGIC

constexpr char MaxOS::processes::ELF_MAGIC[4] = { 0x7F, 'E', 'L', 'F' }
constexpr

The expected ELF magic number at the start of the file.

Definition at line 22 of file elf.h.

22{ 0x7F, 'E', 'L', 'F' };

Referenced by MaxOS::processes::ELF64::is_valid().