tc_comm用于win32 simulator的补丁

6 views
Skip to first unread message

rogerz

unread,
Dec 14, 2012, 11:20:43 AM12/14/12
to rt-thre...@googlegroups.com
本来只是想试一下论坛上反映的soft timer问题的,结果发现tc_comm这个测试框架在win32 simulator这个bsp下有问题,会导致内存访问出错。

原因是在遍历syscall_table的时候会指错位置,到第三项时就不对了。

Inline image 1

看了一下代码,发现在list()中遍历这个表时对_MSC_VER是有特殊处理的

#if defined(_MSC_VER)
static struct finsh_syscall* _next_syscall(struct finsh_syscall* call)
{
unsigned int *ptr;
ptr = (unsigned int*) (call + 1);
while ((*ptr == 0) && ((unsigned int*)ptr < (unsigned int*) _syscall_table_end))
ptr ++;

return (struct finsh_syscall*)ptr;
}
#define _NEXT_SYSCALL(index)  index=_next_syscall(index)
#else
#define _NEXT_SYSCALL(index)  index++
#endif

在list_tc()中也这样处理后就没问题了,完整补丁见附件。

可是我不太明白为什么会需要这样处理,为什么链接之后第一个symbol在0x00cdd110,第二个在0x00cdd11c,跟前一个差0x0c,第三个的正确位置是在0x00cdd12c,跟前一个差0x10,第四个实际上也是差了0x10,是MSVC的链接器的问题?

 ,---.  Rogerz Zhang
( @ @ ) Human, not octopus
 ).-.(  Chase what you love and only that
'/|||\` 人非章鱼·爱吾所爱
  '|`   AsciiArt < Shimrod(hh)
struct_array.png
tc_comm_for_win32.patch

作 陈

unread,
Jan 8, 2013, 2:03:45 AM1/8/13
to rt-thre...@googlegroups.com
测试一下看是不是有这个问题!如果是应该要修改的。
Reply all
Reply to author
Forward
0 new messages