diff options
Diffstat (limited to 'nuttx/arch/arm/src/armv7-m')
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/svcall.h | 15 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_svcall.c | 39 |
2 files changed, 46 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/armv7-m/svcall.h b/nuttx/arch/arm/src/armv7-m/svcall.h index f6b068f86..333dfb6d0 100644 --- a/nuttx/arch/arm/src/armv7-m/svcall.h +++ b/nuttx/arch/arm/src/armv7-m/svcall.h @@ -57,9 +57,9 @@ #ifdef CONFIG_NUTTX_KERNEL # ifndef CONFIG_SYS_RESERVED -# error "CONFIG_SYS_RESERVED must be defined to the value 5" -# elif CONFIG_SYS_RESERVED != 5 -# error "CONFIG_SYS_RESERVED must have the value 5" +# error "CONFIG_SYS_RESERVED must be defined to the value 6" +# elif CONFIG_SYS_RESERVED != 6 +# error "CONFIG_SYS_RESERVED must have the value 6" # endif #endif @@ -94,12 +94,19 @@ #define SYS_syscall_return (3) -/* SYS call 3: +/* SYS call 4: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) noreturn_function; */ #define SYS_task_start (4) + +/* SYS call 5: + * + * void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) noreturn_function + */ + +#define SYS_pthread_start (5) #endif /************************************************************************************ diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c index 950ddd1d3..1a153dead 100644 --- a/nuttx/arch/arm/src/armv7-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c @@ -197,7 +197,7 @@ int up_svcall(int irq, FAR void *context) } break; - /* R0=SYS_restore_context: This a restore context command: + /* R0=SYS_restore_context: This a restore context command: * * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * @@ -219,7 +219,7 @@ int up_svcall(int irq, FAR void *context) } break; - /* R0=SYS_switch_context: This a switch context command: + /* R0=SYS_switch_context: This a switch context command: * * void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs); * @@ -246,7 +246,7 @@ int up_svcall(int irq, FAR void *context) } break; - /* R0=SYS_syscall_return: This a syscall return command: + /* R0=SYS_syscall_return: This a syscall return command: * * void up_syscall_return(void); * @@ -284,7 +284,7 @@ int up_svcall(int irq, FAR void *context) break; #endif - /* R0=SYS_task_start: This a user task start + /* R0=SYS_task_start: This a user task start * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) noreturn_function; * @@ -317,6 +317,37 @@ int up_svcall(int irq, FAR void *context) break; #endif + /* R0=SYS_pthread_start: This a user pthread start + * + * void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) noreturn_function; + * + * At this point, the following values are saved in context: + * + * R0 = SYS_pthread_start + * R1 = entrypt + * R2 = arg + */ + +#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) + case SYS_pthread_start: + { + /* Set up to return to the user-space pthread start-up function in + * unprivileged mode. + */ + + regs[REG_PC] = (uint32_t)USERSPACE->pthread_startup; + regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; + + /* Change the parameter ordering to match the expectation of struct + * userpace_s pthread_startup: + */ + + regs[REG_R0] = regs[REG_R1]; /* pthread entry */ + regs[REG_R1] = regs[REG_R2]; /* arg */ + } + break; +#endif + /* This is not an architecture-specific system call. If NuttX is built * as a standalone kernel with a system call interface, then all of the * additional system calls must be handled as in the default case. |