CURRENT_REGS may change during assert handling, so pass
in the 'regs' parameter at the entry point of _assert.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
POSIX dictates that assert() terminates via abort(), even though in NuttX
abort() just calls exit(EXIT_FAILURE) it is better to use the correct
API here, if at some point a proper implementation for abort() is made.
Also, as the kernel must not use abort() which is a userspace API, direct
the exit to PANIC() if for some reason _assert() returns (it should not
but trap it here just in case).
_assert is a kernel procedure, entered via system call to make the core
dump in privileged mode.
Running exit() from this context is not OK as it runs the registered
exit functions and flushes streams, which must not be done
from privileged mode as it is a security hole.
Thus, implement assert() into user space (again) and remove the exit()
call from the kernel procedure.
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b