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
This commit is contained in:
patacongo
2013-03-16 17:37:40 +00:00
parent 3daa175977
commit 76d1ad21f2
20 changed files with 392 additions and 34 deletions
+29 -1
View File
@@ -390,10 +390,38 @@ 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
*
+20
View File
@@ -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)
}
+5 -1
View File
@@ -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 */
+1 -1
View File
@@ -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
{