Merge branch 'errno' of github.com:apache/incubator-nuttx into errno

This commit is contained in:
Gregory Nutt
2020-05-07 16:25:13 -06:00
102 changed files with 497 additions and 1358 deletions
+4 -4
View File
@@ -177,9 +177,9 @@ o Task/Scheduler (sched/)
Description: In NuttX, the errno value is unique for each thread. But for
bug-for-bug compatibility, the same errno should be shared by
the task and each thread that it creates. It is *very* easy
to make this change: Just move the pterrno field from
struct tcb_s to struct task_group_s. However, I am still not
sure if this should be done or not.
to make this change: Just move the tls_errno field from
struct tls_info_s to struct task_group_s. However, I am still
not sure if this should be done or not.
NOTE: glibc behaves this way unless __thread is defined then,
in that case, it behaves like NuttX (using TLS to save the
thread local errno).
@@ -1029,7 +1029,7 @@ o Kernel/Protected Build
would not be an issue in the more general case.
Update:
One solution might be to used CONFIG_TLS, add the PID to struct
One solution might be to use TLS, add the PID to struct
tls_info_s. Then the PID could be obtained without a system call.
TLS is not very useful in the FLAT build, however. TLS works by
putting per-thread data at the bottom of an aligned stack. The
-2
View File
@@ -10,7 +10,6 @@ choice
config ARCH_ARM
bool "ARM"
select ARCH_HAVE_INTERRUPTSTACK
select ARCH_HAVE_TLS
select ARCH_HAVE_VFORK
select ARCH_HAVE_STACKCHECK
select ARCH_HAVE_CUSTOMOPT
@@ -68,7 +67,6 @@ config ARCH_SIM
bool "Simulation"
select ARCH_HAVE_MULTICPU
select ARCH_HAVE_RTC_SUBSECONDS
select ARCH_HAVE_TLS
select ARCH_HAVE_TICKLESS
select ARCH_HAVE_POWEROFF
select ARCH_HAVE_TESTSET
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -92,5 +90,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_ARM_INCLUDE_TLS_H */
+14 -30
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/arm/src/arm/arm_sigdeliver.c
*
* Copyright (C) 2007-2010, 2015, 2018-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -77,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -108,7 +92,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+2 -2
View File
@@ -81,7 +81,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -112,7 +112,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+14 -30
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/arm/src/armv7-a/arm_sigdeliver.c
*
* Copyright (C) 2013, 2015-2016, 2018-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -77,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -159,7 +143,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+2 -2
View File
@@ -61,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -147,7 +147,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+14 -29
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/arm/src/armv7-r/arm_sigdeliver.c
*
* Copyright (C) 2015, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -76,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +92,7 @@ void arm_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+2 -2
View File
@@ -61,7 +61,7 @@ void arm_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -147,7 +147,7 @@ void arm_sigdeliver(void)
/* Restore the saved errno value */
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+1
View File
@@ -108,6 +108,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
UNUSED(int_stack);
start = alloc & ~3;
#endif
end = (alloc + size + 3) & ~3;
/* Get the adjusted size based on the top and bottom of the stack */
+1 -15
View File
@@ -102,7 +102,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -117,7 +116,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -190,7 +188,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
if (tcb->stack_alloc_ptr)
{
#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
#if defined(CONFIG_STACK_COLORATION)
uintptr_t stack_base;
#endif
size_t top_of_stack;
@@ -224,7 +222,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -242,17 +239,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
arm_stack_color((FAR void *)stack_base, stack_size);
#endif /* CONFIG_STACK_COLORATION */
#else /* CONFIG_TLS */
#ifdef CONFIG_STACK_COLORATION
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
arm_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif /* CONFIG_STACK_COLORATION */
#endif /* CONFIG_TLS */
board_autoled_on(LED_STACKCREATED);
return OK;
-6
View File
@@ -137,24 +137,18 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
#ifdef CONFIG_STACK_COLORATION
/* If stack debug is enabled, then fill the stack with a recognizable
* value that we can use later to test for high water marks.
*/
#ifdef CONFIG_TLS
arm_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s)),
tcb->adj_stack_size - sizeof(struct tls_info_s));
#else
arm_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif
#endif
return OK;
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_AVR_INCLUDE_TLS_H */
+1 -4
View File
@@ -101,7 +101,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -116,7 +115,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -139,6 +137,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* then create a zeroed stack to make stack dumps easier to trace.
* If TLS is enabled, then we must allocate aligned stacks.
*/
#ifdef CONFIG_TLS_ALIGNED
#ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */
@@ -212,11 +211,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (FAR void *)top_of_stack;
tcb->adj_stack_size = stack_size;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
#if defined(ARCH_HAVE_LEDS)
board_autoled_on(LED_STACKCREATED);
+25 -38
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/avr/src/avr/up_sigdeliver.c
*
* Copyright (C) 2011, 2015, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -72,10 +57,11 @@ void up_sigdeliver(void)
uint8_t regs[XCPTCONTEXT_REGS];
/* Save the errno. This must be preserved throughout the signal handling
* so that the user code final gets the correct errno value (probably EINTR).
* so that the user code final gets the correct errno value (probably
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -106,7 +92,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
@@ -130,17 +116,18 @@ void up_sigdeliver(void)
* unusual case that must be handled by up_fullcontextresore. This case is
* unusual in two ways:
*
* 1. It is not a context switch between threads. Rather, up_fullcontextrestore
* must behave more it more like a longjmp within the same task, using
* he same stack.
* 1. It is not a context switch between threads. Rather,
* up_fullcontextrestore must behave more it more like a longjmp
* within the same task, using the same stack.
* 2. In this case, up_fullcontextrestore is called with r12 pointing to
* a register save area on the stack to be destroyed. This is
* dangerous because there is the very real possibility that the new
* stack pointer might overlap with the register save area and hat stack
* usage in up_fullcontextrestore might corrupt the register save data
* before the state is restored. At present, there does not appear to
* be any stack overlap problems. If there were, then adding 3 words
* to the size of register save structure size will protect its contents.
* stack pointer might overlap with the register save area and that
* stack usage in up_fullcontextrestore might corrupt the register
* save data before the state is restored. At present, there does
* not appear to be any stack overlap problems. If there were, then
* adding 3 words to the size of register save structure size will
* protect its contents.
*/
board_autoled_off(LED_SIGNAL);
-2
View File
@@ -135,11 +135,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (FAR void *)top_of_stack;
tcb->adj_stack_size = stack_size;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
-4
View File
@@ -106,7 +106,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -121,7 +120,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -226,11 +224,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (FAR void *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
+26 -39
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/avr/src/avr32/up_sigdeliver.c
*
* Copyright (C) 2010, 2015, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -70,16 +55,17 @@ void up_sigdeliver(void)
{
struct tcb_s *rtcb = this_task();
#if 0
uint32_t regs[XCPTCONTEXT_REGS+3]; /* Why +3? See below */
uint32_t regs[XCPTCONTEXT_REGS + 3]; /* Why +3? See below */
#else
uint32_t regs[XCPTCONTEXT_REGS];
#endif
/* Save the errno. This must be preserved throughout the signal handling
* so that the user code final gets the correct errno value (probably EINTR).
* so that the user code final gets the correct errno value (probably
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -110,7 +96,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
@@ -130,17 +116,18 @@ void up_sigdeliver(void)
* unusual case that must be handled by up_fullcontextresore. This case is
* unusual in two ways:
*
* 1. It is not a context switch between threads. Rather, up_fullcontextrestore
* must behave more it more like a longjmp within the same task, using
* he same stack.
* 1. It is not a context switch between threads. Rather,
* up_fullcontextrestore must behave more it more like a longjmp
* within the same task, using the same stack.
* 2. In this case, up_fullcontextrestore is called with r12 pointing to
* a register save area on the stack to be destroyed. This is
* dangerous because there is the very real possibility that the new
* stack pointer might overlap with the register save area and hat stack
* usage in up_fullcontextrestore might corrupt the register save data
* before the state is restored. At present, there does not appear to
* be any stack overlap problems. If there were, then adding 3 words
* to the size of register save structure size will protect its contents.
* stack pointer might overlap with the register save area and that
* stack usage in up_fullcontextrestore might corrupt the register
* save data before the state is restored. At present, there does
* not appear to be any stack overlap problems. If there were, then
* adding 3 words to the size of register save structure size will
* protect its contents.
*/
board_autoled_off(LED_SIGNAL);
-2
View File
@@ -144,11 +144,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (FAR void *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -89,5 +87,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_HC_INCLUDE_TLS_H */
-4
View File
@@ -103,7 +103,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -118,7 +117,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -225,11 +223,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
-2
View File
@@ -135,11 +135,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -89,5 +87,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_MIPS_INCLUDE_TLS_H */
-4
View File
@@ -124,7 +124,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -139,7 +138,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -252,11 +250,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
-2
View File
@@ -161,11 +161,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
+14 -29
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/mips/src/mips32/mips_sigdeliver.c
*
* Copyright (C) 2011, 2015, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -77,7 +62,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -110,7 +95,7 @@ void up_sigdeliver(void)
regs[REG_EPC], regs[REG_STATUS]);
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -87,5 +85,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_MISOC_INCLUDE_TLS_H */
-4
View File
@@ -124,7 +124,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -139,7 +138,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -245,11 +243,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (FAR uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
+16 -30
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_sigdeliver.c
*
* Copyright (C) 2016, 2018-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -76,7 +61,7 @@ void lm32_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -105,10 +90,11 @@ void lm32_sigdeliver(void)
* errno that is needed by the user logic (it is probably EINTR).
*/
sinfo("Resuming EPC: %08x INT_CTX: %08x\n", regs[REG_EPC], regs[REG_INT_CTX]);
sinfo("Resuming EPC: %08x INT_CTX: %08x\n",
regs[REG_EPC], regs[REG_INT_CTX]);
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
@@ -116,7 +116,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -131,7 +130,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -238,11 +236,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (FAR uint32_t *) top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
+20 -34
View File
@@ -1,35 +1,20 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_sigdeliver.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -73,11 +58,12 @@ void minerva_sigdeliver(void)
uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the signal handling so
* that the user code final gets the correct errno value (probably EINTR).
/* Save the errno. This must be preserved throughout the signal handling
* so that the user code final gets the correct errno value (probably
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -111,16 +97,16 @@ void minerva_sigdeliver(void)
sigdeliver(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may alter
* errno), then disable interrupts again and restore the original errno that
* is needed by the user logic (it is probably EINTR).
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
* errno that is needed by the user logic (it is probably EINTR).
*/
sinfo("Resuming EPC: %08x INT_CTX: %08x\n", regs[REG_CSR_MEPC],
regs[REG_CSR_MSTATUS]);
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Then restore the correct state for this thread of execution. */
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -91,5 +89,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_OR1K_INCLUDE_TLS_H */
+2 -1
View File
@@ -97,7 +97,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
/* Get aligned addresses of the top and bottom of the stack */
#ifdef CONFIG_TLS
#ifdef CONFIG_TLS_ALIGNED
if (!int_stack)
{
/* Skip over the TLS data structure at the bottom of the stack */
@@ -113,6 +113,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
UNUSED(int_stack);
start = alloc & ~3;
#endif
end = (alloc + size + 3) & ~3;
/* Get the adjusted size based on the top and bottom of the stack */
+1 -15
View File
@@ -117,7 +117,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -132,7 +131,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -205,7 +203,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
if (tcb->stack_alloc_ptr)
{
#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
#if defined(CONFIG_STACK_COLORATION)
uintptr_t stack_base;
#endif
size_t top_of_stack;
@@ -220,7 +218,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -238,17 +235,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
up_stack_color((FAR void *)stack_base, stack_size);
#endif /* CONFIG_STACK_COLORATION */
#else /* CONFIG_TLS */
#ifdef CONFIG_STACK_COLORATION
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif /* CONFIG_STACK_COLORATION */
#endif /* CONFIG_TLS */
board_autoled_on(LED_STACKCREATED);
return OK;
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_RENESAS_INCLUDE_TLS_H */
-4
View File
@@ -103,7 +103,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -118,7 +117,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -225,11 +223,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
board_autoled_on(LED_STACKCREATED);
return OK;
-2
View File
@@ -134,11 +134,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
+14 -30
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/renesas/src/m16c/m16c_sigdeliver.c
*
* Copyright (C) 2009-2010, 2015, 2018-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -76,7 +60,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +91,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+2 -2
View File
@@ -77,7 +77,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -119,7 +119,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Then restore the correct state for this thread of
* execution.
+14 -30
View File
@@ -1,36 +1,20 @@
/****************************************************************************
* arch/renesas/src/common/up_sigdeliver.c
*
* Copyright (C) 2008-2010, 2015, 2018-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* http://www.apache.org/licenses/LICENSE-2.0
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
@@ -76,7 +60,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -107,7 +91,7 @@ void up_sigdeliver(void)
sinfo("Resuming\n");
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_RISCV_INCLUDE_TLS_H */
+2 -1
View File
@@ -91,7 +91,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
/* Get aligned addresses of the top and bottom of the stack */
#ifdef CONFIG_TLS
#ifdef CONFIG_TLS_ALIGNED
if (!int_stack)
{
/* Skip over the TLS data structure at the bottom of the stack */
@@ -107,6 +107,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
UNUSED(int_stack);
start = alloc & ~3;
#endif
end = (alloc + size + 3) & ~3;
/* Get the adjusted size based on the top and bottom of the stack */
+2 -15
View File
@@ -124,7 +124,6 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -139,7 +138,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Is there already a stack allocated of a different size? Because of
@@ -212,7 +210,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
if (tcb->stack_alloc_ptr)
{
#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
#if defined(CONFIG_STACK_COLORATION)
uintptr_t stack_base;
#endif
size_t top_of_stack;
@@ -240,7 +238,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->adj_stack_ptr = (FAR uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -255,19 +252,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
sizeof(struct tls_info_s);
stack_size = tcb->adj_stack_size -
sizeof(struct tls_info_s);
riscv_stack_color((FAR void *)stack_base, stack_size);
up_stack_color((FAR void *)stack_base, stack_size);
#endif /* CONFIG_STACK_COLORATION */
#else /* CONFIG_TLS */
#ifdef CONFIG_STACK_COLORATION
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif /* CONFIG_STACK_COLORATION */
#endif /* CONFIG_TLS */
board_autoled_on(LED_STACKCREATED);
return OK;
-2
View File
@@ -155,11 +155,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
tcb->adj_stack_ptr = (uintptr_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
+2 -2
View File
@@ -82,7 +82,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
board_autoled_on(LED_SIGNAL);
@@ -115,7 +115,7 @@ void up_sigdeliver(void)
regs[REG_EPC], regs[REG_INT_CTX]);
up_irq_save();
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
+2 -2
View File
@@ -82,7 +82,7 @@ void up_sigdeliver(void)
* EINTR).
*/
int saved_errno = rtcb->pterrno;
int saved_errno = get_errno();
#ifdef CONFIG_SMP
/* In the SMP case, we must terminate the critical section while the signal
@@ -162,7 +162,7 @@ void up_sigdeliver(void)
/* Restore the saved errno value */
rtcb->pterrno = saved_errno;
set_errno(saved_errno);
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -73,5 +71,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_SIM_INCLUDE_TLS_H */
+3 -17
View File
@@ -106,7 +106,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
FAR uint8_t *stack_alloc_ptr;
int ret = ERROR;
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
@@ -121,7 +120,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
stack_size = TLS_MAXSTACK;
}
#endif
#endif
/* Move up to next even word boundary if necessary */
@@ -133,15 +131,15 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
#ifdef CONFIG_TLS_ALIGNED
stack_alloc_ptr = (FAR uint8_t *)kumm_memalign(TLS_STACK_ALIGN,
adj_stack_size);
#else /* CONFIG_TLS */
#else
stack_alloc_ptr = (FAR uint8_t *)kumm_malloc(adj_stack_size);
#endif /* CONFIG_TLS */
#endif
/* Was the allocation successful? */
if (stack_alloc_ptr)
{
#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
#if defined(CONFIG_STACK_COLORATION)
uintptr_t stack_base;
#endif
@@ -160,7 +158,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
tcb->stack_alloc_ptr = stack_alloc_ptr;
tcb->adj_stack_ptr = (FAR void *)adj_stack_addr;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -177,17 +174,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
up_stack_color((FAR void *)stack_base, stack_size);
#endif /* CONFIG_STACK_COLORATION */
#else /* CONFIG_TLS */
#ifdef CONFIG_STACK_COLORATION
/* If stack debug is enabled, then fill the stack with a
* recognizable value that we can use later to test for high
* water marks.
*/
up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
#endif /* CONFIG_STACK_COLORATION */
#endif /* CONFIG_TLS */
ret = OK;
}
-2
View File
@@ -126,11 +126,9 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size)
tcb->stack_alloc_ptr = stack;
tcb->adj_stack_ptr = (FAR void *)adj_stack_addr;
#ifdef CONFIG_TLS
/* Initialize the TLS data structure */
memset(stack, 0, sizeof(struct tls_info_s));
#endif
return OK;
}
-3
View File
@@ -30,8 +30,6 @@
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#ifdef CONFIG_TLS
/****************************************************************************
* Inline Functions
****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
# define up_tls_info() tls_get_info()
#endif
#endif /* CONFIG_TLS */
#endif /* __ARCH_X86_INCLUDE_TLS_H */

Some files were not shown because too many files have changed in this diff Show More