diff --git a/lib/libc/arch/i386/gen/_lwp.c b/lib/libc/arch/i386/gen/_lwp.c index a8b486d5fe7ba..7cc11bab4b8a6 100644 --- a/lib/libc/arch/i386/gen/_lwp.c +++ b/lib/libc/arch/i386/gen/_lwp.c @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.8 2012/08/31 20:57:24 drochner Exp $ */ +/* $NetBSD: _lwp.c,v 1.9 2023/04/02 07:26:17 skrll Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _lwp.c,v 1.8 2012/08/31 20:57:24 drochner Exp $"); +__RCSID("$NetBSD: _lwp.c,v 1.9 2023/04/02 07:26:17 skrll Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -55,14 +55,14 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), /* LINTED uintptr_t is safe */ u->uc_mcontext.__gregs[_REG_EIP] = (uintptr_t)start; - + /* Align to a 16-byte boundary for SSE */ /* LINTED uintptr_t is safe */ sp = (void **) (((uintptr_t)(stack_base + stack_size - 4) & ~0xf) + 4); - + *--sp = arg; *--sp = (void *) _lwp_exit; - + /* LINTED uintptr_t is safe */ u->uc_mcontext.__gregs[_REG_UESP] = (uintptr_t) sp; diff --git a/lib/libc/arch/m68k/gen/_lwp.c b/lib/libc/arch/m68k/gen/_lwp.c index ce0e16d47b039..56fb09ccab662 100644 --- a/lib/libc/arch/m68k/gen/_lwp.c +++ b/lib/libc/arch/m68k/gen/_lwp.c @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.8 2012/03/18 16:26:34 christos Exp $ */ +/* $NetBSD: _lwp.c,v 1.9 2023/04/02 07:26:17 skrll Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _lwp.c,v 1.8 2012/03/18 16:26:34 christos Exp $"); +__RCSID("$NetBSD: _lwp.c,v 1.9 2023/04/02 07:26:17 skrll Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -54,9 +54,9 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), u->uc_stack.ss_size = stack_size; u->uc_mcontext.__gregs[_REG_PC] = (int)start; - + sp = (void **)(void *)(stack_base + stack_size); - + *--sp = arg; *--sp = (void *) _lwp_exit; diff --git a/lib/libc/arch/vax/gen/_lwp.c b/lib/libc/arch/vax/gen/_lwp.c index 94d710bc69f78..e9d9a1ab729be 100644 --- a/lib/libc/arch/vax/gen/_lwp.c +++ b/lib/libc/arch/vax/gen/_lwp.c @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.3 2012/03/22 17:32:22 christos Exp $ */ +/* $NetBSD: _lwp.c,v 1.4 2023/04/02 07:26:18 skrll Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _lwp.c,v 1.3 2012/03/22 17:32:22 christos Exp $"); +__RCSID("$NetBSD: _lwp.c,v 1.4 2023/04/02 07:26:18 skrll Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,7 +57,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), /* Align to a word */ /* LINTED uintptr_t is safe */ sp = (int *)((uintptr_t)(stack_base + stack_size) & ~0x3); - + /* * Allocate necessary stack space for arguments including arg count * and call frame @@ -71,7 +71,7 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), sp[4] = (int)(uintptr_t)_lwp_exit + 2;/* return via _lwp_exit */ sp[5] = 1; /* argc */ sp[6] = (int)(uintptr_t)arg; /* argv */ - + gr[_REG_AP] = (__greg_t)(uintptr_t)(sp + 5); gr[_REG_SP] = (__greg_t)(uintptr_t)sp; gr[_REG_FP] = (__greg_t)(uintptr_t)sp; diff --git a/lib/libc/arch/x86_64/gen/_lwp.c b/lib/libc/arch/x86_64/gen/_lwp.c index b8c9f9b97a0b8..368fb2a6ed6e9 100644 --- a/lib/libc/arch/x86_64/gen/_lwp.c +++ b/lib/libc/arch/x86_64/gen/_lwp.c @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.7 2011/02/24 04:28:43 joerg Exp $ */ +/* $NetBSD: _lwp.c,v 1.8 2023/04/02 07:26:18 skrll Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _lwp.c,v 1.7 2011/02/24 04:28:43 joerg Exp $"); +__RCSID("$NetBSD: _lwp.c,v 1.8 2023/04/02 07:26:18 skrll Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -56,13 +56,13 @@ _lwp_makecontext(ucontext_t *u, void (*start)(void *), /* LINTED uintptr_t is safe */ gr[_REG_RIP] = (uintptr_t)start; - + sp = (void **) (((uintptr_t)(stack_base + stack_size) & ~15)); /* LINTED __greg_t is safe */ gr[_REG_RDI] = (__greg_t)arg; *--sp = (void *) _lwp_exit; - + /* LINTED uintptr_t is safe */ gr[_REG_URSP] = (uintptr_t) sp;