Revert two commits that introduced special register handling for tricore
architecture:
- f0006bec "coredump.c:make the registers saved by active assert
consistent with those in the coredump"
- 5835c0ed "coredump: fix tricore coredump not working"
Reason:
Tricore has an ordinary register context layout similar to other
architectures and doesn't require up_copyusercontext. The current
implementation where tcb->xcp.regs points to the upper register causes
the lower CSA to be lost (the last CSA is located 0x40 bytes above
the upper CSA).
Treating tricore consistently with other architectures allows all
registers to be accessed correctly via g_reginfo.toffset, providing
a unified solution.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
change the environ implementation from sched/environ to
libc/environ, thus we can access the environ related API can vai libc
directl, which could improve the access speed in kernel build.
And in order to support this modification, we change the
struct task_info_s's ta_lock from nxmutex_t to nxrmutex_t,
this is because the env_*-related APIs require the ta_lock
to be reentrant.
If recursive locks are not supported, it may lead to deadlocks
in certain scenarios. For example, during initialization on the
qemu-miwear platform, it is necessary to call getenv while already
holding the ta_lock. To support such cases, we need to change
the ta_lock from nxmutex_t to nxrmutex_t.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
int nxsem_clockwait
int nxsem_tickwait
int nxsem_timedwait
int nxsem_tickwait_uninterruptible
int nxsem_clockwait_uninterruptible
int nxsem_timedwait_uninterruptible
Signed-off-by: hujun5 <hujun5@xiaomi.com>
1. for sigevent struct that defined in signal.h
For UNIX98 mode:
When the header file <mqueue.h> is included, the sigevent
structure is defined and contains the member sigev_notify of type
int.
For POSIX01 and UNIX03 modes:
If the implementation supports the Message Passing option for
compilation:
When the header file <mqueue.h> is included, the sigevent
structure is defined and contains the member sigev_notify of
type int.
For UNIX98 mode:
When the header file <mqueue.h> is included, the sigevent
structure shall be defined and contain the member sigev_signo of
type int.
For POSIX01 and UNIX03 modes:
If the implementation supports the Message Passing option for
compilation:
When the header file <mqueue.h> is included, the sigevent
structure shall be defined and contain the member sigev_signo
of type int.
2. for signal.h function prototype declaration
For UNIX98 mode:
When the header <signal.h> is included, the function prototype int
sigqueue(pid_t, int, const union sigval) is declared.
For POSIX08 and UNIX10 modes:
When the header <signal.h> is included, the function prototype int
sigqueue(pid_t, int, union sigval) is declared.
For other test modes:
If _POSIX_REALTIME_SIGNALS is not defined as -1 in <unistd.h>:
When the header <signal.h> is included, the function prototype
int sigqueue(pid_t, int, const union sigval) is declared.
3. for signal.h, the siginfo_t struct:
When the header file <signal.h> is included, the siginfo_t structure
type shall contain the member si_signo of type int.
When the header file <signal.h> is included, the siginfo_t structure
type shall contain the member si_code of type int.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
exec_symtab.c:1129:38: error: 'sched_lock' undeclared here (not in a function); did you mean 'g_schedlock'?
1129 | { "sched_lock", (FAR const void *)&sched_lock },
| ^~~~~~~~~~
| g_schedlock
exec_symtab.c:1143:40: error: 'sched_unlock' undeclared here (not in a function); did you mean 'nxsched_unlock'?
1143 | { "sched_unlock", (FAR const void *)&sched_unlock },
| ^~~~~~~~~~~~
| nxsched_unlock
Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
We use USERSPACE to get builtin data,so don't need this patch
This reverts commit ef1f5ba351eb4a35ea31b84be92d6ce58e072a31.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
1. add the DISABLE_SIGNALS build option
2. make the sleep/usleep/nanosleep function can work with signal
function disabled
3. make the driver/fs/sched/libc kernel module can decouple from signal
module
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
When protect building mode, posix_spawn only enters the kernel space to
find the buildin executable file, but some executable files are in user
space. So first execute posix_spawn. If it is not found in kernel
space, then execute task_spawn to start it.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
1. parse a given syscall csv file into a list of syscall files
2. generate stub/proxy/wraps syscall files accordingly
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
smartspeaker-knsh/libs/libc/libc.a(lib_mutex.c.o): in function `nxmutex_clocklock':
libs/libc/misc/lib_mutex.c:203:(.text.nxrmutex_clocklock+0x40): undefined reference to `nxsem_clockwait_uninterruptible'
Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
bug find:
if use CONFIG_LARGE_FILE, sizeof(off_t) > sizeof(uinptr_t)
so, in PROXY_lseek
```
off_t lseek(int parm1, off_t parm2, int parm3)
{
return (off_t)syscall4((unsigned int)SYS_lseek, (uinptr_t)parm1, (uinptr_t)parm2, (uinptr_t)parm3)
}
```
param1 will be truncate!, so bug happend!, and in STUB also have it bug
on return value
how to fix:
add -r option to mark what type need use pointer, like off_t
before fix generate code like:
PROXY
```
off_t lseek(int parm1, off_t parm2, int parm3)
{
off_t ret;
sys_call4((unsigned int)SYS_lseek, (uintptr_t)parm1, (uintptr_t)&parm2, (uintptr_t)parm3, (uintptr_t)&ret);
return ret;
}
```
STUB
```
uintptr_t STUB_lseek(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t ret)
{
*(FAR off_t *) ret = lseek((int)parm1, *(off_t *)parm2, (int)parm3);
return 0;
}
```
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
The `perf_gettime` syscall should be disabled when userland
PMU access is enabled.
As `perf_gettime()` may not always be syscall, note drivers
also need use the right one adaptively.
Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
- Remove the redundant holder, as nxsem now manages hoder TID
- Remove DEBUGASSERTIONS which are managed in nxsem
- Remove the "reset" handling logic, as it is now managed in nxsem
- Inline the simplest functions
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
Signed-off-by: hujun5 <hujun5@xiaomi.com>
There is no need for a gettid() syscall, as the thread ID is stable through
the life of the process. It is safe to put a copy of TID to TLS. This way
a user processes can access TID quickly via its own stack, instead of
having to use an expensive syscall.
Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This avoids unnecessary syscalls in memory protected builds, when mutex
lock/unlock can be done with only atomic counter access
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
Signed-off-by: hujun5 <hujun5@xiaomi.com>
The DFX framework needs to use the sched_note_event_ip
interface to output event-type logs, and the log type
is NOTE_DUMP_BINARY.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
Add compilation condition for 'nx_vsyslog' syscall.
Export 'sched_note_printf_ip' syscall when CONFIG_SYSLOG_TO_SCHED_NOTE=y
Put the implementation of sched_note_printf_ip in libc/misc/lib_note.c
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
This adds perf_gettime() and perf_convert() APIs to syscall so that
to use them from userspace of PROTECTED or KERNEL builds.
Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
reason:
1 Accelerated the implementation of sched_lock, remove enter_critical_section in sched_lock and
only enter_critical_section when task scheduling is required.
2 we add sched_lock_wo_note/sched_unlock_wo_note and it does not perform instrumentation logic
Signed-off-by: hujun5 <hujun5@xiaomi.com>
use syscall to trigger assert
irq can stop all task running, and we can use irq stack to do assert,
reduce thread task
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
To ensure consistency, in all places where the "sendmsg" function is used
either directly or indirectly, the type of the "struct msghdr *msg" parameter
needs to be modified to "const struct msghdr *msg".
Signed-off-by: guoshichao <guoshichao@xiaomi.com>