1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

Kernel: Support TLS allocation from userspace

This adds an allocate_tls syscall through which a userspace process
can request the allocation of a TLS region with a given size.

This will be used by the dynamic loader to allocate TLS for the main
executable & its libraries.
This commit is contained in:
Itamar 2020-10-10 12:17:07 +03:00 committed by Andreas Kling
parent 5b87904ab5
commit 9ca1a0731f
5 changed files with 57 additions and 1 deletions

View file

@ -87,4 +87,14 @@ int minherit(void* address, size_t size, int inherit)
int rc = syscall(SC_minherit, address, size, inherit);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
void* allocate_tls(size_t size)
{
int rc = syscall(SC_allocate_tls, size);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
return MAP_FAILED;
}
return (void*)rc;
}
}