diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-11-02 19:02:45 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-11-02 19:02:45 +0200 |
| commit | 30379c499745c083e7621f88e5fbaaa7a8215bc4 (patch) | |
| tree | a8483e65e374892a9613fe9f9d2200e73480992e | |
| parent | 5890df7bf838a5a912465a1bba02e5d8cf34e33c (diff) | |
| download | kmi-30379c499745c083e7621f88e5fbaaa7a8215bc4.tar.gz kmi-30379c499745c083e7621f88e5fbaaa7a8215bc4.zip | |
update elf docs
| -rw-r--r-- | src/elf.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -33,6 +33,17 @@ static uint8_t __elf_to_uvflags(uint8_t elf_flags) return uvflags; } +/** + * Helper for actually copying ELF data into memory. + * + * @param t Process whose virtual memory to work in. + * @param va Virtual address to where we should write things. + * @param vaz Size of section in virtual memory. + * @param vf Address of ELF section from where to read things. + * @param vfz Size of section in file. + * @param flags Flags to use for section mapping. + * @return OK. + */ static stat_t __elf_map_section(struct tcb *t, vm_t va, size_t vaz, vm_t vf, size_t vfz, @@ -80,7 +91,7 @@ static stat_t __elf_map_section(struct tcb *t, * @param phstart Program header start. * @param phnum Number of program header entries. * @param phsize Size of page header entry. - * @param OK on success, something else otherwise. + * @return OK on success, something else otherwise. */ static stat_t __map_exec(struct tcb *t, vm_t bin, @@ -91,7 +102,10 @@ static stat_t __map_exec(struct tcb *t, { assert(t && is_proc(t)); - /* create empty vmem so we don't have to worry about possible overlaps */ + /* create empty vmem to work in, allows us to build a new 'copy' + * with the required ELF sections mapped. On success, we can just + * swap out the wanted vmem for the new one, and on error, just + * delete the working vmem. */ struct vmem *new_vmem = create_vmem(); if (!new_vmem) return ERR_OOMEM; |
