git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: elf parsing utility and exec related
[lunaix-os.git]
/
lunaix-os
/
kernel
/
mm
/
mmap.c
diff --git
a/lunaix-os/kernel/mm/mmap.c
b/lunaix-os/kernel/mm/mmap.c
index f700fd533179d9528ff84191e6f14402d0f5eca2..8eb7482b60af4b3bf7686a8e478ae0f54f1c7f52 100644
(file)
--- a/
lunaix-os/kernel/mm/mmap.c
+++ b/
lunaix-os/kernel/mm/mmap.c
@@
-139,6
+139,15
@@
found:
return 0;
}
return 0;
}
+int
+mem_remap(void** addr_out,
+ struct mm_region** remapped,
+ void* addr,
+ struct v_file* file,
+ struct mmap_param* param)
+{
+}
+
void
mem_sync_pages(ptr_t mnt,
struct mm_region* region,
void
mem_sync_pages(ptr_t mnt,
struct mm_region* region,
@@
-288,24
+297,25
@@
__DEFINE_LXSYSCALL3(void*, sys_mmap, void*, addr, size_t, length, va_list, lst)
if (!addr) {
addr = UMMAP_START;
} else if (addr < UMMAP_START || addr + length >= UMMAP_END) {
if (!addr) {
addr = UMMAP_START;
} else if (addr < UMMAP_START || addr + length >= UMMAP_END) {
- errno = ENOMEM;
- goto done;
- }
-
- struct v_fd* vfd;
- if ((errno = vfs_getfd(fd, &vfd))) {
- goto done;
+ if (!(options & (MAP_FIXED | MAP_FIXED_NOREPLACE))) {
+ errno = ENOMEM;
+ goto done;
+ }
}
}
- struct v_file* file =
vfd->file
;
+ struct v_file* file =
NULL
;
if (!(options & MAP_ANON)) {
if (!(options & MAP_ANON)) {
+ struct v_fd* vfd;
+ if ((errno = vfs_getfd(fd, &vfd))) {
+ goto done;
+ }
+
+ file = vfd->file;
if (!file->ops->read_page) {
errno = ENODEV;
goto done;
}
if (!file->ops->read_page) {
errno = ENODEV;
goto done;
}
- } else {
- file = NULL;
}
struct mmap_param param = { .flags = options,
}
struct mmap_param param = { .flags = options,