Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2020-06-03 19:14:22 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-07-02 12:00:33 +0300
commit70cd4cbe651388897539fe38d2610e9bb733c5a8 (patch)
tree896d272daa155de64789654ab79f180755912bd3 /libgloss/pru
parent5266248285bb3d2d012abd8a73957a0368f252ff (diff)
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>
Diffstat (limited to 'libgloss/pru')
-rw-r--r--libgloss/pru/syscalls.S1
1 files changed, 1 insertions, 0 deletions
diff --git a/libgloss/pru/syscalls.S b/libgloss/pru/syscalls.S
index 8ed7601a4..3ad0d9215 100644
--- a/libgloss/pru/syscalls.S
+++ b/libgloss/pru/syscalls.S
@@ -42,6 +42,7 @@ __SC_ret:
/* Invert return code and store to errno (first int in _impure_ptr). */
rsb r14, r14, 0
ldi32 r1, _impure_ptr
+ lbbo r1, r1, 0, 4
sbbo r14, r1, 0, 4
/* Return -1 (for both int32_t or int64_t). */
fill r14, 8