]> sourceware.org Git - newlib-cygwin.git/commitdiff
pru: Fix memory corruption on syscall return
authorDimitar Dimitrov <dimitar@dinux.eu>
Wed, 3 Jun 2020 16:14:22 +0000 (19:14 +0300)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 2 Jul 2020 09:00:33 +0000 (11:00 +0200)
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>
libgloss/pru/syscalls.S

index 8ed7601a46d7b405bb9b48549736fa8ecb3ebd9a..3ad0d9215ea6fa19da85494e60de4336841779e9 100644 (file)
@@ -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
This page took 0.031947 seconds and 5 git commands to generate.