MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / CheckElfMagic

Method CheckElfMagic

src/include/kernel_elf.hpp:132–138  ·  view source on GitHub ↗

* 检查 ELF magic number */

Source from the content-addressed store, hash-verified

130 * 检查 ELF magic number
131 */
132 [[nodiscard]] auto CheckElfMagic() const -> Expected<void> {
133 if ((elf_[EI_MAG0] != ELFMAG0) || (elf_[EI_MAG1] != ELFMAG1) ||
134 (elf_[EI_MAG2] != ELFMAG2) || (elf_[EI_MAG3] != ELFMAG3)) {
135 return std::unexpected(Error(ErrorCode::kElfInvalidMagic));
136 }
137 return {};
138 }
139
140 /**
141 * 检查 ELF class (32/64 bit)

Callers

nothing calls this directly

Calls 1

ErrorClass · 0.85

Tested by

no test coverage detected