rewrite the device subsystem interfaces (#48)
[lunaix-os.git] / lunaix-os / arch / x86 / exec / exec.c
1 #include <lunaix/exec.h>
2 #include <lunaix/mm/valloc.h>
3 #include <klibc/string.h>
4
5 int
6 exec_arch_prepare_entry(struct thread* thread, struct exec_host* container)
7 {
8     struct hart_state* hstate;
9
10     hstate = thread->hstate;
11
12 #ifdef CONFIG_ARCH_X86_64
13     hstate->execp->rip = container->exe.entry;
14     hstate->execp->rsp = container->stack_top;
15
16 #else
17     hstate->execp->eip = container->exe.entry;
18     hstate->execp->esp = container->stack_top;
19
20 #endif
21
22     return 0;
23 }