1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

81 Commits

Author SHA1 Message Date
Marian Buschsieweke
f34cd3f7c1
cpu/native: fix build with musl
This changes a bunch of things that allows building with the musl C lib,
provided that `libucontext-dev` and `pkg-config` are installed.

Note that installing libucontext makes absolutely zero sense on C libs
that do natively provide this deprecated System V API, such as glibc.
Hence, it no sane glibc setup is expected to ever have libucontext
installed.

A main pain point was that argv and argc are expected to be passed to
init_fini handlers, but that is actually a glibc extension. This just
parses `/proc/self/cmdline` by hand to populate argv and argc during
startup, unless running on glibc.
2024-05-31 12:18:33 +02:00
Benjamin Valentin
5164a6cc59 cpu/native: return _native_retval with NATIVE_AUTO_EXIT 2024-03-04 14:08:52 +01:00
Frederik Haxel
16eff9b6ed native: Linux/x86_64 support
Initial version to test 64 bit compatibility.

Instead of a separate board, the inital version for Linux/x86_64 is enabled
by setting the environment variable `NATIVE_64BIT=y` and compiling as usual.

Not currently implemented:
* Architectures other than x86_64 or operating systems other than Linux
    * No FreeBSD support
    * No Aarch support
* Rust support for x86_64
2024-01-30 16:33:19 +01:00
Benjamin Valentin
cb76cc17e9 cpu/native: fix build with !core_thread 2024-01-09 23:02:01 +01:00
Benjamin Valentin
fe4cc9169d cpu/native: define ARCHITECTURE_BREAKPOINT() 2023-04-27 13:19:17 +02:00
Teufelchen1
c9e9a8d2f1 native: Remove code used for __MACH__ target 2022-12-22 17:57:25 +01:00
Benjamin Valentin
4c9f1e0ca4 cpu/native: fix build with afl-gcc 11.2
Building `fuzzing/gcoap` with afl-gcc 11.2 gives

/home/benpicco/dev/RIOT/cpu/native/native_cpu.c: In function ‘thread_stack_init’:
/home/benpicco/dev/RIOT/cpu/native/native_cpu.c:120:11: error: variable ‘stk’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  120 |     char *stk = NULL;
      |           ^~~
/home/benpicco/dev/RIOT/cpu/native/native_cpu.c:118:72: error: argument ‘stack_start’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  118 | char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize)
      |

We can re-write the function to not use this temporary variable and the error goes away.
2022-01-27 21:09:59 +01:00
Marian Buschsieweke
09b8387df4
cpu/native: align stack in thread_stack_init()
Unaligned accesses on x86(_64) are allowed, but slow. However, some host systems
might not be that forgiving. Aligning the stack to sizeof(uintptr_t) should be
a pretty safe safety measure.

And with this done, all casts of the stack pointer that increase alignment
requirements are now intermediately casted to `uintptr_t` to silence
warnings from -Wcast-align - after all the stacks are now manually aligned.
2021-11-06 20:22:10 +01:00
Benjamin Valentin
1a2984b786 cpu/native: fix build with gcc 11
This fixes the following warning with GCC 11.2:

    cpu/native/include/native_internal.h:153:13: error: variably modified ‘__isr_stack’ at file scope
      153 | extern char __isr_stack[SIGSTKSZ];
          |             ^~~~~~~~~~~
    cpu/native/include/native_internal.h:154:13: error: variably modified ‘__end_stack’ at file scope
      154 | extern char __end_stack[SIGSTKSZ];
2021-10-12 14:56:11 +02:00
87b49d04ab cpu/native: defer yield when IRQs are disabled.
This makes native behave like Cortex-M, which flags PENDSV, which then
gets triggered once IRQs are re-enabled.
2021-08-24 09:49:40 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Marian Buschsieweke
b657ebc39a
cpu/native: Don't access sched_active_*
Replaced accesses to sched_active_* with API calls in C files
2020-08-17 12:16:08 +02:00
62bb4cc526 cpu/native: fix race condition in thread_yield_higher()
Error case:
1. thread_yield_higher() stores the thread's ucontext
2. creates an "isr ucontext" for isr_thread_yield, switches to it

Case 1: no signals are pending, continues in isr_thread_yield()
3a. sched_run is called
4a. return to sched_active_thread ucontext

Case 2: signals pending (the crashing scenario), continues in native_irq_handler()
3b. handles signals
4b. if sched_context_switch_request is set, call sched_run
5b. return to sched_active_thread ucontext

4b misses the call to sched_run(), leading to a possible return into a
non-ready thread.
2019-01-28 17:12:01 +01:00
4133908fe0 cpu/native: fix doxygen grouping 2018-06-11 19:12:02 +02:00
86665b71bf cpu: adapt to COREIF_NG removal 2017-11-16 14:40:16 +01:00
Martine Lenders
29842bb5e4 netdev2: rename to netdev and remove gnrc_netdev
With some minor hand-edits I used the following chain of commands:

```sh
git rm sys/include/net/gnrc/netdev.h
git grep --name-only -i netdev2 | \
        xargs sed -i -e 's/^\(NETDEV\)2\(.*\)\( [("]\)/\1\2 \3/g' \
                     -e 's/\(netdev\)2\(.*\)\( \/\*\*<\)/\1\2 \3/I' \
                     -e 's/\(netdev\)2/\1/gI'
git add -p
git commit --amend
git ls-tree --full-tree -r HEAD --name-only | \
        grep "netdev2" | xargs -I'{}' dirname '{}' | uniq | \
        grep "netdev2" | while read dir; do
                new_dir="$(echo "$dir" | sed "s/netdev2/netdev/g")"
                git mv -f "$dir" "$new_dir"
        done
git commit --amend
git ls-tree --full-tree -r HEAD --name-only | \
        grep "netdev2" | while read file; do
                new_file="$(echo "$file" | sed "s/netdev2/netdev/g")"
                git mv -f "$file" "$new_file"
        done
git commit --amend
git grep --name-only "\<drivers_netdev_netdev\>" | \
        xargs sed -i "s/\<drivers_netdev_netdev\>/drivers_netdev_api/g"
git add -p
git commit --amend
```
2017-03-15 09:31:20 +01:00
2d92661b76 cpu: native: fix thread_yield_higher inisr() case 2017-02-27 16:10:12 +01:00
Ludwig Ortmann
0b72be7c87 native: add syscall-leave trampoline 2016-10-15 07:50:44 +02:00
Ludwig Ortmann
237340b3e3 native: add thread_yield_higher misuse warning 2016-10-15 07:50:44 +02:00
Ludwig Ortmann
535eda8805 native: improve comments, coding style 2016-10-15 07:40:49 +02:00
Ludwig Knüpfer
05d4b2f8fa cpu/native: fix thread_stack_init
The pointer arithmetic for the calculation of the context storage was off
due to the change of the stack's pointer type from unsigned int to char.
Fix offset calculation by not adjusting for unsigned int width anymore.
2016-07-26 20:07:08 +02:00
MohmadAyman
53df3e8b57 core: cpu: provide function to acquire ISR stack usage 2016-06-01 23:01:35 +02:00
Yonezawa-T2
1ce140d910 debug: fix compilation error for %p formatter 2016-03-29 11:46:29 +09:00
DipSwitch
0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 2016-03-20 16:47:34 +01:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
938ff5c5e7 core: cpu: sys: simplify reboot() 2016-01-27 13:30:01 +01:00
Ludwig Knüpfer
eda6328e21 documentation: update my name (Ortmann -> Knüpfer) 2015-09-27 18:58:30 +02:00
Hauke Petersen
7701aed546 Merge pull request #3164 from kaspar030/remove_uart0
sys: remove uart0
2015-09-04 18:54:30 +02:00
0e4386a46f native: remove uart0 2015-09-04 17:46:23 +02:00
ef972735dc sys: net: replace dev_eth with netdev2, adapt native tap driver 2015-09-04 15:39:04 +02:00
Martine Lenders
f0cb1429f0 native: rename ng_nativenet to dev_eth_tap 2015-08-09 22:04:26 +02:00
5d8349298f remove bulk of legacy network stack and drivers 2015-08-06 12:12:47 +02:00
Benoît Canet
22da1f834b native: ng: net: Close tap device and cleanup on reboot 2015-08-03 18:17:53 +02:00
Benoît Canet
800b057fac native: net: Make _native_tap_fd static
One global variable less is always good.
2015-08-03 18:17:52 +02:00
Benoît Canet
4893d4daea native: irq: Get rid of dINT() and eINT()
Get rid of internal usage of the old IRQ
API and keep it's implementation while
waiting for other modules to kill it.
2015-07-29 16:51:22 +02:00
Thomas Eichinger
0c15084db5 native: fix wrong pointer type warning 2015-07-21 18:31:13 +02:00
Hauke Petersen
9943f51080 global: renamed cpu-conf.h into cpu_conf.h 2015-05-28 15:45:05 +02:00
Ludwig Ortmann
015f5598e4 native: cleanup irq_cpu, native_cpu debug output 2014-12-04 10:48:15 +01:00
Ludwig Ortmann
d11238a5ab native: fix some debug messages
`name` isn't part of `tcb_t` anymore, also some function identified itself
wrongly.
2014-11-28 15:37:28 +01:00
Ludwig Ortmann
7901d24053 native: add missing syscall declarations 2014-11-25 22:47:26 +01:00
René Kijewski
677d690e2b core: introduce thread_yield_higher(), yield less
Fixes #1708.

Currently involuntary preemption causes the current thread not only to
yield for a higher prioritized thread, but all other threads of its own
priority class, too.

This PR adds the function `thread_yield_higher()`, which will yield the
current thread in favor of higher prioritized functions, but not for
threads of its own priority class.

Boards now need to implement `thread_yield_higher()` instead of
`thread_yield()`, but `COREIF_NG` boards are not affected in any way.

`thread_yield()` retains its old meaning: yield for every thread that
has the same or a higher priority.

This PR does not touch the occurrences of `thread_yield()` in the periph
drivers, because the author of this PR did not look into the logic of
the various driver implementations.
2014-10-24 00:09:56 +02:00
René Kijewski
a79d9c8562 native: remove redeclarations of sched_active_thread 2014-08-14 13:21:17 +02:00
Ludwig Ortmann
3ca4f18479 doc: use lgplv2.1-short license header instead of lgpl-short-riot 2014-07-31 22:57:20 +02:00
Ludwig Ortmann
bea563d1da Fix a few cppcheck findings 2014-07-25 08:17:06 +02:00
Ludwig Ortmann
aaaccf9d87 native: enable reboot with tap
partially fixes #787
2014-07-13 16:40:32 +02:00
René Kijewski
867246a09f Add argument to thread_create 2014-07-09 10:07:54 +02:00
René Kijewski
2f871ca885 native: remove some warnings about undef functions
This PR implements `real_X` for `X in (fork, dup2, unlink, execve)`.
These function caused warnings while making the default example.
2014-06-18 20:34:12 +02:00
Oleg Hahm
ef5ec344fd core: prefix API functions correctly
Also changed names for bitarithm functions and rename thread_pid to sched_active_pid.
2014-05-18 08:53:20 +02:00
Ludwig Ortmann
98bbb80571 documentation: append my email to my name everywhere 2014-05-15 18:07:17 +02:00