Commit Graph

77 Commits

Author SHA1 Message Date
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
YAMAMOTO Takashi 123d882027 sim types.h: A workaround for macOS MODULECC 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi a863fa30f9 sim: Make int64_t match the host OS 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi c97f6f1b59 sim: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi 09fca224ec arch/sim/include/inttypes.h: Fix intptr_t
64-bit size_t/intptr_t/ptrdiff_t are long, not long long,
for macOS and Linux.

Note: we don't care CONFIG_SIM_M32 on macOS.

macOS:
    spacetanuki% uname -a
    Darwin spacetanuki.lan 18.7.0 Darwin Kernel Version 18.7.0: Mon Aug 31 20:53:32 PDT 2020; root:xnu-4903.278.44~1/RELEASE_X86_64 x86_64
    spacetanuki% cc --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    spacetanuki% cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki% cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki%

Linux:
    root@4c2e9e83ac82:/tools# uname -a
    Linux 4c2e9e83ac82 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    root@4c2e9e83ac82:/tools# cc --version
    cc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    root@4c2e9e83ac82:/tools# cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    root@4c2e9e83ac82:/tools# cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ unsigned int
    root@4c2e9e83ac82:/tools#
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi c79bda6e4f sim inttypes.h: Remove PRI/SCN macros for fast and least types
I forgot to remove some of them
in https://github.com/apache/incubator-nuttx/pull/2227 .
This commit removes them.
2020-11-10 00:03:35 -08:00
YAMAMOTO Takashi 577d72258a sim inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi 53256bdaa7 sim: inttypes.h: Make the #ifdef block minimum 2020-11-05 18:49:22 -08:00
Masayuki Ishikawa 3098b61776 Revert "arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic"
This reverts commit d6210fcd84.
2020-10-26 08:42:52 +09:00
Sebastian Ene d6210fcd84 arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic
Signed-off-by: Sebastian Ene <sene@apache.org>
2020-10-01 12:11:31 +08:00
Xiang Xiao 5107104bbe arch/sim: Model host signal as NuttX's interrupt
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-03 10:20:50 +08:00
Sebastian Ene 5db11a275e arch/sim: Mask and restore the host signal in irq_save and irq_restore
to avoid the host signal process interrupt the execution of NuttX critical section

Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
2020-09-03 10:20:50 +08:00
Xiang Xiao 8ce0ff5ce4 arch/sim: Make up_internal.h includable in host environment
to avoid the declaration repetition

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-21 18:09:19 +08:00
Xiang Xiao b330b3ac0c arch/sim: Fix the linkage of up_irqinitialize mismatch
include/arch/irq.h💯20: note: previous declaration with ‘C++’ linkage
  100 | static inline void up_irqinitialize(void)
      |                    ^~~~~~~~~~~~~~~~
In file included from include/ctype.h:45,
                 from include/libcxx/ctype.h:38,
                 from include/libcxx/cctype:38,
                 from include/libcxx/cwctype:53,
                 from include/libcxx/cwchar:106,
                 from include/libcxx/string:510,
                 from libcxx/src/debug.cpp:13:
include/nuttx/arch.h:1343:6: error: conflicting declaration of ‘void up_irqinitialize()’ with ‘C’ linkage
 1343 | void up_irqinitialize(void);
      |      ^~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0e0963a3465f9dabdaca6534a55b9c2c41f4bc64
2020-07-30 12:50:39 +09:00
Xiang Xiao 4176a3828b arch/sim: implement sim_getsp
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 13:51:09 +01:00
Xiang Xiao 4fbbd2e3bf arch: Move PRIxMAX and SCNxMAX definition to include/stdint.h
like other related macro(e.g. INTMAX_MIN, INTMAX_MAX...)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8863599960b1a9b1c22ae9c35735a379a4c745b0
2020-06-10 08:24:47 +02:00
Xiang Xiao 7758eb8658 arch: Define INTx_C and UINTx_C macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia50ea8764880fabd3d878c95328632c761be6b43
2020-06-10 08:24:47 +02:00
Gregory Nutt c2244a2382 Remove CONFIG_TLS
A first step in implementing the user-space error is force TLS to be enabled at all times.  It is no longer optional
2020-05-07 12:04:16 -06:00
Gregory Nutt bda24f09c2 libs/libc/tls/tls_getinfo.c: Add tls_get_info()
Move the logic to get TLS information from an inline function to a normal function.  For the unaligned case, it is probably too large to be inlined.

