I have found a bug in .../libc/string/generic/memmove.c, which is the one that
MIPS uses, since there's no specialized, optimized version for MIPS.
We're currently using uClibc v. 1.0.12, but I suspect the bug to be present in
earlier releases too.
Here's a snippet from memmove.c#memmove():
---------------------oOo---------------------
/* This test makes the forward copying code be used whenever possible.
Reduces the working set. */
if (dstp - srcp >= len) /* *Unsigned* compare! */
{
#ifndef __ARCH_HAS_BWD_MEMCPY__
/* Backward memcpy implementation cannot be used */
memcpy(dest, src, len);
#else
/* Copy from the beginning to the end. */
---------------------oOo---------------------
Given the name of the define (__ARCH_HAS_BWD_MEMCPY__) it sounds as when this is
defined, the architecture indeed has backward memcpy() support. But how come the
line is preceded by #ifndef and not #ifdef, when the code inside calls memcpy()?
Also, the first comment inside the #ifndef seems odd, since memcpy() indeed is called:
/* Backward memcpy implementation cannot be used */
Our SDK does not define __ARCH_HAS_BWD_MEMCPY__, so when memmove()
resorts to a simple memcpy() that does the wrong thing for overlapping regions,
our application fails with disastrous side-effects.
I have attached a patch that fixes this.
Please CC me in case of any inquiries/replies: rene.nielsen (at) microsemi.com
Thanks & regards,
Rene Schipp von Branitz Nielsen
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via a2125b1bbae2d193d19d8fe8695b7677399a2a7c (commit)
from 150e5d7b3978b378ee76eee796d8c8e389884cc3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a2125b1bbae2d193d19d8fe8695b7677399a2a7c
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Fri Apr 29 18:57:17 2016 +0200
nptl/tls tests need shared library support
-----------------------------------------------------------------------
Summary of changes:
test/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Makefile b/test/Makefile
index 138308e..532a43a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -30,7 +30,7 @@ endif
ifneq ($(UCLIBC_HAS_REGEX),y)
DIRS := $(filter-out regex,$(DIRS))
endif
-ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+ifneq ($(HAVE_SHARED)$(UCLIBC_HAS_THREADS_NATIVE),yy)
DIRS := $(filter-out tls nptl,$(DIRS))
endif
ifneq ($(UCLIBC_HAS_WCHAR),y)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
Thanks, Lance, for backing me up here and for shedding further light on the issue.
I wondered why Waldemar is asking so much about use of floating point, so I double-checked the kernel. It is indeed compiled with "CONFIG_CPU_R4K_FPU=y", but during boot it will figure out that there's no H/W FPU support on the actual CPU and therefore not push/pop FPU regs during task switches.
How it resorts to doing soft-float is not crystal clear to me.
I looked at the changeset you mentioned, Waldemar (2636b17616a19d628c3dbc373ebae67ef6e2b1f6), to get an idea why you are so keen to know about floating point.
Then I modified .../libc/string/mips/memcpy.S to see which macros were defined and which were not. I got to this conclusion:
ANDROID_CHANGES undefined
_LIBC defined
_MIPS_ISA_MIPS32 defined
DISABLE_PREFETCH undefined, so USE_PREFETCH gets defined
_MIPS_SIM undefined
USE_DOUBLE remains undefined
L defined
PTR_ADDIU defined
PTR_SRA defined
PTR_LSA undefined, but gets defined to lsa
Hope it points in the right direction.
Thanks,
René
-----Original Message-----
From: Lance Fredrickson [mailto:lancethepants@gmail.com]
Sent: 26. april 2016 16:18
To: Rene Nielsen <rene.nielsen(a)microsemi.com>
Subject: Re: [uclibc-ng-devel] memmove() is failing on MIPS CPU
I've also experienced the same issues described by Rene. Up until now I've been applying the patches that entware-ng/optware-ng use which revert the mipsel changes between 1.0.9 and 1.0.10.
Without Rene's patch, or reverting those mipsel commits, Rene's test.c fails to run, and experiences same error's he experiences.
With his patch it is working as expected.
Note: with or without patching, the static "test" binary I make works with qemu on x64_86 machine. It's only when I run it on the actual mipsel hardware that it fails. So testing with qemu for whatever reason is not an indication in this case of how it will work on the actual hardware.
kernel 2.6.22.19
binutils 2.25.1
gcc 5.3.0
mips32 soft-float
I'm working with routers like entware-ng/optware-ng, so am also stuck on the same kernel they are. I know entware-ng is using cross-tools-ng for their toolchain. I am using buildroot for mine.
thanks,
Lance
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 150e5d7b3978b378ee76eee796d8c8e389884cc3 (commit)
from cf6c40b8881cfe78e134e2919b184e04025c1e25 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 150e5d7b3978b378ee76eee796d8c8e389884cc3
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Tue Apr 26 20:55:28 2016 +0200
fixup stupid mixup of Makefile copyright and C code
-----------------------------------------------------------------------
Summary of changes:
test/string/tst-memmove.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/string/tst-memmove.c b/test/string/tst-memmove.c
index 799e72e..2adc527 100644
--- a/test/string/tst-memmove.c
+++ b/test/string/tst-memmove.c
@@ -1,5 +1,7 @@
-# Copyright (C) 2016 Rene Nielsen <rene.nielsen(a)microsemi.com>
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+/*
+ * Copyright (C) 2016 Rene Nielsen <rene.nielsen(a)microsemi.com>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <string.h>
#include <stdio.h>
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via cf6c40b8881cfe78e134e2919b184e04025c1e25 (commit)
from 2b3cdadee36b0445ed799932358dd94a1e839b46 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cf6c40b8881cfe78e134e2919b184e04025c1e25
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Tue Apr 26 19:43:48 2016 +0200
test: add memmove test
Triggers a bug in MIPS code under certain circumstances, which
are unclear at the moment.
-----------------------------------------------------------------------
Summary of changes:
test/string/tst-memmove.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 test/string/tst-memmove.c
diff --git a/test/string/tst-memmove.c b/test/string/tst-memmove.c
new file mode 100644
index 0000000..799e72e
--- /dev/null
+++ b/test/string/tst-memmove.c
@@ -0,0 +1,44 @@
+# Copyright (C) 2016 Rene Nielsen <rene.nielsen(a)microsemi.com>
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+#include <string.h>
+#include <stdio.h>
+
+#define LEN 1024
+
+int main(int argc, char *argv[])
+{
+ unsigned char a[LEN], exp;
+ int i, move_len, move_src, err = 0;
+
+ // Fill the array with increasing values from 0 to LEN - 1 (wrap is fine)
+ for (i = 0; i < LEN; i++) {
+ a[i] = i;
+ }
+
+ // move_src is the index into the array to move from.
+ // move_len is the number of indices to move. Here, we take the remainder.
+ move_src = LEN / 64;
+ move_len = LEN - move_src;
+
+ printf("Moving %d entries from index %d to 0\n", move_len, move_src);
+ memmove(a, &a[move_src], sizeof(a[0]) * move_len);
+
+ // Check that the memmove went well
+ for (i = 0; i < LEN; i++) {
+ // Expect that the first #move_len entries contain increasing values
+ // starting at #move_src and the last #move_src entries are untouched.
+ exp = i >= move_len ? i : i + move_src;
+ if (a[i] != exp) {
+ printf("Error: memmove() failed. Expected a[%d] = %u, got %u\n", i, exp, a[i]);
+ err = 1;
+ }
+ }
+
+ if (!err) {
+ printf("memmove() succeeded\n");
+ }
+
+ return err;
+}
+
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 2b3cdadee36b0445ed799932358dd94a1e839b46 (commit)
from f1dcb9beedc5d05238e90cfbad026736d6efe891 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2b3cdadee36b0445ed799932358dd94a1e839b46
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Sat Apr 23 12:17:56 2016 +0200
sparc: add deprecated context switching functions
Ported over from glibc mostly without changes.
Lightly tested with mongrel2 in qemu-system-sparc.
-----------------------------------------------------------------------
Summary of changes:
extra/Configs/Config.sparc | 1 +
libc/sysdeps/linux/sparc/Makefile.arch | 3 +
libc/sysdeps/linux/sparc/getcontext.S | 84 +++++++++++++++++++++++
libc/sysdeps/linux/sparc/makecontext.c | 92 +++++++++++++++++++++++++
libc/sysdeps/linux/sparc/setcontext.S | 118 ++++++++++++++++++++++++++++++++
libc/sysdeps/linux/sparc/swapcontext.S | 118 ++++++++++++++++++++++++++++++++
libc/sysdeps/linux/sparc/ucontext_i.sym | 61 +++++++++++++++++
7 files changed, 477 insertions(+)
create mode 100644 libc/sysdeps/linux/sparc/getcontext.S
create mode 100644 libc/sysdeps/linux/sparc/makecontext.c
create mode 100644 libc/sysdeps/linux/sparc/setcontext.S
create mode 100644 libc/sysdeps/linux/sparc/swapcontext.S
create mode 100644 libc/sysdeps/linux/sparc/ucontext_i.sym
diff --git a/extra/Configs/Config.sparc b/extra/Configs/Config.sparc
index 47c8ac2..8b5da33 100644
--- a/extra/Configs/Config.sparc
+++ b/extra/Configs/Config.sparc
@@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
bool
default y
select ARCH_BIG_ENDIAN
+ select ARCH_HAS_UCONTEXT
select ARCH_HAS_DEPRECATED_SYSCALLS
choice
diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch
index 0173eff..92ea7d9 100644
--- a/libc/sysdeps/linux/sparc/Makefile.arch
+++ b/libc/sysdeps/linux/sparc/Makefile.arch
@@ -13,6 +13,9 @@ SSRC-y := \
SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.S vfork.S clone.S
+CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
+SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
+
# check weather __LONG_DOUBLE_128__ is defined (long double support)
UCLIBC_SPARC_HAS_LONG_DOUBLE=$(shell if [ "x`$(CC) -E -dM -xc /dev/null 2>&1 | grep __LONG_DOUBLE_128__`" != "x" ]; then echo "y"; fi)
ifeq ($(UCLIBC_SPARC_HAS_LONG_DOUBLE),y)
diff --git a/libc/sysdeps/linux/sparc/getcontext.S b/libc/sysdeps/linux/sparc/getcontext.S
new file mode 100644
index 0000000..615a2c1
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/getcontext.S
@@ -0,0 +1,84 @@
+/* Save current context.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem(a)davemloft.net>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* int __getcontext (ucontext_t *ucp)
+
+ Saves the machine context in UCP such that when it is activated,
+ it appears as if __getcontext() returned again.
+
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to save anything
+ other than the PRESERVED state. */
+
+
+ENTRY(__getcontext)
+ save %sp, -112, %sp
+ st %g0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_PSR]
+
+ /* In reality, we only use the GREG_PC value when setting
+ or swapping contexts. But we fill in NPC for completeness. */
+ add %i7, 8, %o0
+ st %o0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_PC]
+ add %o0, 4, %o0
+ st %o0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_NPC]
+
+ rd %y, %o1
+ st %o1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_Y]
+
+ st %g1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G1]
+ st %g2, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G2]
+ st %g3, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G3]
+ st %g4, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G4]
+ st %g5, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G5]
+ st %g6, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G6]
+ st %g7, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G7]
+
+ mov SIG_BLOCK, %o0
+ clr %o1
+ add %i0, UC_SIGMASK, %o2
+ mov 8, %o3
+ mov __NR_rt_sigprocmask, %g1
+ ta 0x10
+
+ /* Zero, success, return value. */
+ st %g0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O0]
+ st %i1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O1]
+ st %i2, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O2]
+ st %i3, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O3]
+ st %i4, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O4]
+ st %i5, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O5]
+ st %i6, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O6]
+ st %i7, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O7]
+
+ st %g0, [%i0 + UC_MCONTEXT + MC_GWINS]
+
+ /* Do not save FPU state, it is volatile across calls. */
+ stb %g0, [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_EN]
+
+ st %g0, [%i0 + UC_MCONTEXT + MC_XRS + XRS_ID]
+ st %g0, [%i0 + UC_MCONTEXT + MC_XRS + XRS_PTR]
+ jmpl %i7 + 8, %g0
+ restore %g0, %g0, %o0
+END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/libc/sysdeps/linux/sparc/makecontext.c b/libc/sysdeps/linux/sparc/makecontext.c
new file mode 100644
index 0000000..3a9f70c
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/makecontext.c
@@ -0,0 +1,92 @@
+/* Create new context.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem(a)davemloft.net>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <ucontext.h>
+
+/* Sets up the outgoing arguments and the program counter for a user
+ context for the requested function call.
+
+ Returning to the correct parent context is pretty simple on
+ Sparc. We only need to link up the register windows correctly.
+ Since global registers are clobbered by calls, we need not be
+ concerned about those, and thus is all could be worked out without
+ using a trampoline.
+
+ Except that we must deal with the signal mask, thus a trampoline
+ is unavoidable. 32-bit stackframe layout:
+ +-----------------------------------------+
+ | 7th and further parameters |
+ +-----------------------------------------+
+ | backup storage for initial 6 parameters |
+ +-----------------------------------------+
+ | struct return pointer |
+ +-----------------------------------------+
+ | 8 incoming registers |
+ +-----------------------------------------+
+ | 8 local registers |
+ %sp --> +-----------------------------------------+
+
+*/
+
+void
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ extern void __start_context (void);
+ unsigned long int *sp;
+ va_list ap;
+ int i;
+
+ sp = (unsigned long int *) (ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+ sp -= 16 + 7 + argc;
+ sp = (unsigned long int *) (((uintptr_t) sp) & ~(8 - 1));
+
+ for (i = 0; i < 8; i++)
+ sp[i + 8] = ucp->uc_mcontext.gregs[REG_O0 + i];
+
+ /* The struct return pointer is essentially unused, so we can
+ place the link there. */
+ sp[16] = (unsigned long int) ucp->uc_link;
+
+ va_start (ap, argc);
+
+ /* Fill in outgoing arguments, including those which will
+ end up being passed on the stack. */
+ for (i = 0; i < argc; i++)
+ {
+ unsigned long int arg = va_arg (ap, unsigned long int);
+ if (i < 6)
+ ucp->uc_mcontext.gregs[REG_O0 + i] = arg;
+ else
+ sp[i + 23 - 6] = arg;
+ }
+
+ va_end (ap);
+
+ ucp->uc_mcontext.gregs[REG_O6] = (unsigned long int) sp;
+
+ ucp->uc_mcontext.gregs[REG_O7] = ((unsigned long int) __start_context) - 8;
+
+ ucp->uc_mcontext.gregs[REG_PC] = (unsigned long int) func;
+ ucp->uc_mcontext.gregs[REG_nPC] = ucp->uc_mcontext.gregs[REG_PC] + 4;
+}
+
+weak_alias (__makecontext, makecontext)
diff --git a/libc/sysdeps/linux/sparc/setcontext.S b/libc/sysdeps/linux/sparc/setcontext.S
new file mode 100644
index 0000000..f9da215
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/setcontext.S
@@ -0,0 +1,118 @@
+/* Install given context.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem(a)davemloft.net>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+#define ST_FLUSH_WINDOWS 3
+
+/* int __setcontext (const ucontext_t *ucp)
+
+ Restores the machine context in UCP and thereby resumes execution
+ in that context.
+
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to restore anything
+ other than the PRESERVED state. */
+
+ENTRY(__setcontext)
+ save %sp, -112, %sp
+
+ mov SIG_SETMASK, %o0
+ add %i0, UC_SIGMASK, %o1
+ clr %o2
+ mov 8, %o3
+ mov __NR_rt_sigprocmask, %g1
+ ta 0x10
+
+ /* This is a bit on the expensive side, and we could optimize
+ the unwind similar to how the 32-bit sparc longjmp code
+ does if performance of this routine really matters. */
+ ta ST_FLUSH_WINDOWS
+
+ ldub [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_EN], %g1
+ cmp %g1, 0
+ be 1f
+ nop
+ ld [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_FSR], %fsr
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D0], %f0
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D2], %f2
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D4], %f4
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D6], %f6
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D8], %f8
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D10], %f10
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D12], %f12
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D14], %f14
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D16], %f16
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D18], %f18
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D20], %f20
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D22], %f22
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D24], %f24
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D26], %f26
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D28], %f28
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D30], %f30
+1:
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_Y], %g1
+ wr %g1, 0x0, %y
+
+ /* We specifically do not restore %g1 since we need it here as
+ a temporary. */
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G2], %g2
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G3], %g3
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G4], %g4
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G5], %g5
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G6], %g6
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G7], %g7
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O1], %i1
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O2], %i2
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O3], %i3
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O4], %i4
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O5], %i5
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O6], %i6
+ restore
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_O7], %o7
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_PC], %g1
+ jmpl %g1, %g0
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_O0], %o0
+END(__setcontext)
+
+weak_alias (__setcontext, setcontext)
+
+/* This is the helper code which gets called if a function which is
+ registered with 'makecontext' returns. In this case we have to
+ install the context listed in the uc_link element of the context
+ 'makecontext' manipulated at the time of the 'makecontext' call.
+ If the pointer is NULL the process must terminate. */
+
+ENTRY(__start_context)
+ ld [%sp + (16 * 4)], %g1
+ cmp %g1, 0
+ be,a 1f
+ clr %o0
+ call __setcontext
+ mov %g1, %o0
+ /* If this returns (which can happen if the syscall fails) we'll
+ exit the program with the return error value (-1). */
+1: call HIDDEN_JUMPTARGET(exit)
+ nop
+ /* The 'exit' call should never return. In case it does cause
+ the process to terminate. */
+ unimp
+END(__start_context)
diff --git a/libc/sysdeps/linux/sparc/swapcontext.S b/libc/sysdeps/linux/sparc/swapcontext.S
new file mode 100644
index 0000000..7dc7e2e
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/swapcontext.S
@@ -0,0 +1,118 @@
+/* Save current context and install the given one.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem(a)davemloft.net>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+#define ST_FLUSH_WINDOWS 3
+
+/* int __swapcontext (ucontext_t *oucp, const ucontext_t *ucp);
+
+ Saves the machine context in oucp such that when it is activated,
+ it appears as if __swapcontext() returned again, restores the
+ machine context in ucp and thereby resumes execution in that
+ context.
+
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to save anything
+ other than the PRESERVED state. */
+
+ENTRY(__swapcontext)
+ save %sp, -112, %sp
+ ta ST_FLUSH_WINDOWS
+ st %g0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_PSR]
+ add %i7, 8, %o0
+ st %o0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_PC]
+ add %o0, 4, %o0
+ st %o0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_NPC]
+ rd %y, %o1
+ st %o1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_Y]
+ st %g1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G1]
+ st %g2, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G2]
+ st %g3, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G3]
+ st %g4, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G4]
+ st %g5, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G5]
+ st %g6, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G6]
+ st %g7, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G7]
+ st %g0, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O0]
+ st %i1, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O1]
+ st %i2, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O2]
+ st %i3, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O3]
+ st %i4, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O4]
+ st %i5, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O5]
+ st %i6, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O6]
+ st %i7, [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O7]
+ st %g0, [%i0 + UC_MCONTEXT + MC_GWINS]
+ stb %g0, [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_EN]
+ st %g0, [%i0 + UC_MCONTEXT + MC_XRS + XRS_ID]
+ st %g0, [%i0 + UC_MCONTEXT + MC_XRS + XRS_PTR]
+
+ mov SIG_SETMASK, %o0
+ add %i1, UC_SIGMASK, %o1
+ add %i0, UC_SIGMASK, %o2
+ mov 8, %o3
+ mov __NR_rt_sigprocmask, %g1
+ ta 0x10
+
+ mov %i1, %i0
+ ldub [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_EN], %g1
+ cmp %g1, 0
+ be 1f
+ nop
+ ld [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_FSR], %fsr
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D0], %f0
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D2], %f2
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D4], %f4
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D6], %f6
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D8], %f8
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D10], %f10
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D12], %f12
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D14], %f14
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D16], %f16
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D18], %f18
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D20], %f20
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D22], %f22
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D24], %f24
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D26], %f26
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D28], %f28
+ ldd [%i0 + UC_MCONTEXT + MC_FPREGS + FPU_D30], %f30
+1:
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_Y], %g1
+ wr %g1, 0x0, %y
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G2], %g2
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G3], %g3
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G4], %g4
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G5], %g5
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G6], %g6
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_G7], %g7
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O1], %i1
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O2], %i2
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O3], %i3
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O4], %i4
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O5], %i5
+ ld [%i0 + UC_MCONTEXT + MC_GREGS + GREG_O6], %i6
+ restore
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_O7], %o7
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_PC], %g1
+ jmpl %g1, %g0
+ ld [%o0 + UC_MCONTEXT + MC_GREGS + GREG_O0], %o0
+END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/libc/sysdeps/linux/sparc/ucontext_i.sym b/libc/sysdeps/linux/sparc/ucontext_i.sym
new file mode 100644
index 0000000..544030c
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/ucontext_i.sym
@@ -0,0 +1,61 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+UC_FLAGS offsetof (ucontext_t, uc_flags)
+UC_LINK offsetof (ucontext_t, uc_link)
+UC_SIGMASK offsetof (ucontext_t, uc_sigmask)
+UC_STACK offsetof (ucontext_t, uc_stack)
+UC_MCONTEXT offsetof (ucontext_t, uc_mcontext)
+MC_GREGS offsetof (mcontext_t, gregs)
+MC_GWINS offsetof (mcontext_t, gwins)
+MC_FPREGS offsetof (mcontext_t, fpregs)
+MC_XRS offsetof (mcontext_t, xrs)
+MC_FILLER offsetof (mcontext_t, filler)
+GREG_PSR (REG_PSR * sizeof(greg_t))
+GREG_PC (REG_PC * sizeof(greg_t))
+GREG_NPC (REG_nPC * sizeof(greg_t))
+GREG_Y (REG_Y * sizeof(greg_t))
+GREG_G1 (REG_G1 * sizeof(greg_t))
+GREG_G2 (REG_G2 * sizeof(greg_t))
+GREG_G3 (REG_G3 * sizeof(greg_t))
+GREG_G4 (REG_G4 * sizeof(greg_t))
+GREG_G5 (REG_G5 * sizeof(greg_t))
+GREG_G6 (REG_G6 * sizeof(greg_t))
+GREG_G7 (REG_G7 * sizeof(greg_t))
+GREG_O0 (REG_O0 * sizeof(greg_t))
+GREG_O1 (REG_O1 * sizeof(greg_t))
+GREG_O2 (REG_O2 * sizeof(greg_t))
+GREG_O3 (REG_O3 * sizeof(greg_t))
+GREG_O4 (REG_O4 * sizeof(greg_t))
+GREG_O5 (REG_O5 * sizeof(greg_t))
+GREG_O6 (REG_O6 * sizeof(greg_t))
+GREG_O7 (REG_O7 * sizeof(greg_t))
+FPU_D0 offsetof (fpregset_t, fpu_fr.fpu_dregs[0])
+FPU_D2 offsetof (fpregset_t, fpu_fr.fpu_dregs[1])
+FPU_D4 offsetof (fpregset_t, fpu_fr.fpu_dregs[2])
+FPU_D6 offsetof (fpregset_t, fpu_fr.fpu_dregs[3])
+FPU_D8 offsetof (fpregset_t, fpu_fr.fpu_dregs[4])
+FPU_D10 offsetof (fpregset_t, fpu_fr.fpu_dregs[5])
+FPU_D12 offsetof (fpregset_t, fpu_fr.fpu_dregs[6])
+FPU_D14 offsetof (fpregset_t, fpu_fr.fpu_dregs[7])
+FPU_D16 offsetof (fpregset_t, fpu_fr.fpu_dregs[8])
+FPU_D18 offsetof (fpregset_t, fpu_fr.fpu_dregs[9])
+FPU_D20 offsetof (fpregset_t, fpu_fr.fpu_dregs[10])
+FPU_D22 offsetof (fpregset_t, fpu_fr.fpu_dregs[11])
+FPU_D24 offsetof (fpregset_t, fpu_fr.fpu_dregs[12])
+FPU_D26 offsetof (fpregset_t, fpu_fr.fpu_dregs[13])
+FPU_D28 offsetof (fpregset_t, fpu_fr.fpu_dregs[14])
+FPU_D30 offsetof (fpregset_t, fpu_fr.fpu_dregs[15])
+FPU_Q offsetof (fpregset_t, fpu_q)
+FPU_FSR offsetof (fpregset_t, fpu_fsr)
+FPU_QCNT offsetof (fpregset_t, fpu_qcnt)
+FPU_Q_ENTRY_SZ offsetof (fpregset_t, fpu_q_entrysize)
+FPU_EN offsetof (fpregset_t, fpu_en)
+XRS_ID offsetof (xrs_t, xrs_id)
+XRS_PTR offsetof (xrs_t, xrs_ptr)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via f1dcb9beedc5d05238e90cfbad026736d6efe891 (commit)
from 1c815cddb63026be7d548e4e1e27110d92165830 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f1dcb9beedc5d05238e90cfbad026736d6efe891
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Thu Apr 21 20:20:53 2016 +0200
dltest: fix a typo
-----------------------------------------------------------------------
Summary of changes:
test/dlopen/dltest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/dlopen/dltest.c b/test/dlopen/dltest.c
index b5fa1cd..a0fac90 100644
--- a/test/dlopen/dltest.c
+++ b/test/dlopen/dltest.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
ret = EXIT_FAILURE;
printf("dltest: values should NOT be equal Weak values resolved incorrectly!\n");
} else {
- printf("dltest: weak symbols resoved correctly.\n");
+ printf("dltest: weak symbols resolved correctly.\n");
}
dlclose(handle);
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
Hi embedded hackers,
the new release is uploaded, see here the changes made:
Alexey Neyman (1):
Provide an alias to _obstack_free
Anthony G. Basile (1):
bits/byteswap-common.h: import recent headers from glibc
Max Filippov (1):
xtensa: fix __sigsetjmp call12 case
Nikola Forró (1):
replace FSF addresses with URLs
Thomas Petazzoni (1):
arm: simplify handling of Thumb related options
Waldemar Brodkorb (10):
frv: enable in config
nptl: remove useless text files
remove accidentally added files while cleaning up incomplete sparcv9 support
add copyright find script
unlimited access to macros
mips: refresh ULPS file for math tests
simplify getpagesize, do not depend on kernel macros
remove m68k binutils workarounds
remove unused defines for lm32/or1k
bump version for release
Please report back any issues,
best regards
Waldemar
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The annotated tag, v1.0.14 has been created
at a436c575571807595d3c2e9f400f1f9ce496e44a (tag)
tagging 1c815cddb63026be7d548e4e1e27110d92165830 (commit)
replaces v1.0.13
tagged by Waldemar Brodkorb
on Mon Apr 18 19:29:15 2016 +0200
- Log -----------------------------------------------------------------
release 1.0.14 - Chimay Tripel
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iQIcBAABCAAGBQJXFRlsAAoJEMEz+QKmmH5ifYoQALEgBuA5N9/JmZr9Hq2FIRht
ltB3LBuAFxs5Hclis6ZOKD5/hvAh+5JnIKZErBiv/wjYeQ7siPLTRao+BrDVGk8n
l2l/2wYwlhD5M5nITfHIL1ggS9J32T/g+5p9MCdrQXx/Kj5BqoVldl+d7OOJDVso
epKpqFj9MC9FDnTyv7FpYw7AZG51c5ha9sfCu0+SG5fwnKEtJKjeBa3wUV+JdkWE
MqoHcy7l7QMn0fYZO/t2kba/EO02moKQz9wTFcfgbc8kPyUSp3am2OIQTnw3Zwfh
fOFJ9eQbkLHkOyZq/73GFgQW+lblP5rUGGocus6H+T3h9vxIqOv1TPxttpFl6l5g
ws5hLJGCfnaSqfJ8+OYqd8cP1B+HlHRqhwp/8VjY51uMOEqLvUgvQxMzKjakPr9C
55YkVe0wtwed2HYZGUd/wJUA2zhEFk335YJKD6//1kbRDIB5dotqjCnbyreL02Cc
1iKMvt9GbFgVb0IGHjzTw8z22sJX9yzsoDt81U/Gn/pAfDZAbXq9QIptvOSdvHyo
r6v4z54QB5yLkBh0FgMLiPhzkamDy0Ku0C6U2e91x+pnCV/4D2QyK3WuSYV0gmxA
wy3UJD2GPwGEi3uE1hFHp8TMnAB8ZU5Pt5TYXPQnghfkx0ZyVuCmqkPYvC8Kbn+0
GlSu2GXoXhnz+OWLv4Ls
=xBHA
-----END PGP SIGNATURE-----
Alexey Neyman (1):
Provide an alias to _obstack_free
Anthony G. Basile (1):
bits/byteswap-common.h: import recent headers from glibc
Max Filippov (1):
xtensa: fix __sigsetjmp call12 case
Nikola Forró (1):
replace FSF addresses with URLs
Thomas Petazzoni (1):
arm: simplify handling of Thumb related options
Waldemar Brodkorb (10):
frv: enable in config
nptl: remove useless text files
remove accidentally added files while cleaning up incomplete sparcv9 support
add copyright find script
unlimited access to macros
mips: refresh ULPS file for math tests
simplify getpagesize, do not depend on kernel macros
remove m68k binutils workarounds
remove unused defines for lm32/or1k
bump version for release
-----------------------------------------------------------------------
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 1c815cddb63026be7d548e4e1e27110d92165830 (commit)
via 5cd5bcb616b6e0d3536a8bfa45fa187035f45abd (commit)
from 3f98fdc552249b66cdc03a082ce0b866fe5bf57f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1c815cddb63026be7d548e4e1e27110d92165830
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Mon Apr 18 19:28:03 2016 +0200
bump version for release
commit 5cd5bcb616b6e0d3536a8bfa45fa187035f45abd
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Sun Apr 17 20:09:07 2016 +0200
remove unused defines for lm32/or1k
-----------------------------------------------------------------------
Summary of changes:
Rules.mak | 2 +-
libc/sysdeps/linux/lm32/bits/uClibc_arch_features.h | 3 ---
libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h | 3 ---
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/Rules.mak b/Rules.mak
index dc1a02e..405fe39 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -126,7 +126,7 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR
# Now config hard core
MAJOR_VERSION := 1
MINOR_VERSION := 0
-SUBLEVEL := 13
+SUBLEVEL := 14
EXTRAVERSION :=
VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
ABI_VERSION := $(MAJOR_VERSION)
diff --git a/libc/sysdeps/linux/lm32/bits/uClibc_arch_features.h b/libc/sysdeps/linux/lm32/bits/uClibc_arch_features.h
index a64f653..03cb0ca 100644
--- a/libc/sysdeps/linux/lm32/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/lm32/bits/uClibc_arch_features.h
@@ -12,9 +12,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use syscall4() for truncate64 ? (32bit arches only) */
-#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
-
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
diff --git a/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
index f4b2169..e11e71f 100644
--- a/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/or1k/bits/uClibc_arch_features.h
@@ -14,9 +14,6 @@
/* can your target use syscall6() for mmap ? */
#define __UCLIBC_MMAP_HAS_6_ARGS__
-/* does your target use syscall4() for truncate64 ? (32bit arches only) */
-#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
-
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
hooks/post-receive
--
uClibc-ng - small C library for embedded systems