kernel/fs/exec.c
// Remove KExecImage, KExec,
// Remove Exec, replace with fuction to close on exec handles and housekeeping/reseting signal handlers.
// 
// Bootloader loads IFS.exe segments into physmem at boot.
// Similarly for linker-loader
//
// Bootloader passes vaddr/paddr for sections to kernel, inc entry points.
// Kernel starts IFS.exe
// 
// Loader configured to map to top of user-address space.
// Could be in shared library area?
//
// Root is IFS image.
// Root forks to create real IFS process.
// Root waits for /dev/ifs to mount.
// Root execs root.exe
Remove KExecImage, KExec,
Remove Exec, replace with fuction to close on exec handles and housekeeping/reseting signal handlers.

Bootloader loads IFS.exe segments into physmem at boot.
Similarly for linker-loader

Bootloader passes vaddr/paddr for sections to kernel, inc entry points.

Loader configured to map to top of user-address space.

Root is IFS image.
Root forks to create real IFS process.
Root waits for /dev/ifs to mount.
Remove KExecImage KExec Remove Exec replace with fuction to close on exec handles and housekeeping / reseting signal handlers . Bootloader loads IFS . exe segments into physmem at boot . Similarly for linker - loader Bootloader passes vaddr / paddr for sections to kernel inc entry points . Loader configured to map to top of user - address space . Root is IFS image . Root forks to create real IFS process . Root waits for / dev / ifs to mount .
int KExecImage(void *image, struct execargs *_args) {
  void *entry_point;
  void *stack_pointer;
  void *stack_base;
  struct Process *current;
  struct execargs args;
  struct ExecInfo ei;
  Info ("KExecImage");
  ei.src_is_image = TRUE;
  ei.image = image;
  current = GetCurrentProcess();
  if (CheckELFHeaders(&ei) != 0) {
    Info ("Check headers failed");
    return -ENOEXEC;
  }
  if (CopyInArgv(&args, _args, TRUE) != 0) {
    Info ("CopyInArgv failed");
    return -ENOMEM;
  }
  if (LoadProcess(current, &ei, &entry_point) != 0) {
    Info ("KLoadProcess failed");
    ReleaseExecArgs();
    Exit(-1); 
    return 0;
  }
  if ((stack_base = VirtualAlloc((void *)0x30000000, USER_STACK_SZ, PROT_READWRITE)) == NULL) {
    ReleaseExecArgs();
    Info ("Failed to allocate stack");
    Exit(-1); 
    return 0;
  }
  CopyOutArgv(stack_base, USER_STACK_SZ, &args);
  stack_pointer =
      stack_base + USER_STACK_SZ - ALIGN_UP(args.total_size, 16) - 16;
  ReleaseExecArgs();
  ArchInitExec(current, entry_point, stack_pointer, &args);
  return 0;
}
int KExecImage ( void * image , struct execargs * _args ) { void * entry_point ; void * stack_pointer ; void * stack_base ; struct Process * current ; struct execargs args ; struct ExecInfo ei ; Info ( " " ) ; ei . src_is_image = TRUE ; ei . image = image ; current = GetCurrentProcess ( ) ; if ( CheckELFHeaders ( & ei ) != 0 ) { Info ( " " ) ; return - ENOEXEC ; } if ( CopyInArgv ( & args , _args , TRUE ) != 0 ) { Info ( " " ) ; return - ENOMEM ; } if ( LoadProcess ( current , & ei , & entry_point ) != 0 ) { Info ( " " ) ; ReleaseExecArgs ( ) ; Exit ( -1 ) ; return 0 ; } if ( ( stack_base = VirtualAlloc ( ( void * ) 0x30000000 , USER_STACK_SZ , PROT_READWRITE ) ) == NULL ) { ReleaseExecArgs ( ) ; Info ( " " ) ; Exit ( -1 ) ; return 0 ; } CopyOutArgv ( stack_base , USER_STACK_SZ , & args ) ; stack_pointer = stack_base + USER_STACK_SZ - ALIGN_UP ( args . total_size , 16 ) - 16 ; ReleaseExecArgs ( ) ; ArchInitExec ( current , entry_point , stack_pointer , & args ) ; return 0 ; }
Remove KExecImage, KExec,
Remove Exec, replace with fuction to close on exec handles and housekeeping/reseting signal handlers.
Remove KExecImage KExec Remove Exec replace with fuction to close on exec handles and housekeeping / reseting signal handlers .
//  CleanupAddressSpace(&current->as); // no return // TODO: Free process // no return //  Info("KExecImage Stack = %08x, sp = %08x", (vm_addr)stack_base, (vm_addr)stack_pointer); //  Info ("KExecImage ReleaseExecArgs done"); //  Info ("---- About to ArchInitExec ----- ");  