kernel/elf.c
elf_status elf_init(elf_ctx *ctx, void *info) {
  ctx->info = info;

  // load the elf header
  if (elf_fpread(ctx, &ctx->ehdr, sizeof(ctx->ehdr), 0) != sizeof(ctx->ehdr)) return EL_EIO;

  // check the signature (magic value) of the elf
  if (ctx->ehdr.magic != ELF_MAGIC) return EL_NOTELF;

  return EL_OK;
}
//
// init elf_ctx, a data structure that loads the elf.
//
init elf_ctx, a data structure that loads the elf.
init elf_ctx a data structure that loads the elf .
elf_status elf_init(elf_ctx *ctx, void *info) {
  ctx->info = info;
  if (elf_fpread(ctx, &ctx->ehdr, sizeof(ctx->ehdr), 0) != sizeof(ctx->ehdr)) return EL_EIO;
  if (ctx->ehdr.magic != ELF_MAGIC) return EL_NOTELF;
  return EL_OK;
}
elf_status elf_init ( elf_ctx * ctx , void * info ) { ctx -> info = info ; if ( elf_fpread ( ctx , & ctx -> ehdr , sizeof ( ctx -> ehdr ) , 0 ) != sizeof ( ctx -> ehdr ) ) return EL_EIO ; if ( ctx -> ehdr . magic != ELF_MAGIC ) return EL_NOTELF ; return EL_OK ; }
init elf_ctx, a data structure that loads the elf.
init elf_ctx a data structure that loads the elf .
// load the elf header // check the signature (magic value) of the elf