From fdbd9f1e272b97d7d28f9f610be8fbf0bdbd98d9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 8 Nov 2018 11:37:01 +0100 Subject: 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. :^) --- LibC/mman.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'LibC/mman.cpp') 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 +#include +#include #include 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); } -- cgit v1.2.3