diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-16 17:37:40 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-16 17:37:40 +0000 |
commit | a45f710f8fdb5b9cf11fbdcb2a74cb5007ea79fd (patch) | |
tree | 8e50d03ca5238eb88b8cc8125f8db19ba72436a9 /nuttx/include | |
parent | d980ce2cdc1816e4d5df9a1c2ff9e647c6cb7540 (diff) | |
download | px4-nuttx-a45f710f8fdb5b9cf11fbdcb2a74cb5007ea79fd.tar.gz px4-nuttx-a45f710f8fdb5b9cf11fbdcb2a74cb5007ea79fd.tar.bz2 px4-nuttx-a45f710f8fdb5b9cf11fbdcb2a74cb5007ea79fd.zip |
Fix bad conditional logic in mkconfig.c; Add user-mode pthread start-up logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5748 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/arch.h | 30 | ||||
-rw-r--r-- | nuttx/include/nuttx/sched.h | 20 | ||||
-rw-r--r-- | nuttx/include/nuttx/userspace.h | 6 | ||||
-rw-r--r-- | nuttx/include/pthread.h | 2 |
4 files changed, 55 insertions, 3 deletions
diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index 7bdd90ade..ed461b50d 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -390,11 +390,39 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) void up_task_start(main_t taskentry, int argc, FAR char *argv[]) noreturn_function; #endif /**************************************************************************** + * Name: up_pthread_start + * + * Description: + * In this kernel mode build, this function will be called to execute a + * pthread in user-space. When the pthread is first started, a kernel-mode + * stub will first run to perform some housekeeping functions. This + * kernel-mode stub will then be called transfer control to the user-mode + * pthread. + * + * Normally the a user-mode start-up stub will also execute before the + * pthread actually starts. See libc/pthread/pthread_startup.c + * + * Input Parameters: + * entrypt - The user-space address of the pthread entry point + * arg - Standard argument for the pthread entry point + * + * Returned Value: + * This function should not return. It should call the user-mode start-up + * stub and that stub should call pthread_exit if/when the user pthread + * terminates. + * + ****************************************************************************/ + +#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) noreturn_function; +#endif + +/**************************************************************************** * Name: up_allocate_heap * * Description: diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index f707e8269..9101a2876 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -702,6 +702,26 @@ void task_vforkabort(FAR struct task_tcb_s *child, int errcode); void task_startup(main_t entrypt, int argc, FAR char *argv[]); #endif +/**************************************************************************** + * Name: pthread_startup + * + * Description: + * This function is the user-space, pthread startup function. It is called + * from up_pthread_start() in user-mode. + * + * Inputs: + * entrypt - The user-space address of the pthread entry point + * arg - Standard argument for the pthread entry point + * + * Return: + * None. This function does not return. + * + ****************************************************************************/ + +#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/include/nuttx/userspace.h b/nuttx/include/nuttx/userspace.h index 40fe656b0..842870664 100644 --- a/nuttx/include/nuttx/userspace.h +++ b/nuttx/include/nuttx/userspace.h @@ -44,6 +44,7 @@ #include <sys/types.h> #include <stdint.h> +#include <pthread.h> #ifdef CONFIG_NUTTX_KERNEL @@ -111,9 +112,12 @@ struct userspace_s uintptr_t us_bssstart; uintptr_t us_bssend; - /* Task/thread startup stubs */ + /* Task/thread startup routines */ void (*task_startup)(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; +#ifndef CONFIG_DISABLE_PTHREAD + void (*pthread_startup)(pthread_startroutine_t entrypt, pthread_addr_t arg); +#endif /* Memory manager entry points */ diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h index a98b9aaaa..586d1208e 100644 --- a/nuttx/include/pthread.h +++ b/nuttx/include/pthread.h @@ -167,7 +167,7 @@ typedef FAR void *pthread_addr_t; typedef pthread_addr_t any_t; typedef pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t); -typedef pthread_startroutine_t pthread_func_t; +typedef pthread_startroutine_t pthread_func_t; struct pthread_attr_s { |