* 检查 ELF class (32/64 bit) */
| 141 | * 检查 ELF class (32/64 bit) |
| 142 | */ |
| 143 | [[nodiscard]] auto CheckElfClass() const -> Expected<void> { |
| 144 | if (elf_[EI_CLASS] == ELFCLASS32) { |
| 145 | return std::unexpected(Error(ErrorCode::kElfUnsupported32Bit)); |
| 146 | } |
| 147 | if (elf_[EI_CLASS] != ELFCLASS64) { |
| 148 | return std::unexpected(Error(ErrorCode::kElfInvalidClass)); |
| 149 | } |
| 150 | return {}; |
| 151 | } |
| 152 | }; |
| 153 | |
| 154 | using KernelElfSingleton = etl::singleton<KernelElf>; |