arch/sim: fix visual studio Linker Tools Error LNK2019

nuttx_all.lib(up_initialstate.obj) : error LNK2019:
  unresolved external symbol '___builtin_frame_addres' referenced in function '_up_getsp'

Return stack pointer from esp

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-08-24 18:28:18 +08:00 committed by Xiang Xiao
parent d78ffeca71
commit da6d526e9c
1 changed files with 6 additions and 0 deletions

View File

@ -77,7 +77,13 @@ extern "C"
static inline uintptr_t up_getsp(void) static inline uintptr_t up_getsp(void)
{ {
#ifdef _MSC_VER
uintptr_t regval;
__asm mov regval, esp;
return regval;
#else
return (uintptr_t)__builtin_frame_address(0); return (uintptr_t)__builtin_frame_address(0);
#endif
} }
/**************************************************************************** /****************************************************************************