Kernel/LibC: add mmap for private anonymous mappings

This will be used by the userspace to get more memory. Currently
kernel handles all allocations, which is not preferable.
This commit is contained in:
Bananymous
2023-09-22 15:41:05 +03:00
parent 4818c6e3dd
commit fee3677fb9
7 changed files with 117 additions and 0 deletions

View File

@@ -46,6 +46,16 @@ struct posix_typed_mem_info
size_t posix_tmi_length; /* Maximum length which may be allocated from a typed memory object. */
};
struct sys_mmap_t
{
void* addr;
size_t len;
int prot;
int flags;
int fildes;
off_t off;
};
int mlock(const void* addr, size_t len);
int mlockall(int flags);
void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off);

View File

@@ -55,6 +55,8 @@ __BEGIN_DECLS
#define SYS_FSTATAT 48
#define SYS_STAT 49 // stat/lstat
#define SYS_SYNC 50
#define SYS_MMAP 51
#define SYS_MUNMAP 52
__END_DECLS