[lwp]给thread添加lwp成员
This commit is contained in:
parent
e6fedb6e9b
commit
c79fbd373f
|
@ -510,7 +510,7 @@ struct dfs_fdtable* dfs_fdtable_get(void)
|
|||
#ifdef RT_USING_LWP
|
||||
struct rt_lwp *lwp;
|
||||
|
||||
lwp = (struct rt_lwp *)rt_thread_self()->user_data;
|
||||
lwp = (struct rt_lwp *)rt_thread_self()->lwp;
|
||||
if (lwp)
|
||||
fdt = &lwp->fdt;
|
||||
else
|
||||
|
|
|
@ -46,14 +46,14 @@ extern void lwp_user_entry(void *args, const void *text, void *data);
|
|||
void lwp_set_kernel_sp(uint32_t *sp)
|
||||
{
|
||||
struct rt_lwp *user_data;
|
||||
user_data = (struct rt_lwp *)rt_current_thread->user_data;
|
||||
user_data = (struct rt_lwp *)rt_current_thread->lwp;
|
||||
user_data->kernel_sp = sp;
|
||||
}
|
||||
|
||||
uint32_t *lwp_get_kernel_sp(void)
|
||||
{
|
||||
struct rt_lwp *user_data;
|
||||
user_data = (struct rt_lwp *)rt_current_thread->user_data;
|
||||
user_data = (struct rt_lwp *)rt_current_thread->lwp;
|
||||
|
||||
return user_data->kernel_sp;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ static void lwp_cleanup(struct rt_thread *tid)
|
|||
|
||||
dbg_log(DBG_INFO, "thread: %s, stack_addr: %08X\n", tid->name, tid->stack_addr);
|
||||
|
||||
lwp = (struct rt_lwp *)tid->user_data;
|
||||
lwp = (struct rt_lwp *)tid->lwp;
|
||||
|
||||
if (lwp->lwp_type == LWP_TYPE_DYN_ADDR)
|
||||
{
|
||||
|
@ -327,16 +327,13 @@ static void lwp_cleanup(struct rt_thread *tid)
|
|||
|
||||
static void lwp_thread(void *parameter)
|
||||
{
|
||||
volatile uint32_t tmp;
|
||||
rt_thread_t tid;
|
||||
struct rt_lwp *lwp;
|
||||
|
||||
rt_kprintf("%08x %08x\n", &tmp, tmp);
|
||||
|
||||
lwp = (struct rt_lwp *)parameter;
|
||||
rt_lwp_mem_init(lwp);
|
||||
tid = rt_thread_self();
|
||||
tid->user_data = (rt_uint32_t)lwp;
|
||||
tid->lwp = lwp;
|
||||
tid->cleanup = lwp_cleanup;
|
||||
|
||||
lwp_user_entry(lwp->args, lwp->text_entry, lwp->data);
|
||||
|
@ -344,7 +341,7 @@ static void lwp_thread(void *parameter)
|
|||
|
||||
struct rt_lwp *rt_lwp_self(void)
|
||||
{
|
||||
return (struct rt_lwp *)rt_thread_self()->user_data;
|
||||
return (struct rt_lwp *)rt_thread_self()->lwp;
|
||||
}
|
||||
|
||||
int exec(char *filename, int argc, char **argv)
|
||||
|
|
|
@ -556,7 +556,11 @@ struct rt_thread
|
|||
|
||||
void (*cleanup)(struct rt_thread *tid); /**< cleanup function when thread exit */
|
||||
|
||||
rt_uint32_t user_data; /**< private user data beyond this thread */
|
||||
rt_uint32_t user_data; /**< private user data beyond this thread */
|
||||
|
||||
#ifdef RT_USING_LWP
|
||||
struct rt_lwp *lwp; /**< if NULL it's a kernel thread */
|
||||
#endif
|
||||
};
|
||||
typedef struct rt_thread *rt_thread_t;
|
||||
|
||||
|
|
|
@ -199,6 +199,10 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
|
|||
thread->si_list = RT_NULL;
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_LWP
|
||||
thread->lwp = RT_NULL;
|
||||
#endif
|
||||
|
||||
RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread));
|
||||
|
||||
return RT_EOK;
|
||||
|
|
Loading…
Reference in New Issue