diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 11:37:01 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 11:40:58 +0100 |
commit | fdbd9f1e272b97d7d28f9f610be8fbf0bdbd98d9 (patch) | |
tree | 5caafbf80252f8116a6921d7498d5d56a21481fb /LibC/mman.cpp | |
parent | 41a751c90c9d39db764308aeba476db593b9b6e1 (diff) | |
download | serenity-fdbd9f1e272b97d7d28f9f610be8fbf0bdbd98d9.zip |
Start working on memory-mapped files.
First of all, change sys$mmap to take a struct SC_mmap_params since our
sycsall calling convention can't handle more than 3 arguments.
This exposed a bug in Syscall::invoke() needing to use clobber lists.
It was a bit confusing to debug. :^)
Diffstat (limited to 'LibC/mman.cpp')
-rw-r--r-- | LibC/mman.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/LibC/mman.cpp b/LibC/mman.cpp index 5e13e8e268..ff01378aae 100644 --- a/LibC/mman.cpp +++ b/LibC/mman.cpp @@ -1,12 +1,14 @@ -#include "mman.h" -#include "errno.h" +#include <mman.h> +#include <errno.h> +#include <stdio.h> #include <Kernel/Syscall.h> extern "C" { -void* mmap(void* addr, size_t size) +void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset) { - int rc = Syscall::invoke(Syscall::SC_mmap, (dword)addr, (dword)size); + Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset }; + int rc = Syscall::invoke(Syscall::SC_mmap, (dword)¶ms); __RETURN_WITH_ERRNO(rc, (void*)rc, (void*)-1); } |