mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 09:02:20 +08:00
[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)
This commit is contained in:
@@ -289,7 +289,7 @@ void rt_hw_trap_exception(struct rt_hw_exp_stack *regs)
|
||||
#endif
|
||||
process_exception(esr, regs->pc);
|
||||
rt_hw_show_register(regs);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->parent.name);
|
||||
#ifdef RT_USING_LWP
|
||||
check_user_fault(regs, 0, "user fault");
|
||||
#endif
|
||||
@@ -304,7 +304,7 @@ void rt_hw_trap_serror(struct rt_hw_exp_stack *regs)
|
||||
{
|
||||
rt_kprintf("SError\n");
|
||||
rt_hw_show_register(regs);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current: %s\n", rt_thread_self()->parent.name);
|
||||
#ifdef RT_USING_FINSH
|
||||
list_thread();
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ void rt_hw_trap_fiq(void)
|
||||
extern struct rt_thread* rt_current_thread;
|
||||
void rt_hw_trap_abort(void)
|
||||
{
|
||||
rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name);
|
||||
rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->parent.name);
|
||||
rt_thread_suspend(rt_current_thread);
|
||||
rt_schedule();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -103,7 +103,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -131,7 +131,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -88,7 +88,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -140,7 +140,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -168,7 +168,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
|
||||
rt_kprintf("thread - %.*s stack:\n", RT_NAME_MAX, rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -108,7 +108,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
|
||||
rt_kprintf("r01: 0x%08x\n", contex->r1);
|
||||
rt_kprintf("r00: 0x%08x\n", contex->r0);
|
||||
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -109,7 +109,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
|
||||
rt_kprintf("r01: 0x%08x\n", contex->r1);
|
||||
rt_kprintf("r00: 0x%08x\n", contex->r0);
|
||||
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -325,7 +325,7 @@ void rt_hw_hard_fault_exception(struct exception_info * exception_info)
|
||||
|
||||
if(exception_info->exc_return & (1 << 2) )
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -462,7 +462,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
||||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -405,7 +405,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
||||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -404,7 +404,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
|
||||
|
||||
if (exception_info->exc_return & (1 << 2))
|
||||
{
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
|
||||
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -50,7 +50,7 @@ void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void rt_hw_trap_swi(struct rt_hw_register *regs)
|
||||
rt_kprintf("software interrupt\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_kprintf("Data Abort ");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
|
||||
rt_kprintf("not used\n");
|
||||
rt_hw_show_register(regs);
|
||||
if (rt_thread_self() != RT_NULL)
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name);
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -94,7 +94,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
@@ -115,7 +115,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
|
||||
@@ -53,7 +53,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("undefined instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
@@ -89,7 +89,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
@@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
||||
@@ -388,7 +388,7 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
|
||||
rt_kprintf("\n");
|
||||
print_stack_frame(sp);
|
||||
rt_kprintf("exception pc => 0x%08x\n", epc);
|
||||
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
|
||||
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->parent.name);
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
#endif
|
||||
|
||||
@@ -131,7 +131,7 @@ extern struct rt_thread *rt_current_thread;
|
||||
|
||||
static char *_get_elf_name(size_t sepc)
|
||||
{
|
||||
return IN_USERSPACE ? rt_current_thread->name : "rtthread.elf";
|
||||
return IN_USERSPACE ? rt_current_thread->parent.name : "rtthread.elf";
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SMART */
|
||||
|
||||
@@ -220,7 +220,7 @@ void handle_user(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
||||
|
||||
rt_hw_backtrace((uint32_t *)sp->s0_fp, sepc);
|
||||
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->name);
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->parent.name);
|
||||
|
||||
EXIT_TRAP;
|
||||
sys_exit(-1);
|
||||
@@ -332,7 +332,7 @@ void handle_trap(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
||||
rt_kprintf("scause:0x%p,stval:0x%p,sepc:0x%p\n", scause, stval, sepc);
|
||||
dump_regs(sp);
|
||||
rt_kprintf("--------------Thread list--------------\n");
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->parent.name);
|
||||
|
||||
extern struct rt_thread *rt_current_thread;
|
||||
rt_kprintf("--------------Backtrace--------------\n");
|
||||
|
||||
@@ -131,7 +131,7 @@ extern struct rt_thread *rt_current_thread;
|
||||
|
||||
static char *_get_elf_name(size_t sepc)
|
||||
{
|
||||
return IN_USERSPACE ? rt_current_thread->name : "rtthread.elf";
|
||||
return IN_USERSPACE ? rt_current_thread->parent.name : "rtthread.elf";
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SMART */
|
||||
|
||||
@@ -217,7 +217,7 @@ void handle_user(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
||||
|
||||
rt_hw_backtrace((uint32_t *)sp->s0_fp, sepc);
|
||||
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->name);
|
||||
LOG_E("User Fault, killing thread: %s", rt_thread_self()->parent.name);
|
||||
|
||||
EXIT_TRAP;
|
||||
sys_exit(-1);
|
||||
@@ -344,7 +344,7 @@ void handle_trap(rt_size_t scause, rt_size_t stval, rt_size_t sepc, struct rt_hw
|
||||
rt_kprintf("scause:0x%p,stval:0x%p,sepc:0x%p\n", scause, stval, sepc);
|
||||
dump_regs(sp);
|
||||
rt_kprintf("--------------Thread list--------------\n");
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->name);
|
||||
rt_kprintf("current thread: %s\n", rt_thread_self()->parent.name);
|
||||
|
||||
extern struct rt_thread *rt_current_thread;
|
||||
rt_kprintf("--------------Backtrace--------------\n");
|
||||
|
||||
@@ -126,7 +126,7 @@ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex)
|
||||
rt_kprintf("acchi: 0x%08x\n", exception_contex->ACCHI);
|
||||
rt_kprintf("acclo: 0x%08x\n", exception_contex->ACCLO);
|
||||
}
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
|
||||
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->parent.name);
|
||||
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
|
||||
list_thread();
|
||||
#endif
|
||||
|
||||
@@ -163,11 +163,11 @@ static void *thread_run(void *parameter)
|
||||
|
||||
tid = rt_thread_self();
|
||||
TRACE("pid <%08x> tid <%s> starts...\n", (unsigned int)(thread->pthread),
|
||||
tid->name);
|
||||
tid->parent.name);
|
||||
thread->rtthread = tid;
|
||||
thread->task(thread->para);
|
||||
TRACE("pid <%08x> tid <%s> exit...\n", (unsigned int)(thread->pthread),
|
||||
tid->name);
|
||||
tid->parent.name);
|
||||
thread->exit();
|
||||
|
||||
/*TODO:
|
||||
|
||||
@@ -147,7 +147,7 @@ static DWORD WINAPI thread_run( LPVOID lpThreadParameter )
|
||||
rt_thread_t tid = rt_thread_self();
|
||||
win_thread_t *pWinThread = (win_thread_t *)lpThreadParameter;
|
||||
|
||||
SetThreadName(GetCurrentThreadId(), tid->name);
|
||||
SetThreadName(GetCurrentThreadId(), tid->parent.name);
|
||||
|
||||
pWinThread->Entry(pWinThread->Param);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void rt_hw_trap_extn(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("extn instruction\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
@@ -89,7 +89,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("prefetch abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
@@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
|
||||
rt_hw_show_register(regs);
|
||||
|
||||
rt_kprintf("data abort\n");
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
|
||||
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
|
||||
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
|
||||
Reference in New Issue
Block a user