Merge branch 'master' into isa/arm64
[lunaix-os.git] / lunaix-os / includes / lunaix / exec.h
index 00f4d398b42fef007760b3257857e9e5a5fc4b6b..64e0f2dd681f9d6a8d9c4753ccc8747e89a4056b 100644 (file)
@@ -1,22 +1,19 @@
 #ifndef __LUNAIX_EXEC_H
 #define __LUNAIX_EXEC_H
 
-#include <lunaix/elf.h>
 #include <lunaix/fs.h>
 #include <lunaix/process.h>
 #include <lunaix/types.h>
 
-#define NO_LOADER 0
-#define DEFAULT_LOADER "usr/ld"
+#define MAX_PARAM_LEN    1024
+#define MAX_PARAM_SIZE   4096
 
 #define MAX_VAR_PAGES 8
 #define DEFAULT_HEAP_PAGES 16
 
-struct exec_context;
-
 struct load_context
 {
-    struct exec_container* container;
+    struct exec_host* container;
     ptr_t base;
     ptr_t end;
     ptr_t mem_sz;
@@ -24,15 +21,26 @@ struct load_context
     ptr_t entry;
 };
 
-struct exec_container
+struct exec_arrptr
+{
+    unsigned int len;
+    unsigned int size;
+    ptr_t raw;
+    ptr_t copied;
+};
+
+
+struct exec_host
 {
     struct proc_info* proc;
     ptr_t vms_mnt;
 
-    struct load_context executable;
+    struct load_context exe;
+
+    struct exec_arrptr argv;
+    struct exec_arrptr envp;
 
     ptr_t stack_top;
-    ptr_t entry; // mapped to one of {executable|loader}.entry
 
     int status;
 };
@@ -43,25 +51,25 @@ struct uexec_param
     char** argv;
     int envc;
     char** envp;
-} PACKED;
-
-#ifndef __USR_WRAPPER__
+} compact;
 
 int
-exec_load_byname(struct exec_container* container,
-                 const char* filename,
-                 const char** argv,
-                 const char** envp);
+exec_arch_prepare_entry(struct thread* thread, struct exec_host* container);
 
 int
-exec_load(struct exec_container* container,
-          struct v_file* executable,
-          const char** argv,
-          const char** envp);
+exec_load_byname(struct exec_host* container, const char* filename);
 
 int
-exec_kexecve(const char* filename, const char* argv[], const char* envp);
+exec_load(struct exec_host* container, struct v_file* executable);
 
-#endif
+int
+exec_kexecve(const char* filename, const char* argv[], const char* envp[]);
+
+void
+exec_init_container(struct exec_host* param,
+                    struct thread* thread,
+                    ptr_t vms,
+                    const char** argv,
+                    const char** envp);
 
 #endif /* __LUNAIX_LOADER_H */