feat: heap support and re-worked
[lunaix-os.git] / lunaix-os / includes / lunaix / ld.h
1 #ifndef __LUNAIX_LOADER_H
2 #define __LUNAIX_LOADER_H
3
4 #include <lunaix/elf.h>
5 #include <lunaix/process.h>
6 #include <lunaix/types.h>
7
8 #define LD_STAT_FKUP 0x1U
9
10 #define MAX_VAR_PAGES 8
11 #define DEFAULT_HEAP_PAGES 16
12
13 struct ld_info
14 {
15     struct elf32_ehdr ehdr_out;
16     ptr_t base;
17     ptr_t end;
18     ptr_t mem_sz;
19 };
20
21 struct ld_param
22 {
23     struct proc_info* proc;
24     ptr_t vms_mnt;
25
26     struct ld_info info;
27     int status;
28 };
29
30 struct usr_exec_param
31 {
32     int argc;
33     char** argv;
34     int envc;
35     char** envp;
36     struct ld_info info;
37 } PACKED;
38
39 #ifndef __USR_WRAPPER__
40 int
41 elf_load(struct ld_param* ldparam, struct v_file* elfile);
42
43 void
44 ld_create_param(struct ld_param* param, struct proc_info* proc, ptr_t vms);
45 #endif
46
47 #endif /* __LUNAIX_LOADER_H */