Also fixes some minor things from review of previous commits.
2020-05-05 18:56:33 +01:00
Abdelatif Guettouche b7e7fba732 TLS_UNALIGNED (#2)
* Implement the TLS_UNALIGNED
2020-05-05 18:56:33 +01:00
Nathan Hartman 679b4fbee2 arch: Fix included directed -> included directly
This typo had been copied and pasted into numerous irq and syscall
headers.
2020-04-05 22:31:15 +01:00
Xiang Xiao e7d9260014 arch: Customize the typedef of size_t instead of intptr_t
To ensure size_t same as toolchain definition in the first place and rename CXX_NEWLONG to ARCH_SIZET_LONG.  The change also check whether __SIZE_TYPE__ exist before CONFIG_ARCH_SIZET_LONG so our definition can align with toolchain(gcc/clang) definition automatically.
2020-02-18 07:15:19 -06:00
Xiang Xiao 76bbed07a4 Call up_irqinitialize from irq subsystem
Call up_irqinitialize from irq subsystem to make the irq ready for use as soon as possible
2020-02-08 07:39:22 -06:00
Xiang Xiao 80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Gregory Nutt c840ac2496 arch/sim: Even though the simulation has no chips, it needs to have CONFIG_ARCH_CHIP and chip sub-directories. Otherwise, we would have to treat it as a special case in the build system. 2019-08-07 16:05:00 -06:00
Gregory Nutt eef2f4599e Commit 933e9e407b broke the simulator on a 64-bit platform. 2019-07-29 14:34:29 -06:00
Gregory Nutt 1e59d9dd14 armv7-a, armv7-r, armv7-m: Add atomic read-add-write and read-subtract-write functions. 2018-02-04 12:22:03 -06:00
Gregory Nutt 48c27f8ffc Simulator: Adds necessary functionality to build Simulator under ARM Linux. Tested only on Raspberry3. Currently setjmp/longjmp do not save/restore floating point registers. Patch provided by Bitbucket user nbkolchin. 2017-08-26 11:38:44 -06:00
Gregory Nutt 9f7ba21f8a Implement deferred IRQ locking. Adds support for simulator. 2016-12-23 11:28:43 -06:00
Paul A. Patience 912fe06a86 Add architecture-specific inttypes.h 2016-10-27 16:01:38 -04:00
Gregory Nutt 48fb97e7b5 More of the same cloned typo 2016-10-19 10:11:45 -06:00
Gregory Nutt 56f2454c86 Fix names of pre-processor variables used in header file idempotence 2016-08-06 18:48:45 -06:00
Gregory Nutt d41008e220 Update some header commments 2016-08-06 18:16:31 -06:00
Gregory Nutt 39e7d5431f update gitignore 2016-06-24 16:29:15 -06:00
Gregory Nutt a74c19bbae SIM: Add TLS support to to the simulator 2016-03-11 14:03:27 -06:00
Gregory Nutt 83bc1c97c3 Rename irqsave() and irqrestore() to up_irq_save() and up_irq_restore() 2016-02-14 16:11:25 -06:00
Gregory Nutt b087cb7f9a SIM: Add SMP idle thread setup logic 2016-02-11 12:16:19 -06:00
Gregory Nutt 5e91bf9a03 SIM: Add a fake spinlock.h header file that may be useful someday for testing of SMP features 2016-02-10 10:33:37 -06:00
Gregory Nutt d7c5ff98f4 Fix a typo 2015-11-23 18:55:38 +00:00
Gregory Nutt edb1439d8f Last change introduced warnings when CONFIG_SIM_M32=y; This fixes those warnings too 2015-11-23 12:44:59 -06:00