diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-12-29 18:47:16 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-12-29 18:49:28 +0200 |
| commit | 4e5595a089c815febd7a0d42ab62940bf13f73ac (patch) | |
| tree | 322f35d9315e9966de8a66052811858df0144085 /common/proc.c | |
| parent | a12e50e5a7dae52ed8bd5a24cc6576371e20985b (diff) | |
| download | kmi-4e5595a089c815febd7a0d42ab62940bf13f73ac.tar.gz kmi-4e5595a089c815febd7a0d42ab62940bf13f73ac.zip | |
Preparations for refactoring
Diffstat (limited to 'common/proc.c')
| -rw-r--r-- | common/proc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/proc.c b/common/proc.c new file mode 100644 index 0000000..5fdf413 --- /dev/null +++ b/common/proc.c @@ -0,0 +1,16 @@ +#include <apos/proc.h> + +/* TODO: add error checking */ +vm_t setup_call_stack(struct tcb *t, vm_t start, size_t bytes) +{ + pm_t offset = 0; + size_t pages = __pages(bytes); + uint8_t flags = VM_V | VM_R | VM_W | VM_U; + for(size_t i = 0; i < pages; ++i) + { + offset = alloc_page(BASE_PAGE, offset); + map_vmem(t->b_r, offset, start + BASE_PAGE_SIZE * i, flags, BASE_PAGE); + } + + return start; +} |
