Commit Graph

4 Commits

Author SHA1 Message Date
Dimitar Dimitrov 21f0edbf9f libgloss: pru: Fix _open syscal arguments
The _open() C function is declared as having variable arguments in
newlib, so second and third arguments are passed on stack. Add code to
move them into registers, since that's where the PRU simulator expects
them.

Issue was exposed by the GCC test gcc.c-torture/execute/fprintf-2.c,
which relies on tmpnam implementation to pass correct flags to _open.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-04-27 11:43:08 +02:00
Dimitar Dimitrov 464c3f5d22 libgloss: pru: Place sim syscalls into their own sections
This should help reduce final ELF size if using --gc-sections linker
option.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-06-09 14:12:30 -04:00
Dimitar Dimitrov 70cd4cbe65 pru: Fix memory corruption on syscall return
In the initial code I missed one level of pointer indirection. Instead
of storing errno in impure_data, _impure_ptr was corrupted.

Only simulator is impacted. Real targets have no OS and no syscalls.

This resolves a bunch of stdio cases from the GCC testsuite:
  FAIL->PASS: gcc.c-torture/execute/printf-2.c   -O0  execution test

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-07-02 11:00:33 +02:00
Dimitar Dimitrov 0c7734673a Initial PRU port for libgloss and newlib
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2019-10-31 14:47:19 -04:00