mirror of
https://github.com/hexagonal-sun/moss-kernel.git
synced 2025-12-23 22:47:55 -05:00
clone: implement CLONE_SETTLS
Set the TLS pointer when `CLONE_SETTLS` is set in `sys_clone`.
This commit is contained in:
@@ -46,7 +46,7 @@ pub async fn sys_clone(
|
||||
newsp: UA,
|
||||
_arent_tidptr: UA,
|
||||
_child_tidptr: UA,
|
||||
_tls: usize,
|
||||
tls: usize,
|
||||
) -> Result<usize> {
|
||||
let flags = CloneFlags::from_bits_truncate(flags);
|
||||
|
||||
@@ -58,6 +58,11 @@ pub async fn sys_clone(
|
||||
// TODO: Make this arch indepdenant. The child returns '0' on clone.
|
||||
user_ctx.x[0] = 0;
|
||||
|
||||
if flags.contains(CloneFlags::CLONE_SETTLS) {
|
||||
// TODO: Make this arch indepdenant.
|
||||
user_ctx.tpid_el0 = tls as _;
|
||||
}
|
||||
|
||||
let (tg, tid) = if flags.contains(CloneFlags::CLONE_THREAD) {
|
||||
if !flags.contains(CloneFlags::CLONE_SIGHAND & CloneFlags::CLONE_VM) {
|
||||
// CLONE_THREAD requires both CLONE_SIGHAND and CLONE_VM to be
|
||||
|
||||
Reference in New Issue
Block a user