feat: closedir(2)
[lunaix-os.git] / lunaix-os / includes / lunaix / ld.h
index 88114f5fab6679e16ff3397898cc6f7d5fd48a80..690f95fb616e87ad9100af753a341aca381a5e67 100644 (file)
@@ -1,25 +1,62 @@
 #ifndef __LUNAIX_LOADER_H
 #define __LUNAIX_LOADER_H
 
+#include <lunaix/elf.h>
 #include <lunaix/process.h>
 #include <lunaix/types.h>
 
 #define LD_STAT_FKUP 0x1U
 
 #define MAX_VAR_PAGES 8
+#define DEFAULT_HEAP_PAGES 16
+
+struct ld_info
+{
+    struct elf32_ehdr ehdr_out;
+    ptr_t base;
+    ptr_t end;
+    ptr_t mem_sz;
+
+    ptr_t stack_top;
+    ptr_t entry;
+};
 
 struct ld_param
 {
     struct proc_info* proc;
     ptr_t vms_mnt;
-    struct elf32_ehdr ehdr_out;
+
+    struct ld_info info;
     int status;
 };
 
+struct usr_exec_param
+{
+    int argc;
+    char** argv;
+    int envc;
+    char** envp;
+    struct ld_info info;
+} PACKED;
+
+#ifndef __USR_WRAPPER__
 int
 elf_load(struct ld_param* ldparam, struct v_file* elfile);
 
+int
+exec_load_byname(struct ld_param* param,
+                 const char* filename,
+                 const char** argv,
+                 const char** envp);
+
+int
+exec_load(struct ld_param* param,
+          struct v_file* executable,
+          const char** argv,
+          const char** envp);
+
 void
 ld_create_param(struct ld_param* param, struct proc_info* proc, ptr_t vms);
+#endif
 
 #endif /* __LUNAIX_LOADER_H */