# SPDX-License-Identifier: LSL-1.0
# Copyright (c) 2026 Markus Maiwald
# Stewardship: Self Sovereign Society Foundation
#
# This file is part of the Nexus Sovereign Core.
# See legal/LICENSE_SOVEREIGN.md for license terms.

## Rumpk Layer 1: ELF Binary Parser

# MARKUS MAIWALD (ARCHITECT) | VOXIS FORGE (AI)
# ELF64 Header Definitions for Rumpk Summoning

type
  Elf64_Ehdr* {.packed.} = object
    e_ident*: array[16, uint8]
    e_type*: uint16
    e_machine*: uint16
    e_version*: uint32
    e_entry*: uint64
    e_phoff*: uint64
    e_shoff*: uint64
    e_flags*: uint32
    e_ehsize*: uint16
    e_phentsize*: uint16
    e_phnum*: uint16
    e_shentsize*: uint16
    e_shnum*: uint16
    e_shstrndx*: uint16

  Elf64_Phdr* {.packed.} = object
    p_type*: uint32
    p_flags*: uint32
    p_offset*: uint64
    p_vaddr*: uint64
    p_paddr*: uint64
    p_filesz*: uint64
    p_memsz*: uint64
    p_align*: uint64

const
  PT_LOAD* = 1
  PF_X* = 1
  PF_W* = 2
  PF_R* = 4
