GNU/Linux: Clear TP.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka
2021-02-12 09:07:06 +09:00
parent 0698bc4c9e
commit 91ddc8fd02
2 changed files with 6 additions and 1 deletions

View File

@@ -1,3 +1,7 @@
2021-02-12 NIIBE Yutaka <gniibe@fsij.org>
* chopstx-gnu-linux.c (chopstx_create_arch): Clear TP.
2019-12-30 NIIBE Yutaka <gniibe@fsij.org> 2019-12-30 NIIBE Yutaka <gniibe@fsij.org>
* VERSION: 1.18. * VERSION: 1.18.

View File

@@ -2,7 +2,7 @@
* chopstx-gnu-linux.c - Threads and only threads: Arch specific code * chopstx-gnu-linux.c - Threads and only threads: Arch specific code
* for GNU/Linux emulation * for GNU/Linux emulation
* *
* Copyright (C) 2017, 2018, 2019 Flying Stone Technology * Copyright (C) 2017, 2018, 2019, 2021 Flying Stone Technology
* Author: NIIBE Yutaka <gniibe@fsij.org> * Author: NIIBE Yutaka <gniibe@fsij.org>
* *
* This file is a part of Chopstx, a thread library for embedded. * This file is a part of Chopstx, a thread library for embedded.
@@ -349,6 +349,7 @@ chopstx_create_arch (uintptr_t stack_addr, size_t stack_size,
* signal blocked. The sigmask will be cleared in chx_thread_start. * signal blocked. The sigmask will be cleared in chx_thread_start.
*/ */
chx_cpu_sched_lock (); chx_cpu_sched_lock ();
memset (tp, 0, sizeof (struct chx_thread));
getcontext (&tp->tc); getcontext (&tp->tc);
tp->tc.uc_stack.ss_sp = (void *)stack_addr; tp->tc.uc_stack.ss_sp = (void *)stack_addr;
tp->tc.uc_stack.ss_size = stack_size; tp->tc.uc_stack.ss_size = stack_size;