hujun5
6f03601169
arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
...
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase
to provide clearer naming semantics. The new name better reflects the macro's
purpose of frame alignment rather than general stack alignment.
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2026-01-22 15:37:24 +08:00
hujun5
8bb250a4c0
arch: move STACK_ALIGNMENT to irq.h
...
Move STACK_ALIGNMENT macro definitions from architecture-specific internal
headers to public irq.h headers. This enables common code to directly access
STACK_ALIGNMENT without requiring internal header inclusion, improving code
organization and reducing header dependencies. Applies to all architectures:
ARM, ARM64, AVR, HC, MIPS, or1k, Renesas, RISC-V, SIM, SPARC, TriCore, x86,
x86_64, Xtensa, Z16, and Z80.
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2026-01-19 14:43:43 +08:00
buxiasen
a938926b52
arch/sim: add JB_ALIGN0 for x64 to ensure the align
...
Or will cause the fork break as call will auto push 1 item.
Signed-off-by: buxiasen <buxiasen@xiaomi.com >
2026-01-13 10:29:24 +08:00
buxiasen
1058397807
arch/sim: save errno when do context switch
...
Avoid the errno changed after interrupt in sim and make return value
mistake when according to errno.
Signed-off-by: buxiasen <buxiasen@xiaomi.com >
2026-01-13 10:29:24 +08:00
buxiasen
89455bc9a1
arch: up_getusrsp change to inline and implement in irq.h
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com >
2025-01-06 23:03:05 +08:00
buxiasen
9bdcc4dc4b
arch/irq.h: update all inline to inline_function
...
Inline & inline_function both used make confuze, let's modify all inline
in irq.h to inline_function, also clear the always_inline_funcion
declaration.
Signed-off-by: buxiasen <buxiasen@xiaomi.com >
2025-01-06 23:03:05 +08:00
Alin Jerpelea
eea3d77a6e
arch/sim: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com >
2024-12-02 17:23:25 +08:00
cuiziwei
f1d180d56e
nuttx/sim: Remove math.h in sim.
...
The reason for removing math.h is that undefining __GLIBC__ does not take effect. By default, sim will use the toolchain's math library and undef __GLIBC__ in the source file.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com >
2024-11-06 02:56:24 +08:00
hujun5
9b1800d043
irq: force inline up_interrupt_context
...
reason:
Replace "inline" with "inline_function" for "up_interrupt_context" to ensure consistency with other arch
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2024-10-31 15:43:41 +08:00
zhanghongyu
6f9543daec
sim: fix crash caused by function recursion.
...
114 up_interrupt_context () at /home/zhhyu/source/vela/dev/nuttx/include/arch/irq.h:163
115 stack_monitor_enter (this_fn=0x400145dc <up_current_regs>, call_site=0x4002d5c7 <__cyg_profile_func_enter+120>, arg=0x0) at instrument/stack_monitor.c:63
116 0x000000004002d5c7 in __cyg_profile_func_enter (this_fn=0x400145dc <up_current_regs>, call_site=0x4002d5c7 <__cyg_profile_func_enter+120>) at misc/lib_instrument.c:68
117 0x00000000400156c7 in up_current_regs () at instrument/stack_monitor.c:62
118 up_interrupt_context () at /home/zhhyu/source/vela/dev/nuttx/include/arch/irq.h:163
119 stack_monitor_enter (this_fn=0x400145dc <up_current_regs>, call_site=0x4002d5c7 <__cyg_profile_func_enter+120>, arg=0x0) at instrument/stack_monitor.c:63
120 0x000000004002d5c7 in __cyg_profile_func_enter (this_fn=0x400145dc <up_current_regs>, call_site=0x4002d5c7 <__cyg_profile_func_enter+120>) at misc/lib_instrument.c:68
121 0x00000000400156c7 in up_current_regs () at instrument/stack_monitor.c:62
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com >
2024-10-12 11:49:18 +08:00
hujun5
e249dd2672
arch: support customized up_cpu_index() in AMP mode
...
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.
Signed-off-by: hujun5 <hujun5@xiaomi.com >
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com >
2024-10-10 02:38:40 +08:00
yinshengkai
f26ae83900
arch/irq: add the up_getusrpc macro to get the PC of the interrupted thread in the interrupt
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com >
Signed-off-by: ligd <liguiding1@xiaomi.com >
2024-10-08 19:55:28 +08:00
hujun5
7eea4223ee
arch: move sigdeliver to common code
...
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2024-10-07 13:32:57 +08:00
chenxiaoyi
56bcbcc6b0
sim: change the type of xcpt_reg_t
...
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com >
2024-10-04 08:21:35 +08:00
chenxiaoyi
f6fc4cdded
sim/irq: fix windows64 build error
...
nuttx\vs2022\include\arch\irq.h(144,9): error C2065: 'mov': undeclared identifier
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com >
2024-10-04 08:21:35 +08:00
chenxiaoyi
43de53c93f
sim/types: fix windows64 build error
...
nuttx\include\sys\types.h(133,22): error C2371: 'size_t': redefinition; different basic types
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com >
2024-10-04 08:21:35 +08:00
hujun5
908df725ad
arch: use up_current_regs/up_set_current_regs replace CURRENT_REGS
...
reason:
1 On different architectures, we can utilize more optimized strategies
to implement up_current_regs/up_set_current_regs.
eg. use interrupt registersor percpu registers.
code size
before
text data bss dec hex filename
262848 49985 63893 376726 5bf96 nuttx
after
text data bss dec hex filename
262844 49985 63893 376722 5bf92 nuttx
size change -4
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
-mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2024-09-13 23:18:58 +08:00
chenxiaoyi
7ce5241f0e
types.h: fix windows build error
...
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(605,39): error C2371: 'wint_t': redefinition; different basic types
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(606,39): error C2371: 'wctype_t': redefinition; different basic types
Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com >
Co-authored-by: xuxin19 <xuxin19@xiaomi.com >
2024-08-14 22:36:57 +08:00
Yanfeng Liu
a66c7c3ee1
comments/docs: fix typos in comments
...
This fix some typos in comments.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com >
2024-03-06 13:31:50 +08:00
anjiahao
d932e0af2a
sched/procfs:use instrument to statistics run time max stack
...
Usage:
1. CONFIG_FS_PROCFS_MAX_STACK_RECORD > 0, such as 32,
2. add '-finstrument-functions' to CFLAGS for What you want to check
stack.
3. mount porcfs
4. cat /proc/<pid>/stack will print backtace & size
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-12-11 02:06:51 -08:00
cuiziwei
ba73272f67
nuttx/sim:add up_irq_enbale function.
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com >
2023-09-06 21:42:42 +03:00
anjiahao
9f644579b3
fix sim register & tcb info typo
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-07-23 21:59:35 -07:00
Xiang Xiao
813b652ba5
elf: Move 32/64bit generic mapping from risc-v/arch_elf.c to elfxx.h
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-07-10 13:09:47 -03:00
ptr_b
890f9ad2ed
arch/sim: add arch/math.h
...
To avoid introducing __GLIBC__ symbol which may affect others
Signed-off-by: ptr_b <bijunda1@xiaomi.com >
2023-01-13 23:09:47 +08:00
ligd
5744c62443
sim: set timer irq as real timer
...
Signed-off-by: ligd <liguiding1@xiaomi.com >
2022-12-21 16:59:56 +09:00
Xiang Xiao
6e66603da5
arch/sim: Disable interrupt in up_interrupt_context for SMP
...
like other arch to fix the race condition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2022-12-17 18:03:27 +02:00
Xiang Xiao
1905a02ddf
arch/sim: Change up_interrupt_context to inline function like arm
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2022-12-17 18:03:27 +02:00
chao.an
da6d526e9c
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 >
2022-08-24 21:59:07 +08:00
chao.an
a93b703994
arch/sim/wchar_t: fix visual studio Compiler Error C2371
...
type of 'wchar_t' confilt with vcruntime:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime.h(228,28):
error C2371: 'wchar_t': redefinition; different basic types
D:\code\incubator-nuttx\include\sys/types.h(174): message : see decaration of 'wchar_t'
typedef wchar_t as unsigned char to compatible with vcrtuntime
Signed-off-by: chao.an <anchao@xiaomi.com >
2022-08-24 16:52:03 +08:00
Peter Bee
f20cd0295f
arch: fix typo
...
Signed-off-by: Peter Bee <bijunda1@xiaomi.com >
2022-08-03 17:37:08 +08:00
Xiang Xiao
3d1ce144df
arch: Move up_getsp from arch.h to irq.h
...
since all other special register operation in irq.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2022-07-01 10:44:55 -03:00
Xiang Xiao
11e1a8b28b
arch: Define WCHAR_[MIN|MAX] in arch/include/limits.h
...
follow up the below change:
commit 6357523892
Author: Xiang Xiao <xiaoxiang@xiaomi.com >
Date: Mon Nov 1 12:40:51 2021 +0800
arch: Add _wchar_t typedef like other basic types
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2022-06-03 22:25:49 +03:00
chao.an
3f65b562bb
arch: inline up_interrupt_context()
...
inline the up_interrupt_context() to avoid unnecessary stack pushes
Signed-off-by: chao.an <anchao@xiaomi.com >
2022-05-26 04:36:07 +08:00
chao.an
a14ed02571
sim/syscall: add syscall note support in the flat build
...
Signed-off-by: chao.an <anchao@xiaomi.com >
2022-03-07 23:58:28 +08:00
Peter Kalbus
6abdf73535
sim: Initial support on MacOS M1 and Linux AARCH64 based hosts.
2022-02-17 09:35:09 +08:00
Xiang Xiao
e1879e35cd
arch/sim: Always typedef xcpt_reg_t to unsigned long
...
to simplify the code logic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2022-02-15 06:44:21 +01:00
Xiang Xiao
6357523892
arch: Add _wchar_t typedef like other basic types
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2021-12-09 16:57:23 +09:00
Xiang Xiao
a0990ee416
arch: Remove the duplicated up_tls_info implementation
...
Define up_tls_info in arch/arch.h directly if the general one isn't suitable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2021-12-05 20:59:53 -06:00
chao.an
0f76ff42eb
arch/sim: add arch elf define
...
Signed-off-by: chao.an <anchao@xiaomi.com >
2021-11-23 20:34:56 +09:00
Alin Jerpelea
15a37c5a5a
arch: Omni Hoverboards: update licenses to Apache
...
Gregory Nutt has submitted the SGA
Omni Hoverboards has submitted the SGA
David Sidrane has submitted the ICLA
Mateusz Szafoni has submitted the ICLA
Sebastien Lorquet has submitted the ICLA
Paul Alexander Patience has submitted the ICLA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com >
2021-09-28 04:37:38 -07:00
Xiang Xiao
6576306bca
arch: Rename xxx_getsp to up_getsp
...
All modern desgin support stack pointer and it's also an
important information, so let's standardize this interface.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2021-06-09 10:20:02 -07:00
Xiang Xiao
dd1d980c3a
arch/sim: Move setjmp/longjmp to libc/machine/sim
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2021-04-05 09:00:42 -03:00
Alin Jerpelea
80ee1864df
arch: sim: nxstyle fixes
...
Nxstyle fixes to pass CI
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com >
2021-03-31 21:12:25 -05:00
Alin Jerpelea
41342c0a12
arch: sim: Author Gregory Nutt: update licenses to Apache
...
Gregory Nutt has submitted the SGA and we can migrate the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com >
2021-03-31 21:12:25 -05:00
YAMAMOTO Takashi
51be5c08bf
arch/sim/include/limits.h: Fix the type of LONG_MIN, LONG_MAX, ULONG_MAX
2021-03-12 16:23:26 +08:00
Gustavo Henrique Nihei
330eff36d7
sourcefiles: Fix relative path in file header
2021-03-09 23:18:28 +08:00
Jiuzhu Dong
f6cfd1c87b
vfork: support sim vfork
...
N/A
Change-Id: I15920bcbacfc5ea519cfe12c39cb64dfe6365838
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com >
2021-01-20 08:39:17 -08:00
YAMAMOTO Takashi
e1c53eaeb0
arch/sim/include/irq.h: Make 32-bit xcpt_reg_t unsigned
...
* 64-bit version is already unsigned
* up_copyfullstate uses unsigned for 32-bit
Error: sim/up_unblocktask.c:107:33: error: pointer targets in passing argument 1 of 'up_copyfullstate' differ in signedness [-Werror=pointer-sign]
107 | up_savestate(rtcb->xcp.regs);
| ~~~~~~~~~^~~~~
| |
| xcpt_reg_t * {aka int *}
sim/up_internal.h:133:45: note: in definition of macro 'up_savestate'
133 | #define up_savestate(regs) up_copyfullstate(regs, (xcpt_reg_t *)CURRENT_REGS)
| ^~~~
sim/up_internal.h:205:33: note: expected 'uint32_t *' {aka 'unsigned int *'} but argument is of type 'xcpt_reg_t *' {aka 'int *'}
205 | void up_copyfullstate(uint32_t *dest, uint32_t *src);
| ~~~~~~~~~~^~~~
2020-12-24 21:57:39 -06:00
Masayuki Ishikawa
ad9f88f042
Revert "Revert "arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic""
...
This reverts commit 3098b61776 .
2020-12-10 08:33:42 +01:00
YAMAMOTO Takashi
6ee7fdf874
include/inttypes.h: Provide PRIdMAX and friends using 'j' modifier
...
Replace definitions in other places.
2020-11-19 00:49:56 -08:00