nuttx/include
hujun5 61caf7cce9 types: on some arch, execution speed can be accelerated
in arm64 Let's see how the following code looks like in assembly

volatile cpu_set_t g_cpu_set;
cpu_set_t set_cpu_set_t_set(int cpu) {
  g_cpu_set &= ~(1 << cpu);
  return g_cpu_set;
}

when
typedef volatile uint32_t cpu_set_t;
Dump of assembler code for function set_cpu_set_t_set:
   0x0000000040288570 <+0>:	adrp	x2, 0x403ce000 <g_irqvector+1160>
   0x0000000040288574 <+4>:	ldr	w3, [x2, #2368]
   0x0000000040288578 <+8>:	mov	w1, #0x1
   0x000000004028857c <+12>:	lsl	w1, w1, w0
   0x0000000040288580 <+16>:	bic	w1, w3, w1
   0x0000000040288584 <+20>:	str	w1, [x2, #2368]
   0x0000000040288588 <+24>:	ldr	w0, [x2, #2368]
   0x000000004028858c <+28>:	ret

when
typedef volatile uint8_t cpu_set_t;
Dump of assembler code for function set_cpu_set_t_set:
   0x000000004028856c <+0>:	adrp	x2, 0x403ce000 <g_irqvector+1192>
   0x0000000040288570 <+4>:	ldrb	w3, [x2, #2336]
   0x0000000040288574 <+8>:	mov	w1, #0x1
   0x0000000040288578 <+12>:	and	w3, w3, #0xff           // At this time, there will be one more instruction
   0x000000004028857c <+16>:	lsl	w1, w1, w0
   0x0000000040288580 <+20>:	bic	w1, w3, w1
   0x0000000040288584 <+24>:	strb	w1, [x2, #2336]
   0x0000000040288588 <+28>:	ldrb	w0, [x2, #2336]
   0x000000004028858c <+32>:	ret

test:
We can use qemu for testing.

compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
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-05-22 19:10:03 +08:00
..
android
arpa
crypto crypto/rsa_verify: export rsa verify via /dev/crypto 2023-10-18 12:23:13 +08:00
cxx Add c symbols to std 2024-05-16 10:25:01 -03:00
net ioctl: add definitions related to ethtool 2023-11-03 22:37:50 +08:00
netinet Remove @ and % tag from all comments 2023-12-11 17:00:10 -03:00
netpacket net/netlink: Add RTM preifx notify support 2024-05-14 10:05:37 -03:00
nuttx nuttx kconfig: rename a few recently-added options 2024-05-21 01:11:44 +08:00
ssp
sys types: on some arch, execution speed can be accelerated 2024-05-22 19:10:03 +08:00
.gitignore .gitignore: add ignore 2024-03-14 22:47:55 +08:00
aio.h aio: change aio_fildes int type 2023-09-08 00:59:31 +03:00
alloca.h libs/alloca: add alloca implement for MSVC 2023-08-28 11:10:08 -03:00
assert.h include: When defining NDEBUG, assert will implement alignment standards 2024-05-17 10:18:16 -03:00
byteswap.h
ctype.h Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale). 2024-04-29 17:34:10 +08:00
debug.h rpmsg/debug: add debug configs and macros 2024-02-15 19:53:55 -08:00
dirent.h
dlfcn.h
dsp.h libdsp: update LP_FILTER comment 2023-10-19 21:38:45 +08:00
dspb16.h libdsp: update LP_FILTER comment 2023-10-19 21:38:45 +08:00
elf32.h Fix and improve dynamic loader 2023-07-13 10:11:58 +08:00
elf64.h Fix loading of ET_DYN type of shared objects 2023-09-20 09:35:28 -04:00
elf.h arch/arm64: support relocate for aarch64 2023-10-30 18:20:22 +08:00
endian.h
err.h
errno.h Fix nuttx coding style 2023-07-11 23:32:17 +08:00
execinfo.h sched_backtrace: define sched_dumpstack when not enable SCHED_BACKTRACE 2023-07-31 05:46:37 -07:00
fcntl.h include/fcntl.h: add O_NOATIME flags 2023-07-28 20:56:22 -07:00
fixedmath.h fixedmath: add abs and sign operations 2023-10-07 21:25:56 +08:00
fnmatch.h
ftw.h
getopt.h
glob.h
grp.h
hex2bin.h libs/libc/hex2bin: enhance 64-bit compatibility 2023-08-11 19:43:37 +08:00
iconv.h
ifaddrs.h ifaddrs: add union ifa_ifu include ifu_broadaddr and ifu_dstaddr 2023-07-08 15:42:11 +08:00
inttypes.h libs/libc/inttypes: add support for imaxdiv 2024-04-23 10:26:48 -03:00
iso646.h
langinfo.h The character U+ff0c "," could be confused with the ASCII character U+002c ",", which is more common in source code. 2023-10-03 16:53:12 -04:00
libgen.h
libintl.h
limits.h clock: replace all up_perf_xx with perf_xx 2023-10-02 16:11:43 +02:00
locale.h
lzf.h
malloc.h mm: record the maximum system memory usage 2023-11-09 09:08:49 +08:00
mqueue.h fs/mqueue: Fix the wrong field type in mq_attr as the spec and add the logical judgment to deal with the condition when mq_maxmsg or mq_msgsize is less than zero or equal to zero. 2023-08-03 03:10:56 -07:00
netdb.h
nl_types.h
nxflat.h
obstack.h
poll.h
pthread.h pthread_once: g_lock may lead deadlock 2023-09-26 10:13:00 +08:00
pty.h
pwd.h pwd: Add initial implementation of getpwent 2023-07-31 07:50:10 -07:00
regex.h
resolv.h
sched.h sched.h: add empty realize when NO CONFIG_SMP 2024-03-05 17:50:58 +08:00
search.h hsearch_r: add DELETE action 2024-02-21 13:29:36 -03:00
semaphore.h semaphore: Optimize priority inheritance with only one holder 2023-06-17 08:26:46 +03:00
signal.h sigaction: Expand si_user for non-kernel signals 2023-11-22 08:00:43 -08:00
spawn.h libs/libc/spawn: Add minimal implementation for posix_spawnattr_destory. 2023-10-31 13:42:00 +08:00
stdbool.h
stddef.h
stdint.h Fix nuttx coding style 2023-07-11 23:32:17 +08:00
stdio.h libc: add support for open_memstream 2023-11-29 02:13:19 -08:00
stdlib.h libc: add support for reallocarray 2024-04-17 11:36:39 -03:00
stdnoreturn.h
string.h Support gcc FORTIFY_SOURCE features for nuttx libc 2023-06-22 20:38:45 +08:00
strings.h libc/lib_bzero:Add bzero prototype. 2024-05-07 14:59:05 +02:00
syscall.h
syslog.h
termios.h
threads.h Fix typo in mtx_timedlock 2024-02-02 09:03:18 -08:00
time.h include: move clockid_t and time[r]_t define to sys/types.h 2023-08-19 09:08:40 +03:00
unistd.h fs_lock:Implementing file locks 2024-02-21 13:29:36 -03:00
utime.h
uuid.h
wchar.h libs/libc/wchar: add ungetwc implementation 2023-12-17 01:39:06 -08:00
wctype.h