mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibC: mmap() should not interpret high addresses as errors, oops!
This commit is contained in:
parent
c3d36a5fe9
commit
0b1b21d622
1 changed files with 5 additions and 1 deletions
|
@ -9,7 +9,11 @@ void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
||||||
{
|
{
|
||||||
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset };
|
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset };
|
||||||
int rc = syscall(SC_mmap, ¶ms);
|
int rc = syscall(SC_mmap, ¶ms);
|
||||||
__RETURN_WITH_ERRNO(rc, (void*)rc, (void*)-1);
|
if (rc < 0 && -rc < EMAXERRNO) {
|
||||||
|
errno = -rc;
|
||||||
|
return (void*)-1;
|
||||||
|
}
|
||||||
|
return (void*)rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int munmap(void* addr, size_t size)
|
int munmap(void* addr, size_t size)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue