From c09e41ef92e48356e62c795384864ee792ac7fe6 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:19 +0200 Subject: Revert "sparc: use HIDDEN_JUMPTARGET for errno" This reverts commit f51fb26dbcceee9e48d10facc830bd4a549f6cc2. This fixes linking error for sparc build. While building a sparc system you get following linking error: libc/sysdeps/linux/sparc/pipe.S:54: undefined reference to `__GI___errno_location' Removing the HIDDEN_JUMPTARGET fixes the issue, while using gcc 4.8.3/binutils 2.24. The definition of __errno_location was changed recently here: http://git.uclibc.org/uClibc/commit/?id=8f550715c2b211036fc273add3cb5219397ed312 Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/sparc/fork.S | 2 +- libc/sysdeps/linux/sparc/pipe.S | 2 +- libc/sysdeps/linux/sparc/vfork.S | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index 8e4bc2265..171591123 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -35,7 +35,7 @@ fork: bcc,a 9000f nop save %sp,-96,%sp - call HIDDEN_JUMPTARGET(__errno_location) + call __errno_location nop st %i0,[%o0] jmpl %i7+8,%g0 diff --git a/libc/sysdeps/linux/sparc/pipe.S b/libc/sysdeps/linux/sparc/pipe.S index b085fafec..fa77f4d23 100644 --- a/libc/sysdeps/linux/sparc/pipe.S +++ b/libc/sysdeps/linux/sparc/pipe.S @@ -49,7 +49,7 @@ pipe: restore %g0,%g0,%o0 .Lerror: - call HIDDEN_JUMPTARGET(__errno_location) + call __errno_location or %g0,EINVAL,%i0 st %i0,[%o0] ret diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index 4b701f7ff..e5a3c303d 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -37,7 +37,7 @@ __vfork: bcc,a 9000f nop save %sp,-96,%sp - call HIDDEN_JUMPTARGET(__errno_location) + call __errno_location nop st %i0,[%o0] jmpl %i7+8,%g0 -- cgit v1.2.3 From 789fca90bff0b0bcd658444cea6afd4cdb43dc5d Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:20 +0200 Subject: Revert "sparc: disable cancellable system, as it fails in strange ways right now" This reverts commit 1db4f8f8389f6a935ecd83aff7fcce5d1cf2c0f3. It is unclear in which way this is breaking sparc systems. With this change added you get following linking error: libpthread/nptl/libpthread_so.a(pt-system.oS): In function `__libc_system': libc/stdlib/system.c:64: undefined reference to `__wait4_nocancel' Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libc/stdlib/system.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index 151a229c6..8c5d25d51 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -18,13 +18,14 @@ #include #endif -extern __typeof(system) __libc_system; - -/* TODO: the cancellable version breaks on sparc currently, - * need to figure out why still - */ -#if !defined __UCLIBC_HAS_THREADS_NATIVE__ || defined __sparc__ +#if !defined __UCLIBC_HAS_THREADS_NATIVE__ +/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ +#include +#ifndef __NR_vfork +# define vfork fork +#endif +extern __typeof(system) __libc_system; int __libc_system(const char *command) { int wait_val, pid; -- cgit v1.2.3 From 10d05ca07c4632e8dfca4877a8fc6a458b8f5810 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:21 +0200 Subject: sparc: remove unused subdirs variable For sparc TARGET_SUBARCH is never used. And there is a typo in the path. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/sysdeps/sparc/Makefile.arch | 3 --- 1 file changed, 3 deletions(-) diff --git a/libpthread/nptl/sysdeps/sparc/Makefile.arch b/libpthread/nptl/sysdeps/sparc/Makefile.arch index 52ac6dbe0..f9662c60c 100644 --- a/libpthread/nptl/sysdeps/sparc/Makefile.arch +++ b/libpthread/nptl/sysdeps/sparc/Makefile.arch @@ -4,8 +4,5 @@ # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)/sparv9 CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE - - -- cgit v1.2.3 From 68d700d66bfe498eeccd03ba44dd2081e34441d0 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:22 +0200 Subject: sparc: add missing pthread_spin_lock/pthread_spin_trylock tst-spin1.c compile breaks with: test/nptl/tst-spin1.c:34: undefined reference to `pthread_spin_lock' pthread_spin_lock and pthread_spin_trylock is missing while building sparc. add the meta c files here. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c | 5 +++++ libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c create mode 100644 libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c diff --git a/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c b/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c new file mode 100644 index 000000000..dcc5ae28e --- /dev/null +++ b/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c @@ -0,0 +1,5 @@ +#if defined(__arch64__) +#include "sparc64/pthread_spin_lock.c" +#else +#include "sparc32/pthread_spin_lock.c" +#endif diff --git a/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c new file mode 100644 index 000000000..af63eec73 --- /dev/null +++ b/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c @@ -0,0 +1,5 @@ +#if defined(__arch64__) +#include "sparc64/pthread_spin_trylock.c" +#else +#include "sparc32/pthread_spin_trylock.c" +#endif -- cgit v1.2.3 From 23abbfa633f7e017a7939aa3966e0d7d24df480d Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:23 +0200 Subject: test: NPTL: sync WRITE_BUFFER_SIZE with glibc test Test on Linux 3.16.1 in Qemu ARM fails with: TEST_EXEC nptl/ tst-cancel4 ret == 1 ; expected_ret == 0 make[1]: *** [tst-cancel4.exe] Error 1 The output of failed test is: minimum write buffer size too large ../Test.mak:89: recipe for target 'tst-cancel4.exe' failed Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- test/nptl/tst-cancel4.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c index e7119589f..53abf83ee 100644 --- a/test/nptl/tst-cancel4.c +++ b/test/nptl/tst-cancel4.c @@ -83,7 +83,30 @@ static pthread_barrier_t b2; # define IPC_ADDVAL 0 #endif -#define WRITE_BUFFER_SIZE 4096 +/* The WRITE_BUFFER_SIZE value needs to be chosen such that if we set + the socket send buffer size to '1', a write of this size on that + socket will block. + + The Linux kernel imposes a minimum send socket buffer size which + has changed over the years. As of Linux 3.10 the value is: + + 2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff))) + + which is attempting to make sure that with standard MTUs, + TCP can always queue up at least 2 full sized packets. + + Furthermore, there is logic in the socket send paths that + will allow one more packet (of any size) to be queued up as + long as some socket buffer space remains. Blocking only + occurs when we try to queue up a new packet and the send + buffer space has already been fully consumed. + + Therefore we must set this value to the largest possible value of + the formula above (and since it depends upon the size of "struct + sk_buff", it is dependent upon machine word size etc.) plus some + slack space. */ + +#define WRITE_BUFFER_SIZE 16384 /* Cleanup handling test. */ static int cl_called; @@ -758,7 +781,6 @@ tf_sigpause (void *arg) pthread_cleanup_push (cl, NULL); - /* Just for fun block the cancellation signal. */ sigpause (SIGCANCEL); pthread_cleanup_pop (0); -- cgit v1.2.3 From ad687dda63a43d5ea5ed834475cec5e0a618ebf5 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:24 +0200 Subject: test: do not depend on compile When you cross-compile the testsuite and then try to run on a system without gcc/binutils it would be nice if no compiling or linking is tried. Refresh test/README (suggested by Khem) Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- test/Makefile | 2 +- test/README | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/Makefile b/test/Makefile index b759bf9ea..787c530d4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -45,7 +45,7 @@ endif test check all: run -run: compile subdirs_run +run: subdirs_run compile: $(top_builddir)$(LOCAL_INSTALL_PATH) subdirs_compile diff --git a/test/README b/test/README index 8fb12d9a7..28225b063 100644 --- a/test/README +++ b/test/README @@ -5,12 +5,11 @@ Following make targets are avaialable make compile -This will compile and link the tests +This will compile and link the tests. make run -This will check for binaries, if they are not there it -will call 'compile' target, then it will execute all the tests. +This will execute all the tests. make check make all -- cgit v1.2.3 From 5a89f1c6964cc938c439d992f187bc87cdd4eb07 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:27 +0200 Subject: m68k: fix typo otherwise you get compile warnings, when building for m68k. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/m68k/bits/huge_vall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/m68k/bits/huge_vall.h b/libc/sysdeps/linux/m68k/bits/huge_vall.h index c44b64dfc..674b46d25 100644 --- a/libc/sysdeps/linux/m68k/bits/huge_vall.h +++ b/libc/sysdeps/linux/m68k/bits/huge_vall.h @@ -26,7 +26,7 @@ # define HUGE_VALL (__builtin_huge_vall ()) #elif __GNUC_PREREQ(2,96) # define HUGE_VALL (__extension__ 0x1.0p32767L) -#elif defined__GNUC__ +#elif defined __GNUC__ # define HUGE_VALL \ (__extension__ \ -- cgit v1.2.3 From 697dbb016e4bc63d20a7c871a9580e7dce32d1b0 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:29 +0200 Subject: test: get out of the endless while loop, when bind failed When bind() fails in this test, then /tmp get filled up with temp files and upcoming tests will fail, because they need to create temp files, too. Better exit from the loop. Test still needs to be investigated to fix the failing bind(). Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- test/nptl/tst-cancel4.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c index 53abf83ee..4ba40450e 100644 --- a/test/nptl/tst-cancel4.c +++ b/test/nptl/tst-cancel4.c @@ -1015,6 +1015,8 @@ tf_accept (void *arg) if (++tries > 10) { printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + /* prevent endless loop, when bind fails forever */ + exit (1); } strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-1-XXXXXX"); -- cgit v1.2.3 From 512fd3804b963a6738ce59d25dd44a7d9143b8b7 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:30 +0200 Subject: test: sync with glibc, use do_test This breaks out of a deadlock, which occurs when testing for powerpc. (qemu) Otherwise the test suite does not finish. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- test/nptl/tst-sem3.c | 33 ++++++++++++++++++--------------- test/nptl/tst-sem4.c | 7 +++++-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/test/nptl/tst-sem3.c b/test/nptl/tst-sem3.c index d14f6f633..7b75e29e2 100644 --- a/test/nptl/tst-sem3.c +++ b/test/nptl/tst-sem3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -28,7 +28,7 @@ int -main (void) +do_test (void) { size_t ps = sysconf (_SC_PAGESIZE); char tmpfname[] = "/tmp/tst-sem3.XXXXXX"; @@ -43,7 +43,7 @@ main (void) if (fd == -1) { printf ("cannot open temporary file: %m\n"); - exit (1); + return 1; } /* Make sure it is always removed. */ @@ -56,14 +56,14 @@ main (void) if (write (fd, data, ps) != (ssize_t) ps) { puts ("short write"); - exit (1); + return 1; } mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (mem == MAP_FAILED) { printf ("mmap failed: %m\n"); - exit (1); + return 1; } s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t)) @@ -73,25 +73,25 @@ main (void) if (sem_init (s, 1, 1) == -1) { puts ("init failed"); - exit (1); + return 1; } if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) { puts ("1st wait failed"); - exit (1); + return 1; } errno = 0; if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1) { puts ("trywait succeeded"); - exit (1); + return 1; } else if (errno != EAGAIN) { puts ("trywait didn't return EAGAIN"); - exit (1); + return 1; } *p = 0; @@ -101,7 +101,7 @@ main (void) if (pid == -1) { puts ("fork failed"); - exit (1); + return 1; } else if (pid == 0) { @@ -109,13 +109,13 @@ main (void) if ((*p)++ != 0) { puts ("child: *p != 0"); - exit (1); + return 1; } if (sem_post (s) == -1) { puts ("child: 1st post failed"); - exit (1); + return 1; } puts ("child done"); @@ -125,17 +125,20 @@ main (void) if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) { printf ("parent: 2nd wait failed: %m\n"); - exit (1); + return 1; } if (*p != 1) { puts ("*p != 1"); - exit (1); + return 1; } puts ("parent done"); } - exit (0); + return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem4.c b/test/nptl/tst-sem4.c index 125759bab..72ed97d37 100644 --- a/test/nptl/tst-sem4.c +++ b/test/nptl/tst-sem4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -32,7 +32,7 @@ remove_sem (int status, void *arg) int -main (void) +do_test (void) { sem_t *s; sem_t *s2; @@ -144,3 +144,6 @@ main (void) return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" -- cgit v1.2.3 From 88041f133f06d81a9bf6c72fc6e41a604eddf4b8 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 28 Aug 2014 12:31:26 +0200 Subject: test: disable test for systems without FPU This test fails for systems without fpu. For example m68k build for non-mmu/non-fpu systems fail. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- test/math/Makefile.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/math/Makefile.in b/test/math/Makefile.in index d241baa9e..147d579f4 100644 --- a/test/math/Makefile.in +++ b/test/math/Makefile.in @@ -13,6 +13,9 @@ endif ifeq ($(DO_C99_MATH),) TESTS_DISABLED += test-float test-ifloat test-double test-idouble rint signgam ilogb endif +ifeq ($(UCLIBC_HAS_FPU),) +TESTS_DISABLED += test-fpucw +endif DODIFF_rint := 1 DODIFF_signgam := 1 -- cgit v1.2.3 From 61ae023e5bb93f05b2b30b31f299efc64bcd420e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 29 Aug 2014 20:53:04 +0200 Subject: buildsys: use SED for create-lds Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makerules b/Makerules index 5030205c4..520b47d5a 100644 --- a/Makerules +++ b/Makerules @@ -303,7 +303,7 @@ define create-lds $(Q)$(CC) -nostdlib -nostartfiles -shared -Wl,-z,combreloc \ -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs \ -Wl,--verbose 2>&1 | LC_ALL=C \ - sed -e '/^=========/,/^=========/!d;/^=========/d' \ + $(SED) -e '/^=========/,/^=========/!d;/^=========/d' \ -e 's/\. = .* + SIZEOF_HEADERS;/& $(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds endef -- cgit v1.2.3 From 5c0c667fb21c74b4a9ac0554418a553bf1e11c1c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 29 Aug 2014 21:06:18 +0200 Subject: buildsys: refine compile.S filter out all -std= Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makerules b/Makerules index 520b47d5a..05d9548cb 100644 --- a/Makerules +++ b/Makerules @@ -240,7 +240,7 @@ cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \ cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS) cmd_compile.s = $(cmd_compile.c:-c=-S) cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep) -cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) +cmd_compile.S = $(filter-out -std=%, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS) -- cgit v1.2.3 From 7a3acb243bc09f253a77faee7ee097a781f3eebe Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 4 Sep 2014 12:46:56 +0200 Subject: buildsys: tweak check_ld flag probing ld was (erroneously) complaining that it failed to merge private bfd data. Silence this mismatch as seen on m68k with obfd binary. Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 7 +++++-- extra/scripts/none.lds | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 extra/scripts/none.lds diff --git a/Rules.mak b/Rules.mak index 19cc38a1e..cb657008c 100644 --- a/Rules.mak +++ b/Rules.mak @@ -201,7 +201,7 @@ check_as=$(shell \ if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \ then echo "-Wa,$(1)"; fi) check_ld=$(shell \ - if $(CC) $(LDFLAG-fuse-ld) -Wl,$(1) $(CFLAG_-nostdlib) -o /dev/null -Wl,-b,binary /dev/null > /dev/null 2>&1; \ + if $(CC) $(LDFLAG-fuse-ld) $(CFLAG_-Wl--no-warn-mismatch) -Wl,$(1) $(CFLAG_-nostdlib) -o /dev/null -Wl,-b,binary /dev/null > /dev/null 2>&1; \ then echo "$(1)"; fi) # Use variable indirection here so that we can have variable @@ -254,8 +254,11 @@ ARFLAGS:=cr # Note: The check for -nostdlib has to be before all calls to check_ld $(eval $(call check-gcc-var,-nostdlib)) -LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(EXTRA_UCLIBC_FLAGS)) # deliberately not named CFLAG-fuse-ld since unchecked and from user +LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(EXTRA_UCLIBC_FLAGS)) +# failed to merge target specific data of file /dev/null +# Could use -Wl,--script,$(top_srcdir)extra/scripts/none.lds as well. +$(eval $(call check-ld-var,--no-warn-mismatch)) # Flags in OPTIMIZATION are used only for non-debug builds diff --git a/extra/scripts/none.lds b/extra/scripts/none.lds new file mode 100644 index 000000000..d6bd05afc --- /dev/null +++ b/extra/scripts/none.lds @@ -0,0 +1,13 @@ +/* GNU ld script + * Used by the build system to probe flags. + * Discards all output to avoid error + * "failed to merge target specific data of file %B". */ +TARGET(binary) +INPUT(/dev/null) +/* We could as well omit the whole SECTIONS block. + * This redundancy is just for clarity. */ +SECTIONS +{ + /DISCARD/ : { *(*) } +} + -- cgit v1.2.3 From ff48662bbadd3d49fabe6fdfeb8e8181d4c80b06 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 4 Sep 2014 13:12:52 +0200 Subject: test: disable librt shmtest on non-MMU systems This test fails for non-MMU systems, because it uses fork() Thanks to Waldemar Brodkorb! Signed-off-by: Bernhard Reutner-Fischer --- test/librt/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/librt/Makefile.in b/test/librt/Makefile.in index 15ecbae5b..f25522cbe 100644 --- a/test/librt/Makefile.in +++ b/test/librt/Makefile.in @@ -2,3 +2,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. LDFLAGS_shmtest := -lrt + +ifeq ($(ARCH_USE_MMU),) +TESTS_DISABLED := shmtest +endif -- cgit v1.2.3 From bc23c6440d34d85c8e6bb04656beb233bba47cb8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 4 Sep 2014 13:16:35 +0200 Subject: test: wcsftime depends on XLOCALE Thanks to Waldemar Brodkorb for noticing. Signed-off-by: Bernhard Reutner-Fischer --- test/time/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/time/Makefile.in b/test/time/Makefile.in index 05f73a45d..02c8d910c 100644 --- a/test/time/Makefile.in +++ b/test/time/Makefile.in @@ -5,7 +5,7 @@ TESTS_DISABLED := bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz \ tst-strftime tst-strptime tst-timezone ifneq ($(UCLIBC_HAS_XLOCALE),y) -TESTS_DISABLED += tst-ftime_l +TESTS_DISABLED += tst-ftime_l tst_wcsftime endif CFLAGS_tst-strptime2 := -std=c99 -- cgit v1.2.3 From b212e3804fb155cb418852dd70abad9a3d2354cc Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 4 Sep 2014 13:21:23 +0200 Subject: ldso: Fix compile-error on noMMU Thanks to Waldemar Brodkorb for noticing! Signed-off-by: Bernhard Reutner-Fischer --- ldso/ldso/dl-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 1b06bc172..54501d143 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -728,7 +728,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags, void *new_addr; new_addr = map_writeable (infile, ppnt, piclib, flags, libaddr); if (!new_addr) { - _dl_dprintf(_dl_debug_file, "Can't modify %s's text section.", + _dl_dprintf(2, "Can't modify %s's text section.", libname); _dl_exit(1); } -- cgit v1.2.3 From 6d550ddd129b18cf800eab604f74536754526cd8 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 1 Sep 2014 20:44:20 +0200 Subject: sparc: remove sparc64/sparcv9 code The sparc64/sparcv9 code is incomplete. Furthermore there is no real embedded hardware for sparc64 available, so better remove it until someone comes up with a complete port. Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- extra/Configs/Config.sparc | 6 - libc/string/sparc/sparc64/memchr.S | 258 ------ libc/string/sparc/sparc64/memcpy.S | 922 --------------------- libc/string/sparc/sparc64/memset.S | 316 ------- libc/string/sparc/sparc64/sparcv9b/memcpy.S | 611 -------------- libc/string/sparc/sparc64/stpcpy.S | 270 ------ libc/string/sparc/sparc64/strcat.S | 338 -------- libc/string/sparc/sparc64/strchr.S | 485 ----------- libc/string/sparc/sparc64/strcmp.S | 278 ------- libc/string/sparc/sparc64/strcpy.S | 244 ------ libc/string/sparc/sparc64/strlen.S | 172 ---- libc/sysdeps/linux/sparc/bits/setjmp.h | 31 - libc/sysdeps/linux/sparc/bits/sigcontext.h | 35 - libc/sysdeps/linux/sparc/crt1.S | 11 - libc/sysdeps/linux/sparc/jmpbuf-unwind.h | 25 +- libc/sysdeps/linux/sparc/qp_ops.c | 8 - libc/sysdeps/linux/sparc/sparcv9/clone.S | 101 --- libc/sysdeps/linux/sparc/sparcv9/rem.S | 20 - libc/sysdeps/linux/sparc/sparcv9/sdiv.S | 18 - libc/sysdeps/linux/sparc/sparcv9/udiv.S | 15 - libc/sysdeps/linux/sparc/sparcv9/umul.S | 15 - libc/sysdeps/linux/sparc/sparcv9/urem.S | 17 - libc/sysdeps/linux/sparc/sys/procfs.h | 88 -- .../linuxthreads.old/sysdeps/sparc/pt-machine.h | 86 +- .../sysdeps/sparc/sparc32/pt-machine.h | 82 -- .../sysdeps/sparc/sparc64/pt-machine.h | 104 --- libpthread/linuxthreads/sysdeps/sparc/pspinlock.c | 95 ++- libpthread/linuxthreads/sysdeps/sparc/pt-machine.h | 86 +- .../linuxthreads/sysdeps/sparc/sparc32/pspinlock.c | 87 -- .../sysdeps/sparc/sparc32/pt-machine.h | 82 -- .../sysdeps/sparc/sparc32/sparcv9/pspinlock.c | 93 --- .../linuxthreads/sysdeps/sparc/sparc64/pspinlock.c | 92 -- .../sysdeps/sparc/sparc64/pt-machine.h | 104 --- .../unix/sysv/linux/sparc/sparc32/sysdep-cancel.h | 100 --- .../sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S | 64 -- .../unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c | 1 - .../unix/sysv/linux/sparc/sparc64/sysdep-cancel.h | 99 --- .../sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S | 63 -- .../sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h | 102 ++- .../sysdeps/unix/sysv/linux/sparc/vfork.S | 64 ++ libpthread/nptl/sysdeps/jmpbuf-unwind.h | 27 + libpthread/nptl/sysdeps/pthread_spin_lock.c | 39 + libpthread/nptl/sysdeps/pthread_spin_trylock.c | 28 + libpthread/nptl/sysdeps/pthreaddef.h | 39 + libpthread/nptl/sysdeps/sparc/jmpbuf-unwind.h | 32 +- libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c | 44 +- .../nptl/sysdeps/sparc/pthread_spin_trylock.c | 33 +- libpthread/nptl/sysdeps/sparc/pthreaddef.h | 44 +- .../nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h | 27 - .../nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c | 39 - .../sysdeps/sparc/sparc32/pthread_spin_trylock.c | 28 - libpthread/nptl/sysdeps/sparc/sparc32/pthreaddef.h | 39 - .../sparc/sparc32/sparcv9/pthread_spin_lock.c | 38 - .../sparc/sparc32/sparcv9/pthread_spin_trylock.c | 1 - .../sparc/sparc32/sparcv9/pthread_spin_unlock.c | 1 - .../nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h | 27 - .../nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c | 38 - .../sysdeps/sparc/sparc64/pthread_spin_trylock.c | 33 - .../sysdeps/sparc/sparc64/pthread_spin_unlock.c | 29 - libpthread/nptl/sysdeps/sparc/sparc64/pthreaddef.h | 39 - .../nptl/sysdeps/unix/sysv/linux/sparc/clone.S | 7 +- .../nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S | 49 +- .../unix/sysv/linux/sparc/pthread_barrier_wait.c | 94 ++- .../nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c | 52 ++ .../sysdeps/unix/sysv/linux/sparc/sem_timedwait.c | 147 ++++ .../sysdeps/unix/sysv/linux/sparc/sem_trywait.c | 51 ++ .../nptl/sysdeps/unix/sysv/linux/sparc/sem_wait.c | 124 +++ .../sysdeps/unix/sysv/linux/sparc/sparc32/clone.S | 2 - .../unix/sysv/linux/sparc/sparc32/pt-vfork.S | 44 - .../linux/sparc/sparc32/pthread_barrier_wait.c | 93 --- .../unix/sysv/linux/sparc/sparc32/sem_post.c | 52 -- .../unix/sysv/linux/sparc/sparc32/sem_timedwait.c | 147 ---- .../unix/sysv/linux/sparc/sparc32/sem_trywait.c | 51 -- .../unix/sysv/linux/sparc/sparc32/sem_wait.c | 124 --- .../unix/sysv/linux/sparc/sparc32/sysdep-cancel.h | 111 --- .../sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S | 48 -- .../sysdeps/unix/sysv/linux/sparc/sparc64/clone.S | 2 - .../unix/sysv/linux/sparc/sparc64/pt-vfork.S | 44 - .../unix/sysv/linux/sparc/sparc64/sysdep-cancel.h | 109 --- .../unix/sysv/linux/sparc/sparc64/timer_create.c | 1 - .../unix/sysv/linux/sparc/sparc64/timer_delete.c | 1 - .../unix/sysv/linux/sparc/sparc64/timer_getoverr.c | 1 - .../unix/sysv/linux/sparc/sparc64/timer_gettime.c | 1 - .../unix/sysv/linux/sparc/sparc64/timer_settime.c | 1 - .../sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S | 48 -- .../sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h | 114 ++- .../nptl/sysdeps/unix/sysv/linux/sparc/vfork.S | 53 +- 87 files changed, 1350 insertions(+), 6534 deletions(-) delete mode 100644 libc/string/sparc/sparc64/memchr.S delete mode 100644 libc/string/sparc/sparc64/memcpy.S delete mode 100644 libc/string/sparc/sparc64/memset.S delete mode 100644 libc/string/sparc/sparc64/sparcv9b/memcpy.S delete mode 100644 libc/string/sparc/sparc64/stpcpy.S delete mode 100644 libc/string/sparc/sparc64/strcat.S delete mode 100644 libc/string/sparc/sparc64/strchr.S delete mode 100644 libc/string/sparc/sparc64/strcmp.S delete mode 100644 libc/string/sparc/sparc64/strcpy.S delete mode 100644 libc/string/sparc/sparc64/strlen.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/clone.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/rem.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/sdiv.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/udiv.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/umul.S delete mode 100644 libc/sysdeps/linux/sparc/sparcv9/urem.S delete mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h delete mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h delete mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S create mode 100644 libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/vfork.S create mode 100644 libpthread/nptl/sysdeps/jmpbuf-unwind.h create mode 100644 libpthread/nptl/sysdeps/pthread_spin_lock.c create mode 100644 libpthread/nptl/sysdeps/pthread_spin_trylock.c create mode 100644 libpthread/nptl/sysdeps/pthreaddef.h delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/pthreaddef.h delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c delete mode 100644 libpthread/nptl/sysdeps/sparc/sparc64/pthreaddef.h create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_trywait.c create mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_wait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_create.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_delete.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_getoverr.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_gettime.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_settime.c delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S diff --git a/extra/Configs/Config.sparc b/extra/Configs/Config.sparc index c6180c831..47c8ac289 100644 --- a/extra/Configs/Config.sparc +++ b/extra/Configs/Config.sparc @@ -26,10 +26,4 @@ config CONFIG_SPARC_V7 config CONFIG_SPARC_V8 bool "SPARC v8" -config CONFIG_SPARC_V9 - bool "SPARC v9" - -config CONFIG_SPARC_V9B - bool "SPARC v9b" - endchoice diff --git a/libc/string/sparc/sparc64/memchr.S b/libc/string/sparc/sparc64/memchr.S deleted file mode 100644 index 6467f7fff..000000000 --- a/libc/string/sparc/sparc64/memchr.S +++ /dev/null @@ -1,258 +0,0 @@ -/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less - than N. - For SPARC v9. - Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - This version is developed using the same algorithm as the fast C - version which carries the following introduction: - Based on strlen implementation by Torbjorn Granlund (tege@sics.se), - with help from Dan Sahlin (dan@sics.se) and - commentary by Jim Blandy (jimb@ai.mit.edu); - adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), - and implemented by Roland McGrath (roland@ai.mit.edu). - - 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 - . */ - -#include -#ifndef XCC -#define XCC xcc -#define USE_BPR - .register %g2, #scratch - .register %g3, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(memchr) - and %o1, 0xff, %o1 /* IEU0 Group */ -#ifdef USE_BPR - brz,pn %o2, 12f /* CTI+IEU1 */ -#else - tst %o2 /* IEU1 */ - be,pn %XCC, 12f /* CTI */ -#endif - sll %o1, 8, %g3 /* IEU0 Group */ - add %o0, %o2, %o2 /* IEU1 */ - - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - or %g3, %o1, %g3 /* IEU1 */ - ldub [%o0], %o3 /* Load */ - sllx %g3, 16, %g5 /* IEU0 Group */ - - or %g1, %lo(0x01010101), %g1 /* IEU1 */ - sllx %g1, 32, %g2 /* IEU0 Group */ - or %g3, %g5, %g3 /* IEU1 */ - sllx %g3, 32, %g5 /* IEU0 Group */ - - cmp %o3, %o1 /* IEU1 */ - be,pn %xcc, 13f /* CTI */ - or %g1, %g2, %g1 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - - bne,a,pn %icc, 21f /* CTI */ - add %o0, 1, %o0 /* IEU0 Group */ - ldx [%o0], %o3 /* Load Group */ - sllx %g1, 7, %g2 /* IEU0 */ - - or %g3, %g5, %g3 /* IEU1 */ -1: add %o0, 8, %o0 /* IEU0 Group */ - xor %o3, %g3, %o4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080088080808080 * - * %g3 = c c c c c c c c * - * %o3 = value * - * %o4 = value XOR c */ -2: cmp %o0, %o2 /* IEU1 Group */ - - bg,pn %XCC, 11f /* CTI */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - sub %o4, %g1, %o5 /* IEU0 Group */ - add %o0, 8, %o0 /* IEU1 */ -#ifdef EIGHTBIT_NOT_RARE - andn %o5, %o4, %o5 /* IEU0 Group */ -#endif - - andcc %o5, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 2b /* CTI */ - xor %o3, %g3, %o4 /* IEU0 */ - srlx %o4, 56, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 3f /* CTI */ - srlx %o4, 48, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 4f /* CTI */ - srlx %o4, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - - srlx %o4, 32, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 6f /* CTI */ - srlx %o4, 24, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - srlx %o4, 16, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 8f /* CTI */ - srlx %o4, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 9f /* CTI */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - bne,pt %icc, 2b /* CTI */ - xor %o3, %g3, %o4 /* IEU0 */ - retl /* CTI+IEU1 Group */ - - add %o0, -9, %o0 /* IEU0 */ - - .align 16 -3: retl /* CTI+IEU1 Group */ - add %o0, -16, %o0 /* IEU0 */ -4: retl /* CTI+IEU1 Group */ - add %o0, -15, %o0 /* IEU0 */ - -5: retl /* CTI+IEU1 Group */ - add %o0, -14, %o0 /* IEU0 */ -6: retl /* CTI+IEU1 Group */ - add %o0, -13, %o0 /* IEU0 */ - -7: retl /* CTI+IEU1 Group */ - add %o0, -12, %o0 /* IEU0 */ -8: retl /* CTI+IEU1 Group */ - add %o0, -11, %o0 /* IEU0 */ - -9: retl /* CTI+IEU1 Group */ - add %o0, -10, %o0 /* IEU0 */ -11: sub %o4, %g1, %o5 /* IEU0 Group */ - sub %o0, 8, %o0 /* IEU1 */ - - andcc %o5, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 12f /* CTI */ - sub %o2, %o0, %o2 /* IEU0 */ - tst %o2 /* IEU1 Group */ - - be,pn %XCC, 12f /* CTI */ - srlx %o4, 56, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 13f /* CTI */ - - cmp %o2, 1 /* IEU0 */ - be,pn %XCC, 12f /* CTI Group */ - srlx %o4, 48, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 14f /* CTI */ - cmp %o2, 2 /* IEU1 Group */ - be,pn %XCC, 12f /* CTI */ - srlx %o4, 40, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 15f /* CTI */ - cmp %o2, 3 /* IEU1 Group */ - be,pn %XCC, 12f /* CTI */ - - srlx %o4, 32, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 16f /* CTI */ - cmp %o2, 4 /* IEU1 Group */ - - be,pn %XCC, 12f /* CTI */ - srlx %o4, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 17f /* CTI */ - - cmp %o2, 5 /* IEU1 Group */ - be,pn %XCC, 12f /* CTI */ - srlx %o4, 16, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 18f /* CTI */ - cmp %o2, 6 /* IEU1 Group */ - be,pn %XCC, 12f /* CTI */ - srlx %o4, 8, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 19f /* CTI */ - nop /* IEU0 */ -12: retl /* CTI+IEU1 Group */ - - clr %o0 /* IEU0 */ - nop /* Stub */ -13: retl /* CTI+IEU1 Group */ - nop /* IEU0 */ - -14: retl /* CTI+IEU1 Group */ - add %o0, 1, %o0 /* IEU0 */ -15: retl /* CTI+IEU1 Group */ - add %o0, 2, %o0 /* IEU0 */ - -16: retl /* CTI+IEU1 Group */ - add %o0, 3, %o0 /* IEU0 */ -17: retl /* CTI+IEU1 Group */ - add %o0, 4, %o0 /* IEU0 */ - -18: retl /* CTI+IEU1 Group */ - add %o0, 5, %o0 /* IEU0 */ -19: retl /* CTI+IEU1 Group */ - add %o0, 6, %o0 /* IEU0 */ - -21: cmp %o0, %o2 /* IEU1 */ - be,pn %XCC, 12b /* CTI */ - sllx %g1, 7, %g2 /* IEU0 Group */ - ldub [%o0], %o3 /* Load */ - - or %g3, %g5, %g3 /* IEU1 */ -22: andcc %o0, 7, %g0 /* IEU1 Group */ - be,a,pn %icc, 1b /* CTI */ - ldx [%o0], %o3 /* Load */ - - cmp %o3, %o1 /* IEU1 Group */ - be,pn %xcc, 23f /* CTI */ - add %o0, 1, %o0 /* IEU0 */ - cmp %o0, %o2 /* IEU1 Group */ - - bne,a,pt %XCC, 22b /* CTI */ - ldub [%o0], %o3 /* Load */ - retl /* CTI+IEU1 Group */ - clr %o0 /* IEU0 */ - -23: retl /* CTI+IEU1 Group */ - add %o0, -1, %o0 /* IEU0 */ -END(memchr) - -libc_hidden_def(memchr) -weak_alias(memchr,__ubp_memchr) diff --git a/libc/string/sparc/sparc64/memcpy.S b/libc/string/sparc/sparc64/memcpy.S deleted file mode 100644 index df3e2d342..000000000 --- a/libc/string/sparc/sparc64/memcpy.S +++ /dev/null @@ -1,922 +0,0 @@ -/* Copy SIZE bytes from SRC to DEST. - For UltraSPARC. - Copyright (C) 1996, 97, 98, 99, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David S. Miller (davem@caip.rutgers.edu) and - Jakub Jelinek (jakub@redhat.com). - - 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 - . */ - -#include -#include -#ifndef XCC -#define USE_BPR - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#define XCC xcc -#endif -#define FPRS_FEF 4 - -#define FREG_FROB(f1, f2, f3, f4, f5, f6, f7, f8, f9) \ - faligndata %f1, %f2, %f48; \ - faligndata %f2, %f3, %f50; \ - faligndata %f3, %f4, %f52; \ - faligndata %f4, %f5, %f54; \ - faligndata %f5, %f6, %f56; \ - faligndata %f6, %f7, %f58; \ - faligndata %f7, %f8, %f60; \ - faligndata %f8, %f9, %f62; - -#define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, len, jmptgt) \ - ldda [%src] %asi, %fdest; \ - add %src, 0x40, %src; \ - add %dest, 0x40, %dest; \ - subcc %len, 0x40, %len; \ - be,pn %xcc, jmptgt; \ - stda %fsrc, [%dest - 0x40] %asi; - -#define LOOP_CHUNK1(src, dest, len, branch_dest) \ - MAIN_LOOP_CHUNK(src, dest, f0, f48, len, branch_dest) -#define LOOP_CHUNK2(src, dest, len, branch_dest) \ - MAIN_LOOP_CHUNK(src, dest, f16, f48, len, branch_dest) -#define LOOP_CHUNK3(src, dest, len, branch_dest) \ - MAIN_LOOP_CHUNK(src, dest, f32, f48, len, branch_dest) - -#define STORE_SYNC(dest, fsrc) \ - stda %fsrc, [%dest] %asi; \ - add %dest, 0x40, %dest; - -#define STORE_JUMP(dest, fsrc, target) \ - stda %fsrc, [%dest] %asi; \ - add %dest, 0x40, %dest; \ - ba,pt %xcc, target; - -#define VISLOOP_PAD nop; nop; nop; nop; \ - nop; nop; nop; nop; \ - nop; nop; nop; nop; \ - nop; nop; nop; - -#define FINISH_VISCHUNK(dest, f0, f1, left) \ - subcc %left, 8, %left; \ - bl,pn %xcc, 205f; \ - faligndata %f0, %f1, %f48; \ - std %f48, [%dest]; \ - add %dest, 8, %dest; - -#define UNEVEN_VISCHUNK(dest, f0, f1, left) \ - subcc %left, 8, %left; \ - bl,pn %xcc, 205f; \ - fsrc1 %f0, %f1; \ - ba,a,pt %xcc, 204f; - - /* Macros for non-VIS memcpy code. */ -#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - ldx [%src + offset + 0x10], %t2; \ - ldx [%src + offset + 0x18], %t3; \ - stw %t0, [%dst + offset + 0x04]; \ - srlx %t0, 32, %t0; \ - stw %t0, [%dst + offset + 0x00]; \ - stw %t1, [%dst + offset + 0x0c]; \ - srlx %t1, 32, %t1; \ - stw %t1, [%dst + offset + 0x08]; \ - stw %t2, [%dst + offset + 0x14]; \ - srlx %t2, 32, %t2; \ - stw %t2, [%dst + offset + 0x10]; \ - stw %t3, [%dst + offset + 0x1c]; \ - srlx %t3, 32, %t3; \ - stw %t3, [%dst + offset + 0x18]; - -#define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - ldx [%src + offset + 0x10], %t2; \ - ldx [%src + offset + 0x18], %t3; \ - stx %t0, [%dst + offset + 0x00]; \ - stx %t1, [%dst + offset + 0x08]; \ - stx %t2, [%dst + offset + 0x10]; \ - stx %t3, [%dst + offset + 0x18]; \ - ldx [%src + offset + 0x20], %t0; \ - ldx [%src + offset + 0x28], %t1; \ - ldx [%src + offset + 0x30], %t2; \ - ldx [%src + offset + 0x38], %t3; \ - stx %t0, [%dst + offset + 0x20]; \ - stx %t1, [%dst + offset + 0x28]; \ - stx %t2, [%dst + offset + 0x30]; \ - stx %t3, [%dst + offset + 0x38]; - -#define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src - offset - 0x10], %t0; \ - ldx [%src - offset - 0x08], %t1; \ - stw %t0, [%dst - offset - 0x0c]; \ - srlx %t0, 32, %t2; \ - stw %t2, [%dst - offset - 0x10]; \ - stw %t1, [%dst - offset - 0x04]; \ - srlx %t1, 32, %t3; \ - stw %t3, [%dst - offset - 0x08]; - -#define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \ - ldx [%src - offset - 0x10], %t0; \ - ldx [%src - offset - 0x08], %t1; \ - stx %t0, [%dst - offset - 0x10]; \ - stx %t1, [%dst - offset - 0x08]; - - /* Macros for non-VIS memmove code. */ -#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src - offset - 0x20], %t0; \ - ldx [%src - offset - 0x18], %t1; \ - ldx [%src - offset - 0x10], %t2; \ - ldx [%src - offset - 0x08], %t3; \ - stw %t0, [%dst - offset - 0x1c]; \ - srlx %t0, 32, %t0; \ - stw %t0, [%dst - offset - 0x20]; \ - stw %t1, [%dst - offset - 0x14]; \ - srlx %t1, 32, %t1; \ - stw %t1, [%dst - offset - 0x18]; \ - stw %t2, [%dst - offset - 0x0c]; \ - srlx %t2, 32, %t2; \ - stw %t2, [%dst - offset - 0x10]; \ - stw %t3, [%dst - offset - 0x04]; \ - srlx %t3, 32, %t3; \ - stw %t3, [%dst - offset - 0x08]; - -#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src - offset - 0x20], %t0; \ - ldx [%src - offset - 0x18], %t1; \ - ldx [%src - offset - 0x10], %t2; \ - ldx [%src - offset - 0x08], %t3; \ - stx %t0, [%dst - offset - 0x20]; \ - stx %t1, [%dst - offset - 0x18]; \ - stx %t2, [%dst - offset - 0x10]; \ - stx %t3, [%dst - offset - 0x08]; \ - ldx [%src - offset - 0x40], %t0; \ - ldx [%src - offset - 0x38], %t1; \ - ldx [%src - offset - 0x30], %t2; \ - ldx [%src - offset - 0x28], %t3; \ - stx %t0, [%dst - offset - 0x40]; \ - stx %t1, [%dst - offset - 0x38]; \ - stx %t2, [%dst - offset - 0x30]; \ - stx %t3, [%dst - offset - 0x28]; - -#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - stw %t0, [%dst + offset + 0x04]; \ - srlx %t0, 32, %t2; \ - stw %t2, [%dst + offset + 0x00]; \ - stw %t1, [%dst + offset + 0x0c]; \ - srlx %t1, 32, %t3; \ - stw %t3, [%dst + offset + 0x08]; - -#define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - stx %t0, [%dst + offset + 0x00]; \ - stx %t1, [%dst + offset + 0x08]; - - .text - .align 32 - -#ifdef __UCLIBC_SUSV3_LEGACY__ -ENTRY(bcopy) - sub %o1, %o0, %o4 /* IEU0 Group */ - mov %o0, %g3 /* IEU1 */ - cmp %o4, %o2 /* IEU1 Group */ - mov %o1, %o0 /* IEU0 */ - bgeu,pt %XCC, 210f /* CTI */ - mov %g3, %o1 /* IEU0 Group */ -#ifndef USE_BPR - srl %o2, 0, %o2 /* IEU1 */ -#endif - brnz,pn %o2, 220f /* CTI Group */ - add %o0, %o2, %o0 /* IEU0 */ - retl - nop -END(bcopy) -#endif - - .align 32 -200: be,pt %xcc, 201f /* CTI */ - andcc %o0, 0x38, %g5 /* IEU1 Group */ - mov 8, %g1 /* IEU0 */ - sub %g1, %g2, %g2 /* IEU0 Group */ - andcc %o0, 1, %g0 /* IEU1 */ - be,pt %icc, 2f /* CTI */ - sub %o2, %g2, %o2 /* IEU0 Group */ -1: ldub [%o1], %o5 /* Load Group */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - subcc %g2, 1, %g2 /* IEU1 Group */ - be,pn %xcc, 3f /* CTI */ - stb %o5, [%o0 - 1] /* Store */ -2: ldub [%o1], %o5 /* Load Group */ - add %o0, 2, %o0 /* IEU0 */ - ldub [%o1 + 1], %g3 /* Load Group */ - subcc %g2, 2, %g2 /* IEU1 Group */ - stb %o5, [%o0 - 2] /* Store */ - add %o1, 2, %o1 /* IEU0 */ - bne,pt %xcc, 2b /* CTI Group */ - stb %g3, [%o0 - 1] /* Store */ -3: andcc %o0, 0x38, %g5 /* IEU1 Group */ -201: be,pt %icc, 202f /* CTI */ - mov 64, %g1 /* IEU0 */ - fmovd %f0, %f2 /* FPU */ - sub %g1, %g5, %g5 /* IEU0 Group */ - alignaddr %o1, %g0, %g1 /* GRU Group */ - ldd [%g1], %f4 /* Load Group */ - sub %o2, %g5, %o2 /* IEU0 */ -1: ldd [%g1 + 0x8], %f6 /* Load Group */ - add %g1, 0x8, %g1 /* IEU0 Group */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f4, %f6, %f0 /* GRU Group */ - std %f0, [%o0] /* Store */ - add %o1, 8, %o1 /* IEU0 Group */ - be,pn %xcc, 202f /* CTI */ - add %o0, 8, %o0 /* IEU1 */ - ldd [%g1 + 0x8], %f4 /* Load Group */ - add %g1, 8, %g1 /* IEU0 */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f6, %f4, %f0 /* GRU Group */ - std %f0, [%o0] /* Store */ - add %o1, 8, %o1 /* IEU0 */ - bne,pt %xcc, 1b /* CTI Group */ - add %o0, 8, %o0 /* IEU0 */ -202: membar #LoadStore | #StoreStore | #StoreLoad /* LSU Group */ - wr %g0, ASI_BLK_P, %asi /* LSU Group */ - subcc %o2, 0x40, %g6 /* IEU1 Group */ - mov %o1, %g1 /* IEU0 */ - andncc %g6, (0x40 - 1), %g6 /* IEU1 Group */ - srl %g1, 3, %g2 /* IEU0 */ - sub %o2, %g6, %g3 /* IEU0 Group */ - andn %o1, (0x40 - 1), %o1 /* IEU1 */ - and %g2, 7, %g2 /* IEU0 Group */ - andncc %g3, 0x7, %g3 /* IEU1 */ - fmovd %f0, %f2 /* FPU */ - sub %g3, 0x10, %g3 /* IEU0 Group */ - sub %o2, %g6, %o2 /* IEU1 */ - alignaddr %g1, %g0, %g0 /* GRU Group */ - add %g1, %g6, %g1 /* IEU0 Group */ - subcc %o2, %g3, %o2 /* IEU1 */ - ldda [%o1 + 0x00] %asi, %f0 /* LSU Group */ - add %g1, %g3, %g1 /* IEU0 */ - ldda [%o1 + 0x40] %asi, %f16 /* LSU Group */ - sub %g6, 0x80, %g6 /* IEU0 */ - ldda [%o1 + 0x80] %asi, %f32 /* LSU Group */ - /* Clk1 Group 8-( */ - /* Clk2 Group 8-( */ - /* Clk3 Group 8-( */ - /* Clk4 Group 8-( */ -203: rd %pc, %g5 /* PDU Group 8-( */ - addcc %g5, %lo(300f - 203b), %g5 /* IEU1 Group */ - sll %g2, 9, %g2 /* IEU0 */ - jmpl %g5 + %g2, %g0 /* CTI Group brk forced*/ - addcc %o1, 0xc0, %o1 /* IEU1 Group */ - - .align 512 /* OK, here comes the fun part... */ -300: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) LOOP_CHUNK1(o1, o0, g6, 301f) - FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) LOOP_CHUNK2(o1, o0, g6, 302f) - FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) LOOP_CHUNK3(o1, o0, g6, 303f) - b,pt %xcc, 300b+4; faligndata %f0, %f2, %f48 -301: FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_JUMP(o0, f48, 400f) membar #Sync -302: FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_JUMP(o0, f48, 416f) membar #Sync -303: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_JUMP(o0, f48, 432f) membar #Sync - VISLOOP_PAD -310: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) LOOP_CHUNK1(o1, o0, g6, 311f) - FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) LOOP_CHUNK2(o1, o0, g6, 312f) - FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) LOOP_CHUNK3(o1, o0, g6, 313f) - b,pt %xcc, 310b+4; faligndata %f2, %f4, %f48 -311: FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_JUMP(o0, f48, 402f) membar #Sync -312: FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_JUMP(o0, f48, 418f) membar #Sync -313: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_JUMP(o0, f48, 434f) membar #Sync - VISLOOP_PAD -320: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) LOOP_CHUNK1(o1, o0, g6, 321f) - FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) LOOP_CHUNK2(o1, o0, g6, 322f) - FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) LOOP_CHUNK3(o1, o0, g6, 323f) - b,pt %xcc, 320b+4; faligndata %f4, %f6, %f48 -321: FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_JUMP(o0, f48, 404f) membar #Sync -322: FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_JUMP(o0, f48, 420f) membar #Sync -323: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_JUMP(o0, f48, 436f) membar #Sync - VISLOOP_PAD -330: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) LOOP_CHUNK1(o1, o0, g6, 331f) - FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) LOOP_CHUNK2(o1, o0, g6, 332f) - FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) LOOP_CHUNK3(o1, o0, g6, 333f) - b,pt %xcc, 330b+4; faligndata %f6, %f8, %f48 -331: FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_JUMP(o0, f48, 406f) membar #Sync -332: FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_JUMP(o0, f48, 422f) membar #Sync -333: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_JUMP(o0, f48, 438f) membar #Sync - VISLOOP_PAD -340: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) LOOP_CHUNK1(o1, o0, g6, 341f) - FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) LOOP_CHUNK2(o1, o0, g6, 342f) - FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) LOOP_CHUNK3(o1, o0, g6, 343f) - b,pt %xcc, 340b+4; faligndata %f8, %f10, %f48 -341: FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_JUMP(o0, f48, 408f) membar #Sync -342: FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_JUMP(o0, f48, 424f) membar #Sync -343: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_JUMP(o0, f48, 440f) membar #Sync - VISLOOP_PAD -350: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) LOOP_CHUNK1(o1, o0, g6, 351f) - FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) LOOP_CHUNK2(o1, o0, g6, 352f) - FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) LOOP_CHUNK3(o1, o0, g6, 353f) - b,pt %xcc, 350b+4; faligndata %f10, %f12, %f48 -351: FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_JUMP(o0, f48, 410f) membar #Sync -352: FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_JUMP(o0, f48, 426f) membar #Sync -353: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_JUMP(o0, f48, 442f) membar #Sync - VISLOOP_PAD -360: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) LOOP_CHUNK1(o1, o0, g6, 361f) - FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) LOOP_CHUNK2(o1, o0, g6, 362f) - FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) LOOP_CHUNK3(o1, o0, g6, 363f) - b,pt %xcc, 360b+4; faligndata %f12, %f14, %f48 -361: FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_JUMP(o0, f48, 412f) membar #Sync -362: FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_JUMP(o0, f48, 428f) membar #Sync -363: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_JUMP(o0, f48, 444f) membar #Sync - VISLOOP_PAD -370: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) LOOP_CHUNK1(o1, o0, g6, 371f) - FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) LOOP_CHUNK2(o1, o0, g6, 372f) - FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) LOOP_CHUNK3(o1, o0, g6, 373f) - b,pt %xcc, 370b+4; faligndata %f14, %f16, %f48 -371: FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_JUMP(o0, f48, 414f) membar #Sync -372: FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_JUMP(o0, f48, 430f) membar #Sync -373: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_SYNC(o0, f48) membar #Sync - FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_JUMP(o0, f48, 446f) membar #Sync - VISLOOP_PAD -400: FINISH_VISCHUNK(o0, f0, f2, g3) -402: FINISH_VISCHUNK(o0, f2, f4, g3) -404: FINISH_VISCHUNK(o0, f4, f6, g3) -406: FINISH_VISCHUNK(o0, f6, f8, g3) -408: FINISH_VISCHUNK(o0, f8, f10, g3) -410: FINISH_VISCHUNK(o0, f10, f12, g3) -412: FINISH_VISCHUNK(o0, f12, f14, g3) -414: UNEVEN_VISCHUNK(o0, f14, f0, g3) -416: FINISH_VISCHUNK(o0, f16, f18, g3) -418: FINISH_VISCHUNK(o0, f18, f20, g3) -420: FINISH_VISCHUNK(o0, f20, f22, g3) -422: FINISH_VISCHUNK(o0, f22, f24, g3) -424: FINISH_VISCHUNK(o0, f24, f26, g3) -426: FINISH_VISCHUNK(o0, f26, f28, g3) -428: FINISH_VISCHUNK(o0, f28, f30, g3) -430: UNEVEN_VISCHUNK(o0, f30, f0, g3) -432: FINISH_VISCHUNK(o0, f32, f34, g3) -434: FINISH_VISCHUNK(o0, f34, f36, g3) -436: FINISH_VISCHUNK(o0, f36, f38, g3) -438: FINISH_VISCHUNK(o0, f38, f40, g3) -440: FINISH_VISCHUNK(o0, f40, f42, g3) -442: FINISH_VISCHUNK(o0, f42, f44, g3) -444: FINISH_VISCHUNK(o0, f44, f46, g3) -446: UNEVEN_VISCHUNK(o0, f46, f0, g3) -204: ldd [%o1], %f2 /* Load Group */ - add %o1, 8, %o1 /* IEU0 */ - subcc %g3, 8, %g3 /* IEU1 */ - faligndata %f0, %f2, %f8 /* GRU Group */ - std %f8, [%o0] /* Store */ - bl,pn %xcc, 205f /* CTI */ - add %o0, 8, %o0 /* IEU0 Group */ - ldd [%o1], %f0 /* Load Group */ - add %o1, 8, %o1 /* IEU0 */ - subcc %g3, 8, %g3 /* IEU1 */ - faligndata %f2, %f0, %f8 /* GRU Group */ - std %f8, [%o0] /* Store */ - bge,pt %xcc, 204b /* CTI */ - add %o0, 8, %o0 /* IEU0 Group */ -205: brz,pt %o2, 207f /* CTI Group */ - mov %g1, %o1 /* IEU0 */ -206: ldub [%o1], %g5 /* LOAD */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 */ - bne,pt %xcc, 206b /* CTI */ - stb %g5, [%o0 - 1] /* Store Group */ -207: membar #StoreLoad | #StoreStore /* LSU Group */ - wr %g0, FPRS_FEF, %fprs - retl - mov %g4, %o0 - -208: andcc %o2, 1, %g0 /* IEU1 Group */ - be,pt %icc, 2f+4 /* CTI */ -1: ldub [%o1], %g5 /* LOAD Group */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 Group */ - be,pn %xcc, 209f /* CTI */ - stb %g5, [%o0 - 1] /* Store */ -2: ldub [%o1], %g5 /* LOAD Group */ - add %o0, 2, %o0 /* IEU0 */ - ldub [%o1 + 1], %o5 /* LOAD Group */ - add %o1, 2, %o1 /* IEU0 */ - subcc %o2, 2, %o2 /* IEU1 Group */ - stb %g5, [%o0 - 2] /* Store */ - bne,pt %xcc, 2b /* CTI */ - stb %o5, [%o0 - 1] /* Store */ -209: retl - mov %g4, %o0 - -#ifdef USE_BPR - - /* void *__align_cpy_4(void *dest, void *src, size_t n) - * SPARC v9 SYSV ABI - * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 3)) - */ - - .align 32 -ENTRY(__align_cpy_4) - mov %o0, %g4 /* IEU0 Group */ - cmp %o2, 15 /* IEU1 */ - bleu,pn %xcc, 208b /* CTI */ - cmp %o2, (64 * 6) /* IEU1 Group */ - bgeu,pn %xcc, 200b /* CTI */ - andcc %o0, 7, %g2 /* IEU1 Group */ - ba,pt %xcc, 216f /* CTI */ - andcc %o1, 4, %g0 /* IEU1 Group */ -END(__align_cpy_4) - - /* void *__align_cpy_8(void *dest, void *src, size_t n) - * SPARC v9 SYSV ABI - * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 7)) - */ - - .align 32 -ENTRY(__align_cpy_8) - mov %o0, %g4 /* IEU0 Group */ - cmp %o2, 15 /* IEU1 */ - bleu,pn %xcc, 208b /* CTI */ - cmp %o2, (64 * 6) /* IEU1 Group */ - bgeu,pn %xcc, 201b /* CTI */ - andcc %o0, 0x38, %g5 /* IEU1 Group */ - andcc %o2, -128, %g6 /* IEU1 Group */ - bne,a,pt %xcc, 82f + 4 /* CTI */ - ldx [%o1], %g1 /* Load */ - ba,pt %xcc, 41f /* CTI Group */ - andcc %o2, 0x70, %g6 /* IEU1 */ -END(__align_cpy_8) - - /* void *__align_cpy_16(void *dest, void *src, size_t n) - * SPARC v9 SYSV ABI - * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 15)) - */ - - .align 32 -ENTRY(__align_cpy_16) - mov %o0, %g4 /* IEU0 Group */ - cmp %o2, (64 * 6) /* IEU1 */ - bgeu,pn %xcc, 201b /* CTI */ - andcc %o0, 0x38, %g5 /* IEU1 Group */ - andcc %o2, -128, %g6 /* IEU1 Group */ - bne,a,pt %xcc, 82f + 4 /* CTI */ - ldx [%o1], %g1 /* Load */ - ba,pt %xcc, 41f /* CTI Group */ - andcc %o2, 0x70, %g6 /* IEU1 */ -END(__align_cpy_16) - -#endif - - .align 32 -ENTRY(memcpy) -210: -#ifndef USE_BPR - srl %o2, 0, %o2 /* IEU1 Group */ -#endif - brz,pn %o2, 209b /* CTI Group */ - mov %o0, %g4 /* IEU0 */ -218: cmp %o2, 15 /* IEU1 Group */ - bleu,pn %xcc, 208b /* CTI */ - cmp %o2, (64 * 6) /* IEU1 Group */ - bgeu,pn %xcc, 200b /* CTI */ - andcc %o0, 7, %g2 /* IEU1 Group */ - sub %o0, %o1, %g5 /* IEU0 */ - andcc %g5, 3, %o5 /* IEU1 Group */ - bne,pn %xcc, 212f /* CTI */ - andcc %o1, 3, %g0 /* IEU1 Group */ - be,a,pt %xcc, 216f /* CTI */ - andcc %o1, 4, %g0 /* IEU1 Group */ - andcc %o1, 1, %g0 /* IEU1 Group */ - be,pn %xcc, 4f /* CTI */ - andcc %o1, 2, %g0 /* IEU1 Group */ - ldub [%o1], %g2 /* Load Group */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - sub %o2, 1, %o2 /* IEU0 Group */ - bne,pn %xcc, 5f /* CTI Group */ - stb %g2, [%o0 - 1] /* Store */ -4: lduh [%o1], %g2 /* Load Group */ - add %o1, 2, %o1 /* IEU0 */ - add %o0, 2, %o0 /* IEU1 */ - sub %o2, 2, %o2 /* IEU0 */ - sth %g2, [%o0 - 2] /* Store Group + bubble */ -5: andcc %o1, 4, %g0 /* IEU1 */ -216: be,a,pn %xcc, 2f /* CTI */ - andcc %o2, -128, %g6 /* IEU1 Group */ - lduw [%o1], %g5 /* Load Group */ - add %o1, 4, %o1 /* IEU0 */ - add %o0, 4, %o0 /* IEU1 */ - sub %o2, 4, %o2 /* IEU0 Group */ - stw %g5, [%o0 - 4] /* Store */ - andcc %o2, -128, %g6 /* IEU1 Group */ -2: be,pn %xcc, 215f /* CTI */ - andcc %o0, 4, %g0 /* IEU1 Group */ - be,pn %xcc, 82f + 4 /* CTI Group */ -5: MOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - MOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5) - MOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5) - MOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5) -35: subcc %g6, 128, %g6 /* IEU1 Group */ - add %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 5b /* CTI */ - add %o0, 128, %o0 /* IEU0 Group */ -215: andcc %o2, 0x70, %g6 /* IEU1 Group */ -41: be,pn %xcc, 80f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -79: rd %pc, %o5 /* PDU Group */ - sll %g6, 1, %g5 /* IEU0 Group */ - add %o1, %g6, %o1 /* IEU1 */ - sub %o5, %g5, %o5 /* IEU0 Group */ - jmpl %o5 + %lo(80f - 79b), %g0 /* CTI Group brk forced*/ - add %o0, %g6, %o0 /* IEU0 Group */ -36: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5) - MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5) -80: be,pt %xcc, 81f /* CTI */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1], %g2 /* Load Group */ - add %o0, 8, %o0 /* IEU0 */ - stw %g2, [%o0 - 0x4] /* Store Group */ - add %o1, 8, %o1 /* IEU1 */ - srlx %g2, 32, %g2 /* IEU0 Group */ - stw %g2, [%o0 - 0x8] /* Store */ -81: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1], %g2 /* Load Group */ - add %o1, 4, %o1 /* IEU0 */ - stw %g2, [%o0] /* Store Group */ - add %o0, 4, %o0 /* IEU0 */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1], %g2 /* Load Group */ - add %o1, 2, %o1 /* IEU0 */ - sth %g2, [%o0] /* Store Group */ - add %o0, 2, %o0 /* IEU0 */ -1: be,pt %xcc, 211f /* CTI */ - nop /* IEU1 */ - ldub [%o1], %g2 /* Load Group */ - stb %g2, [%o0] /* Store Group + bubble */ -211: retl - mov %g4, %o0 - -82: MOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - MOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5) -37: subcc %g6, 128, %g6 /* IEU1 Group */ - add %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 82b /* CTI */ - add %o0, 128, %o0 /* IEU0 Group */ - andcc %o2, 0x70, %g6 /* IEU1 */ - be,pn %xcc, 84f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -83: rd %pc, %o5 /* PDU Group */ - add %o1, %g6, %o1 /* IEU0 Group */ - sub %o5, %g6, %o5 /* IEU1 */ - jmpl %o5 + %lo(84f - 83b), %g0 /* CTI Group brk forced*/ - add %o0, %g6, %o0 /* IEU0 Group */ -38: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3) - MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3) -84: be,pt %xcc, 85f /* CTI Group */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1], %g2 /* Load Group */ - add %o0, 8, %o0 /* IEU0 */ - add %o1, 8, %o1 /* IEU0 Group */ - stx %g2, [%o0 - 0x8] /* Store */ -85: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1], %g2 /* Load Group */ - add %o0, 4, %o0 /* IEU0 */ - add %o1, 4, %o1 /* IEU0 Group */ - stw %g2, [%o0 - 0x4] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1], %g2 /* Load Group */ - add %o0, 2, %o0 /* IEU0 */ - add %o1, 2, %o1 /* IEU0 Group */ - sth %g2, [%o0 - 0x2] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - nop /* IEU0 Group */ - ldub [%o1], %g2 /* Load Group */ - stb %g2, [%o0] /* Store Group + bubble */ -1: retl - mov %g4, %o0 - -212: brz,pt %g2, 2f /* CTI Group */ - mov 8, %g1 /* IEU0 */ - sub %g1, %g2, %g2 /* IEU0 Group */ - sub %o2, %g2, %o2 /* IEU0 Group */ -1: ldub [%o1], %g5 /* Load Group */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - subcc %g2, 1, %g2 /* IEU1 Group */ - bne,pt %xcc, 1b /* CTI */ - stb %g5, [%o0 - 1] /* Store */ -2: andn %o2, 7, %g5 /* IEU0 Group */ - and %o2, 7, %o2 /* IEU1 */ - fmovd %f0, %f2 /* FPU */ - alignaddr %o1, %g0, %g1 /* GRU Group */ - ldd [%g1], %f4 /* Load Group */ -1: ldd [%g1 + 0x8], %f6 /* Load Group */ - add %g1, 0x8, %g1 /* IEU0 Group */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f4, %f6, %f0 /* GRU Group */ - std %f0, [%o0] /* Store */ - add %o1, 8, %o1 /* IEU0 Group */ - be,pn %xcc, 213f /* CTI */ - add %o0, 8, %o0 /* IEU1 */ - ldd [%g1 + 0x8], %f4 /* Load Group */ - add %g1, 8, %g1 /* IEU0 */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f6, %f4, %f0 /* GRU Group */ - std %f0, [%o0] /* Store */ - add %o1, 8, %o1 /* IEU0 */ - bne,pn %xcc, 1b /* CTI Group */ - add %o0, 8, %o0 /* IEU0 */ -213: brz,pn %o2, 214f /* CTI Group */ - nop /* IEU0 */ - ldub [%o1], %g5 /* LOAD */ - add %o1, 1, %o1 /* IEU0 */ - add %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 */ - bne,pt %xcc, 206b /* CTI */ - stb %g5, [%o0 - 1] /* Store Group */ -214: wr %g0, FPRS_FEF, %fprs - retl - mov %g4, %o0 -END(memcpy) -libc_hidden_def(memcpy) - - .align 32 -228: andcc %o2, 1, %g0 /* IEU1 Group */ - be,pt %icc, 2f+4 /* CTI */ -1: ldub [%o1 - 1], %o5 /* LOAD Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 Group */ - be,pn %xcc, 229f /* CTI */ - stb %o5, [%o0] /* Store */ -2: ldub [%o1 - 1], %o5 /* LOAD Group */ - sub %o0, 2, %o0 /* IEU0 */ - ldub [%o1 - 2], %g5 /* LOAD Group */ - sub %o1, 2, %o1 /* IEU0 */ - subcc %o2, 2, %o2 /* IEU1 Group */ - stb %o5, [%o0 + 1] /* Store */ - bne,pt %xcc, 2b /* CTI */ - stb %g5, [%o0] /* Store */ -229: retl - mov %g4, %o0 -219: retl - nop - - .align 32 -ENTRY(memmove) -#ifndef USE_BPR - srl %o2, 0, %o2 /* IEU1 Group */ -#endif - brz,pn %o2, 219b /* CTI Group */ - sub %o0, %o1, %o4 /* IEU0 */ - cmp %o4, %o2 /* IEU1 Group */ - bgeu,pt %XCC, 218b /* CTI */ - mov %o0, %g4 /* IEU0 */ - add %o0, %o2, %o0 /* IEU0 Group */ -220: add %o1, %o2, %o1 /* IEU1 */ - cmp %o2, 15 /* IEU1 Group */ - bleu,pn %xcc, 228b /* CTI */ - andcc %o0, 7, %g2 /* IEU1 Group */ - sub %o0, %o1, %g5 /* IEU0 */ - andcc %g5, 3, %o5 /* IEU1 Group */ - bne,pn %xcc, 232f /* CTI */ - andcc %o1, 3, %g0 /* IEU1 Group */ - be,a,pt %xcc, 236f /* CTI */ - andcc %o1, 4, %g0 /* IEU1 Group */ - andcc %o1, 1, %g0 /* IEU1 Group */ - be,pn %xcc, 4f /* CTI */ - andcc %o1, 2, %g0 /* IEU1 Group */ - ldub [%o1 - 1], %g2 /* Load Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - sub %o2, 1, %o2 /* IEU0 Group */ - be,pn %xcc, 5f /* CTI Group */ - stb %g2, [%o0] /* Store */ -4: lduh [%o1 - 2], %g2 /* Load Group */ - sub %o1, 2, %o1 /* IEU0 */ - sub %o0, 2, %o0 /* IEU1 */ - sub %o2, 2, %o2 /* IEU0 */ - sth %g2, [%o0] /* Store Group + bubble */ -5: andcc %o1, 4, %g0 /* IEU1 */ -236: be,a,pn %xcc, 2f /* CTI */ - andcc %o2, -128, %g6 /* IEU1 Group */ - lduw [%o1 - 4], %g5 /* Load Group */ - sub %o1, 4, %o1 /* IEU0 */ - sub %o0, 4, %o0 /* IEU1 */ - sub %o2, 4, %o2 /* IEU0 Group */ - stw %g5, [%o0] /* Store */ - andcc %o2, -128, %g6 /* IEU1 Group */ -2: be,pn %xcc, 235f /* CTI */ - andcc %o0, 4, %g0 /* IEU1 Group */ - be,pn %xcc, 282f + 4 /* CTI Group */ -5: RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5) - subcc %g6, 128, %g6 /* IEU1 Group */ - sub %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 5b /* CTI */ - sub %o0, 128, %o0 /* IEU0 Group */ -235: andcc %o2, 0x70, %g6 /* IEU1 Group */ -41: be,pn %xcc, 280f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -279: rd %pc, %o5 /* PDU Group */ - sll %g6, 1, %g5 /* IEU0 Group */ - sub %o1, %g6, %o1 /* IEU1 */ - sub %o5, %g5, %o5 /* IEU0 Group */ - jmpl %o5 + %lo(280f - 279b), %g0 /* CTI Group brk forced*/ - sub %o0, %g6, %o0 /* IEU0 Group */ - RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5) -280: be,pt %xcc, 281f /* CTI */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1 - 8], %g2 /* Load Group */ - sub %o0, 8, %o0 /* IEU0 */ - stw %g2, [%o0 + 4] /* Store Group */ - sub %o1, 8, %o1 /* IEU1 */ - srlx %g2, 32, %g2 /* IEU0 Group */ - stw %g2, [%o0] /* Store */ -281: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1 - 4], %g2 /* Load Group */ - sub %o1, 4, %o1 /* IEU0 */ - stw %g2, [%o0 - 4] /* Store Group */ - sub %o0, 4, %o0 /* IEU0 */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1 - 2], %g2 /* Load Group */ - sub %o1, 2, %o1 /* IEU0 */ - sth %g2, [%o0 - 2] /* Store Group */ - sub %o0, 2, %o0 /* IEU0 */ -1: be,pt %xcc, 211f /* CTI */ - nop /* IEU1 */ - ldub [%o1 - 1], %g2 /* Load Group */ - stb %g2, [%o0 - 1] /* Store Group + bubble */ -211: retl - mov %g4, %o0 - -282: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5) - subcc %g6, 128, %g6 /* IEU1 Group */ - sub %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 282b /* CTI */ - sub %o0, 128, %o0 /* IEU0 Group */ - andcc %o2, 0x70, %g6 /* IEU1 */ - be,pn %xcc, 284f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -283: rd %pc, %o5 /* PDU Group */ - sub %o1, %g6, %o1 /* IEU0 Group */ - sub %o5, %g6, %o5 /* IEU1 */ - jmpl %o5 + %lo(284f - 283b), %g0 /* CTI Group brk forced*/ - sub %o0, %g6, %o0 /* IEU0 Group */ - RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3) -284: be,pt %xcc, 285f /* CTI Group */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1 - 8], %g2 /* Load Group */ - sub %o0, 8, %o0 /* IEU0 */ - sub %o1, 8, %o1 /* IEU0 Group */ - stx %g2, [%o0] /* Store */ -285: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1 - 4], %g2 /* Load Group */ - sub %o0, 4, %o0 /* IEU0 */ - sub %o1, 4, %o1 /* IEU0 Group */ - stw %g2, [%o0] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1 - 2], %g2 /* Load Group */ - sub %o0, 2, %o0 /* IEU0 */ - sub %o1, 2, %o1 /* IEU0 Group */ - sth %g2, [%o0] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - nop /* IEU0 Group */ - ldub [%o1 - 1], %g2 /* Load Group */ - stb %g2, [%o0 - 1] /* Store Group + bubble */ -1: retl - mov %g4, %o0 - -232: brz,pt %g2, 2f /* CTI Group */ - sub %o2, %g2, %o2 /* IEU0 Group */ -1: ldub [%o1 - 1], %g5 /* Load Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %g2, 1, %g2 /* IEU1 Group */ - bne,pt %xcc, 1b /* CTI */ - stb %g5, [%o0] /* Store */ -2: andn %o2, 7, %g5 /* IEU0 Group */ - and %o2, 7, %o2 /* IEU1 */ - fmovd %f0, %f2 /* FPU */ - alignaddr %o1, %g0, %g1 /* GRU Group */ - ldd [%g1], %f4 /* Load Group */ -1: ldd [%g1 - 8], %f6 /* Load Group */ - sub %g1, 8, %g1 /* IEU0 Group */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f6, %f4, %f0 /* GRU Group */ - std %f0, [%o0 - 8] /* Store */ - sub %o1, 8, %o1 /* IEU0 Group */ - be,pn %xcc, 233f /* CTI */ - sub %o0, 8, %o0 /* IEU1 */ - ldd [%g1 - 8], %f4 /* Load Group */ - sub %g1, 8, %g1 /* IEU0 */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f4, %f6, %f0 /* GRU Group */ - std %f0, [%o0 - 8] /* Store */ - sub %o1, 8, %o1 /* IEU0 */ - bne,pn %xcc, 1b /* CTI Group */ - sub %o0, 8, %o0 /* IEU0 */ -233: brz,pn %o2, 234f /* CTI Group */ - nop /* IEU0 */ -237: ldub [%o1 - 1], %g5 /* LOAD */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 */ - bne,pt %xcc, 237b /* CTI */ - stb %g5, [%o0] /* Store Group */ -234: wr %g0, FPRS_FEF, %fprs - retl - mov %g4, %o0 -END(memmove) -libc_hidden_def(memmove) - -#ifdef USE_BPR -weak_alias(memcpy,__align_cpy_1) -weak_alias(memcpy,__align_cpy_2) -#endif diff --git a/libc/string/sparc/sparc64/memset.S b/libc/string/sparc/sparc64/memset.S deleted file mode 100644 index f76a637e1..000000000 --- a/libc/string/sparc/sparc64/memset.S +++ /dev/null @@ -1,316 +0,0 @@ -/* Set a block of memory to some byte value. - For UltraSPARC. - Copyright (C) 1996, 97, 98, 99, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David S. Miller (davem@caip.rutgers.edu) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 - . */ - -#include -#include -#ifndef XCC -#define XCC xcc -#define USE_BPR -#endif -#define FPRS_FEF 4 - -#define SET_BLOCKS(base, offset, source) \ - stx source, [base - offset - 0x18]; \ - stx source, [base - offset - 0x10]; \ - stx source, [base - offset - 0x08]; \ - stx source, [base - offset - 0x00]; - - /* Well, memset is a lot easier to get right than bcopy... */ - .text - .align 32 -ENTRY(memset) - andcc %o1, 0xff, %o1 - mov %o0, %o5 - be,a,pt %icc, 50f -#ifndef USE_BPR - srl %o2, 0, %o1 -#else - mov %o2, %o1 -#endif - cmp %o2, 7 -#ifndef USE_BPR - srl %o2, 0, %o2 -#endif - bleu,pn %XCC, 17f - andcc %o0, 3, %g5 - be,pt %xcc, 4f - and %o1, 0xff, %o1 - cmp %g5, 3 - be,pn %xcc, 2f - stb %o1, [%o0 + 0x00] - cmp %g5, 2 - be,pt %xcc, 2f - stb %o1, [%o0 + 0x01] - stb %o1, [%o0 + 0x02] -2: sub %g5, 4, %g5 - sub %o0, %g5, %o0 - add %o2, %g5, %o2 -4: sllx %o1, 8, %g1 - andcc %o0, 4, %g0 - or %o1, %g1, %o1 - sllx %o1, 16, %g1 - or %o1, %g1, %o1 - be,pt %xcc, 2f - sllx %o1, 32, %g1 - stw %o1, [%o0] - sub %o2, 4, %o2 - add %o0, 4, %o0 -2: cmp %o2, 128 - or %o1, %g1, %o1 - blu,pn %xcc, 9f - andcc %o0, 0x38, %g5 - be,pn %icc, 6f - mov 64, %o4 - andcc %o0, 8, %g0 - be,pn %icc, 1f - sub %o4, %g5, %o4 - stx %o1, [%o0] - add %o0, 8, %o0 -1: andcc %o4, 16, %g0 - be,pn %icc, 1f - sub %o2, %o4, %o2 - stx %o1, [%o0] - stx %o1, [%o0 + 8] - add %o0, 16, %o0 -1: andcc %o4, 32, %g0 - be,pn %icc, 7f - andncc %o2, 0x3f, %o3 - stw %o1, [%o0] - stw %o1, [%o0 + 4] - stw %o1, [%o0 + 8] - stw %o1, [%o0 + 12] - stw %o1, [%o0 + 16] - stw %o1, [%o0 + 20] - stw %o1, [%o0 + 24] - stw %o1, [%o0 + 28] - add %o0, 32, %o0 -7: be,pn %xcc, 9f - nop - ldd [%o0 - 8], %f0 -18: wr %g0, ASI_BLK_P, %asi - membar #StoreStore | #LoadStore - andcc %o3, 0xc0, %g5 - and %o2, 0x3f, %o2 - fmovd %f0, %f2 - fmovd %f0, %f4 - andn %o3, 0xff, %o3 - fmovd %f0, %f6 - cmp %g5, 64 - fmovd %f0, %f8 - fmovd %f0, %f10 - fmovd %f0, %f12 - brz,pn %g5, 10f - fmovd %f0, %f14 - be,pn %icc, 2f - stda %f0, [%o0 + 0x00] %asi - cmp %g5, 128 - be,pn %icc, 2f - stda %f0, [%o0 + 0x40] %asi - stda %f0, [%o0 + 0x80] %asi -2: brz,pn %o3, 12f - add %o0, %g5, %o0 -10: stda %f0, [%o0 + 0x00] %asi - stda %f0, [%o0 + 0x40] %asi - stda %f0, [%o0 + 0x80] %asi - stda %f0, [%o0 + 0xc0] %asi -11: subcc %o3, 256, %o3 - bne,pt %xcc, 10b - add %o0, 256, %o0 -12: wr %g0, FPRS_FEF, %fprs - membar #StoreLoad | #StoreStore -9: andcc %o2, 0x78, %g5 - be,pn %xcc, 13f - andcc %o2, 7, %o2 -14: rd %pc, %o4 - srl %g5, 1, %o3 - sub %o4, %o3, %o4 - jmpl %o4 + (13f - 14b), %g0 - add %o0, %g5, %o0 -12: SET_BLOCKS (%o0, 0x68, %o1) - SET_BLOCKS (%o0, 0x48, %o1) - SET_BLOCKS (%o0, 0x28, %o1) - SET_BLOCKS (%o0, 0x08, %o1) -13: be,pn %xcc, 8f - andcc %o2, 4, %g0 - be,pn %xcc, 1f - andcc %o2, 2, %g0 - stw %o1, [%o0] - add %o0, 4, %o0 -1: be,pn %xcc, 1f - andcc %o2, 1, %g0 - sth %o1, [%o0] - add %o0, 2, %o0 -1: bne,a,pn %xcc, 8f - stb %o1, [%o0] -8: retl - mov %o5, %o0 -17: brz,pn %o2, 0f -8: add %o0, 1, %o0 - subcc %o2, 1, %o2 - bne,pt %xcc, 8b - stb %o1, [%o0 - 1] -0: retl - mov %o5, %o0 - -6: stx %o1, [%o0] - andncc %o2, 0x3f, %o3 - be,pn %xcc, 9b - nop - ba,pt %xcc, 18b - ldd [%o0], %f0 -END(memset) -libc_hidden_def(memset) - -#define ZERO_BLOCKS(base, offset, source) \ - stx source, [base - offset - 0x38]; \ - stx source, [base - offset - 0x30]; \ - stx source, [base - offset - 0x28]; \ - stx source, [base - offset - 0x20]; \ - stx source, [base - offset - 0x18]; \ - stx source, [base - offset - 0x10]; \ - stx source, [base - offset - 0x08]; \ - stx source, [base - offset - 0x00]; - - .text - .align 32 -#ifdef __UCLIBC_SUSV3_LEGACY__ -ENTRY(bzero) -#ifndef USE_BPR - srl %o1, 0, %o1 -#endif - mov %o0, %o5 -#endif -50: cmp %o1, 7 - bleu,pn %xcc, 17f - andcc %o0, 3, %o2 - be,a,pt %xcc, 4f - andcc %o0, 4, %g0 - cmp %o2, 3 - be,pn %xcc, 2f - stb %g0, [%o0 + 0x00] - cmp %o2, 2 - be,pt %xcc, 2f - stb %g0, [%o0 + 0x01] - stb %g0, [%o0 + 0x02] -2: sub %o2, 4, %o2 - sub %o0, %o2, %o0 - add %o1, %o2, %o1 - andcc %o0, 4, %g0 -4: be,pt %xcc, 2f - cmp %o1, 128 - stw %g0, [%o0] - sub %o1, 4, %o1 - add %o0, 4, %o0 -2: blu,pn %xcc, 9f - andcc %o0, 0x38, %o2 - be,pn %icc, 6f - mov 64, %o4 - andcc %o0, 8, %g0 - be,pn %icc, 1f - sub %o4, %o2, %o4 - stx %g0, [%o0] - add %o0, 8, %o0 -1: andcc %o4, 16, %g0 - be,pn %icc, 1f - sub %o1, %o4, %o1 - stx %g0, [%o0] - stx %g0, [%o0 + 8] - add %o0, 16, %o0 -1: andcc %o4, 32, %g0 - be,pn %icc, 7f - andncc %o1, 0x3f, %o3 - stx %g0, [%o0] - stx %g0, [%o0 + 8] - stx %g0, [%o0 + 16] - stx %g0, [%o0 + 24] - add %o0, 32, %o0 -6: andncc %o1, 0x3f, %o3 -7: be,pn %xcc, 9f - wr %g0, ASI_BLK_P, %asi - membar #StoreLoad | #StoreStore | #LoadStore - fzero %f0 - andcc %o3, 0xc0, %o2 - and %o1, 0x3f, %o1 - fzero %f2 - andn %o3, 0xff, %o3 - faddd %f0, %f2, %f4 - fmuld %f0, %f2, %f6 - cmp %o2, 64 - faddd %f0, %f2, %f8 - fmuld %f0, %f2, %f10 - faddd %f0, %f2, %f12 - brz,pn %o2, 10f - fmuld %f0, %f2, %f14 - be,pn %icc, 2f - stda %f0, [%o0 + 0x00] %asi - cmp %o2, 128 - be,pn %icc, 2f - stda %f0, [%o0 + 0x40] %asi - stda %f0, [%o0 + 0x80] %asi -2: brz,pn %o3, 12f - add %o0, %o2, %o0 -10: stda %f0, [%o0 + 0x00] %asi - stda %f0, [%o0 + 0x40] %asi - stda %f0, [%o0 + 0x80] %asi - stda %f0, [%o0 + 0xc0] %asi -11: subcc %o3, 256, %o3 - bne,pt %xcc, 10b - add %o0, 256, %o0 -12: wr %g0, FPRS_FEF, %fprs - membar #StoreLoad | #StoreStore -9: andcc %o1, 0xf8, %o2 - be,pn %xcc, 13f - andcc %o1, 7, %o1 -14: rd %pc, %o4 - srl %o2, 1, %o3 - sub %o4, %o3, %o4 - jmpl %o4 + (13f - 14b), %g0 - add %o0, %o2, %o0 -12: ZERO_BLOCKS (%o0, 0xc8, %g0) - ZERO_BLOCKS (%o0, 0x88, %g0) - ZERO_BLOCKS (%o0, 0x48, %g0) - ZERO_BLOCKS (%o0, 0x08, %g0) -13: be,pn %xcc, 8f - andcc %o1, 4, %g0 - be,pn %xcc, 1f - andcc %o1, 2, %g0 - stw %g0, [%o0] - add %o0, 4, %o0 -1: be,pn %xcc, 1f - andcc %o1, 1, %g0 - sth %g0, [%o0] - add %o0, 2, %o0 -1: bne,a,pn %xcc, 8f - stb %g0, [%o0] -8: retl - mov %o5, %o0 -17: be,pn %xcc, 13b - orcc %o1, 0, %g0 - be,pn %xcc, 0f -8: add %o0, 1, %o0 - subcc %o1, 1, %o1 - bne,pt %xcc, 8b - stb %g0, [%o0 - 1] -0: retl - mov %o5, %o0 -#ifdef __UCLIBC_SUSV3_LEGACY__ -END(bzero) -#endif diff --git a/libc/string/sparc/sparc64/sparcv9b/memcpy.S b/libc/string/sparc/sparc64/sparcv9b/memcpy.S deleted file mode 100644 index 8bbdc84f1..000000000 --- a/libc/string/sparc/sparc64/sparcv9b/memcpy.S +++ /dev/null @@ -1,611 +0,0 @@ -/* Copy SIZE bytes from SRC to DEST. - For UltraSPARC-III. - Copyright (C) 2001, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David S. Miller (davem@redhat.com) - - 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 - . */ - -#include - -#define ASI_BLK_P 0xf0 -#define FPRS_FEF 0x04 -#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs -#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs - -#ifndef XCC -#define USE_BPR -#define XCC xcc -#endif - - .register %g2,#scratch - .register %g3,#scratch - .register %g6,#scratch - - .text - .align 32 - -#ifdef __UCLIBC_SUSV3_LEGACY__ -ENTRY(bcopy) - sub %o1, %o0, %o4 - mov %o0, %g4 - cmp %o4, %o2 - mov %o1, %o0 - bgeu,pt %XCC, 100f - mov %g4, %o1 -#ifndef USE_BPR - srl %o2, 0, %o2 -#endif - brnz,pn %o2, 220f - add %o0, %o2, %o0 - retl - nop -END(bcopy) -#endif - - /* Special/non-trivial issues of this code: - * - * 1) %o5 is preserved from VISEntryHalf to VISExitHalf - * 2) Only low 32 FPU registers are used so that only the - * lower half of the FPU register set is dirtied by this - * code. This is especially important in the kernel. - * 3) This code never prefetches cachelines past the end - * of the source buffer. - * - * The cheetah's flexible spine, oversized liver, enlarged heart, - * slender muscular body, and claws make it the swiftest hunter - * in Africa and the fastest animal on land. Can reach speeds - * of up to 2.4GB per second. - */ - .align 32 -ENTRY(memcpy) - -100: /* %o0=dst, %o1=src, %o2=len */ - mov %o0, %g5 - cmp %o2, 0 - be,pn %XCC, out -218: or %o0, %o1, %o3 - cmp %o2, 16 - bleu,a,pn %XCC, small_copy - or %o3, %o2, %o3 - - cmp %o2, 256 - blu,pt %XCC, medium_copy - andcc %o3, 0x7, %g0 - - ba,pt %xcc, enter - andcc %o0, 0x3f, %g2 - - /* Here len >= 256 and condition codes reflect execution - * of "andcc %o0, 0x7, %g2", done by caller. - */ - .align 64 -enter: - /* Is 'dst' already aligned on an 64-byte boundary? */ - be,pt %XCC, 2f - - /* Compute abs((dst & 0x3f) - 0x40) into %g2. This is the number - * of bytes to copy to make 'dst' 64-byte aligned. We pre- - * subtract this from 'len'. - */ - sub %g2, 0x40, %g2 - sub %g0, %g2, %g2 - sub %o2, %g2, %o2 - - /* Copy %g2 bytes from src to dst, one byte at a time. */ -1: ldub [%o1 + 0x00], %o3 - add %o1, 0x1, %o1 - add %o0, 0x1, %o0 - subcc %g2, 0x1, %g2 - - bg,pt %XCC, 1b - stb %o3, [%o0 + -1] - -2: VISEntryHalf - and %o1, 0x7, %g1 - ba,pt %xcc, begin - alignaddr %o1, %g0, %o1 - - .align 64 -begin: - prefetch [%o1 + 0x000], #one_read - prefetch [%o1 + 0x040], #one_read - andn %o2, (0x40 - 1), %o4 - prefetch [%o1 + 0x080], #one_read - prefetch [%o1 + 0x0c0], #one_read - ldd [%o1 + 0x000], %f0 - prefetch [%o1 + 0x100], #one_read - ldd [%o1 + 0x008], %f2 - prefetch [%o1 + 0x140], #one_read - ldd [%o1 + 0x010], %f4 - prefetch [%o1 + 0x180], #one_read - faligndata %f0, %f2, %f16 - ldd [%o1 + 0x018], %f6 - faligndata %f2, %f4, %f18 - ldd [%o1 + 0x020], %f8 - faligndata %f4, %f6, %f20 - ldd [%o1 + 0x028], %f10 - faligndata %f6, %f8, %f22 - - ldd [%o1 + 0x030], %f12 - faligndata %f8, %f10, %f24 - ldd [%o1 + 0x038], %f14 - faligndata %f10, %f12, %f26 - ldd [%o1 + 0x040], %f0 - - sub %o4, 0x80, %o4 - add %o1, 0x40, %o1 - ba,pt %xcc, loop - srl %o4, 6, %o3 - - .align 64 -loop: - ldd [%o1 + 0x008], %f2 - faligndata %f12, %f14, %f28 - ldd [%o1 + 0x010], %f4 - faligndata %f14, %f0, %f30 - stda %f16, [%o0] ASI_BLK_P - ldd [%o1 + 0x018], %f6 - faligndata %f0, %f2, %f16 - - ldd [%o1 + 0x020], %f8 - faligndata %f2, %f4, %f18 - ldd [%o1 + 0x028], %f10 - faligndata %f4, %f6, %f20 - ldd [%o1 + 0x030], %f12 - faligndata %f6, %f8, %f22 - ldd [%o1 + 0x038], %f14 - faligndata %f8, %f10, %f24 - - ldd [%o1 + 0x040], %f0 - prefetch [%o1 + 0x180], #one_read - faligndata %f10, %f12, %f26 - subcc %o3, 0x01, %o3 - add %o1, 0x40, %o1 - bg,pt %XCC, loop - add %o0, 0x40, %o0 - - /* Finally we copy the last full 64-byte block. */ -loopfini: - ldd [%o1 + 0x008], %f2 - faligndata %f12, %f14, %f28 - ldd [%o1 + 0x010], %f4 - faligndata %f14, %f0, %f30 - stda %f16, [%o0] ASI_BLK_P - ldd [%o1 + 0x018], %f6 - faligndata %f0, %f2, %f16 - ldd [%o1 + 0x020], %f8 - faligndata %f2, %f4, %f18 - ldd [%o1 + 0x028], %f10 - faligndata %f4, %f6, %f20 - ldd [%o1 + 0x030], %f12 - faligndata %f6, %f8, %f22 - ldd [%o1 + 0x038], %f14 - faligndata %f8, %f10, %f24 - cmp %g1, 0 - be,pt %XCC, 1f - add %o0, 0x40, %o0 - ldd [%o1 + 0x040], %f0 -1: faligndata %f10, %f12, %f26 - faligndata %f12, %f14, %f28 - faligndata %f14, %f0, %f30 - stda %f16, [%o0] ASI_BLK_P - add %o0, 0x40, %o0 - add %o1, 0x40, %o1 - membar #Sync - - /* Now we copy the (len modulo 64) bytes at the end. - * Note how we borrow the %f0 loaded above. - * - * Also notice how this code is careful not to perform a - * load past the end of the src buffer. - */ -loopend: - and %o2, 0x3f, %o2 - andcc %o2, 0x38, %g2 - be,pn %XCC, endcruft - subcc %g2, 0x8, %g2 - be,pn %XCC, endcruft - cmp %g1, 0 - - be,a,pt %XCC, 1f - ldd [%o1 + 0x00], %f0 - -1: ldd [%o1 + 0x08], %f2 - add %o1, 0x8, %o1 - sub %o2, 0x8, %o2 - subcc %g2, 0x8, %g2 - faligndata %f0, %f2, %f8 - std %f8, [%o0 + 0x00] - be,pn %XCC, endcruft - add %o0, 0x8, %o0 - ldd [%o1 + 0x08], %f0 - add %o1, 0x8, %o1 - sub %o2, 0x8, %o2 - subcc %g2, 0x8, %g2 - faligndata %f2, %f0, %f8 - std %f8, [%o0 + 0x00] - bne,pn %XCC, 1b - add %o0, 0x8, %o0 - - /* If anything is left, we copy it one byte at a time. - * Note that %g1 is (src & 0x3) saved above before the - * alignaddr was performed. - */ -endcruft: - cmp %o2, 0 - add %o1, %g1, %o1 - VISExitHalf - be,pn %XCC, out - sub %o0, %o1, %o3 - - andcc %g1, 0x7, %g0 - bne,pn %icc, small_copy_unaligned - andcc %o2, 0x8, %g0 - be,pt %icc, 1f - nop - ldx [%o1], %o5 - stx %o5, [%o1 + %o3] - add %o1, 0x8, %o1 - -1: andcc %o2, 0x4, %g0 - be,pt %icc, 1f - nop - lduw [%o1], %o5 - stw %o5, [%o1 + %o3] - add %o1, 0x4, %o1 - -1: andcc %o2, 0x2, %g0 - be,pt %icc, 1f - nop - lduh [%o1], %o5 - sth %o5, [%o1 + %o3] - add %o1, 0x2, %o1 - -1: andcc %o2, 0x1, %g0 - be,pt %icc, out - nop - ldub [%o1], %o5 - ba,pt %xcc, out - stb %o5, [%o1 + %o3] - -medium_copy: /* 16 < len <= 64 */ - bne,pn %XCC, small_copy_unaligned - sub %o0, %o1, %o3 - -medium_copy_aligned: - andn %o2, 0x7, %o4 - and %o2, 0x7, %o2 -1: subcc %o4, 0x8, %o4 - ldx [%o1], %o5 - stx %o5, [%o1 + %o3] - bgu,pt %XCC, 1b - add %o1, 0x8, %o1 - andcc %o2, 0x4, %g0 - be,pt %XCC, 1f - nop - sub %o2, 0x4, %o2 - lduw [%o1], %o5 - stw %o5, [%o1 + %o3] - add %o1, 0x4, %o1 -1: cmp %o2, 0 - be,pt %XCC, out - nop - ba,pt %xcc, small_copy_unaligned - nop - -small_copy: /* 0 < len <= 16 */ - andcc %o3, 0x3, %g0 - bne,pn %XCC, small_copy_unaligned - sub %o0, %o1, %o3 - -small_copy_aligned: - subcc %o2, 4, %o2 - lduw [%o1], %g1 - stw %g1, [%o1 + %o3] - bgu,pt %XCC, small_copy_aligned - add %o1, 4, %o1 - -out: retl - mov %g5, %o0 - - .align 32 -small_copy_unaligned: - subcc %o2, 1, %o2 - ldub [%o1], %g1 - stb %g1, [%o1 + %o3] - bgu,pt %XCC, small_copy_unaligned - add %o1, 1, %o1 - retl - mov %g5, %o0 - -END(memcpy) -libc_hidden_def(memcpy) - -#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src - offset - 0x20], %t0; \ - ldx [%src - offset - 0x18], %t1; \ - ldx [%src - offset - 0x10], %t2; \ - ldx [%src - offset - 0x08], %t3; \ - stw %t0, [%dst - offset - 0x1c]; \ - srlx %t0, 32, %t0; \ - stw %t0, [%dst - offset - 0x20]; \ - stw %t1, [%dst - offset - 0x14]; \ - srlx %t1, 32, %t1; \ - stw %t1, [%dst - offset - 0x18]; \ - stw %t2, [%dst - offset - 0x0c]; \ - srlx %t2, 32, %t2; \ - stw %t2, [%dst - offset - 0x10]; \ - stw %t3, [%dst - offset - 0x04]; \ - srlx %t3, 32, %t3; \ - stw %t3, [%dst - offset - 0x08]; - -#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src - offset - 0x20], %t0; \ - ldx [%src - offset - 0x18], %t1; \ - ldx [%src - offset - 0x10], %t2; \ - ldx [%src - offset - 0x08], %t3; \ - stx %t0, [%dst - offset - 0x20]; \ - stx %t1, [%dst - offset - 0x18]; \ - stx %t2, [%dst - offset - 0x10]; \ - stx %t3, [%dst - offset - 0x08]; \ - ldx [%src - offset - 0x40], %t0; \ - ldx [%src - offset - 0x38], %t1; \ - ldx [%src - offset - 0x30], %t2; \ - ldx [%src - offset - 0x28], %t3; \ - stx %t0, [%dst - offset - 0x40]; \ - stx %t1, [%dst - offset - 0x38]; \ - stx %t2, [%dst - offset - 0x30]; \ - stx %t3, [%dst - offset - 0x28]; - -#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - stw %t0, [%dst + offset + 0x04]; \ - srlx %t0, 32, %t2; \ - stw %t2, [%dst + offset + 0x00]; \ - stw %t1, [%dst + offset + 0x0c]; \ - srlx %t1, 32, %t3; \ - stw %t3, [%dst + offset + 0x08]; - -#define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \ - ldx [%src + offset + 0x00], %t0; \ - ldx [%src + offset + 0x08], %t1; \ - stx %t0, [%dst + offset + 0x00]; \ - stx %t1, [%dst + offset + 0x08]; - - .align 32 -228: andcc %o2, 1, %g0 /* IEU1 Group */ - be,pt %icc, 2f+4 /* CTI */ -1: ldub [%o1 - 1], %o5 /* LOAD Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 Group */ - be,pn %xcc, 229f /* CTI */ - stb %o5, [%o0] /* Store */ -2: ldub [%o1 - 1], %o5 /* LOAD Group */ - sub %o0, 2, %o0 /* IEU0 */ - ldub [%o1 - 2], %g5 /* LOAD Group */ - sub %o1, 2, %o1 /* IEU0 */ - subcc %o2, 2, %o2 /* IEU1 Group */ - stb %o5, [%o0 + 1] /* Store */ - bne,pt %xcc, 2b /* CTI */ - stb %g5, [%o0] /* Store */ -229: retl - mov %g4, %o0 - - .align 32 -ENTRY(memmove) - mov %o0, %g5 -#ifndef USE_BPR - srl %o2, 0, %o2 /* IEU1 Group */ -#endif - brz,pn %o2, out /* CTI Group */ - sub %o0, %o1, %o4 /* IEU0 */ - cmp %o4, %o2 /* IEU1 Group */ - bgeu,pt %XCC, 218b /* CTI */ - mov %o0, %g4 /* IEU0 */ - add %o0, %o2, %o0 /* IEU0 Group */ -220: add %o1, %o2, %o1 /* IEU1 */ - cmp %o2, 15 /* IEU1 Group */ - bleu,pn %xcc, 228b /* CTI */ - andcc %o0, 7, %g2 /* IEU1 Group */ - sub %o0, %o1, %g5 /* IEU0 */ - andcc %g5, 3, %o5 /* IEU1 Group */ - bne,pn %xcc, 232f /* CTI */ - andcc %o1, 3, %g0 /* IEU1 Group */ - be,a,pt %xcc, 236f /* CTI */ - andcc %o1, 4, %g0 /* IEU1 Group */ - andcc %o1, 1, %g0 /* IEU1 Group */ - be,pn %xcc, 4f /* CTI */ - andcc %o1, 2, %g0 /* IEU1 Group */ - ldub [%o1 - 1], %g2 /* Load Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - sub %o2, 1, %o2 /* IEU0 Group */ - be,pn %xcc, 5f /* CTI Group */ - stb %g2, [%o0] /* Store */ -4: lduh [%o1 - 2], %g2 /* Load Group */ - sub %o1, 2, %o1 /* IEU0 */ - sub %o0, 2, %o0 /* IEU1 */ - sub %o2, 2, %o2 /* IEU0 */ - sth %g2, [%o0] /* Store Group + bubble */ -5: andcc %o1, 4, %g0 /* IEU1 */ -236: be,a,pn %xcc, 2f /* CTI */ - andcc %o2, -128, %g6 /* IEU1 Group */ - lduw [%o1 - 4], %g5 /* Load Group */ - sub %o1, 4, %o1 /* IEU0 */ - sub %o0, 4, %o0 /* IEU1 */ - sub %o2, 4, %o2 /* IEU0 Group */ - stw %g5, [%o0] /* Store */ - andcc %o2, -128, %g6 /* IEU1 Group */ -2: be,pn %xcc, 235f /* CTI */ - andcc %o0, 4, %g0 /* IEU1 Group */ - be,pn %xcc, 282f + 4 /* CTI Group */ -5: RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5) - RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5) - subcc %g6, 128, %g6 /* IEU1 Group */ - sub %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 5b /* CTI */ - sub %o0, 128, %o0 /* IEU0 Group */ -235: andcc %o2, 0x70, %g6 /* IEU1 Group */ -41: be,pn %xcc, 280f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -279: rd %pc, %o5 /* PDU Group */ - sll %g6, 1, %g5 /* IEU0 Group */ - sub %o1, %g6, %o1 /* IEU1 */ - sub %o5, %g5, %o5 /* IEU0 Group */ - jmpl %o5 + %lo(280f - 279b), %g0 /* CTI Group brk forced*/ - sub %o0, %g6, %o0 /* IEU0 Group */ - RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5) - RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5) -280: be,pt %xcc, 281f /* CTI */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1 - 8], %g2 /* Load Group */ - sub %o0, 8, %o0 /* IEU0 */ - stw %g2, [%o0 + 4] /* Store Group */ - sub %o1, 8, %o1 /* IEU1 */ - srlx %g2, 32, %g2 /* IEU0 Group */ - stw %g2, [%o0] /* Store */ -281: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1 - 4], %g2 /* Load Group */ - sub %o1, 4, %o1 /* IEU0 */ - stw %g2, [%o0 - 4] /* Store Group */ - sub %o0, 4, %o0 /* IEU0 */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1 - 2], %g2 /* Load Group */ - sub %o1, 2, %o1 /* IEU0 */ - sth %g2, [%o0 - 2] /* Store Group */ - sub %o0, 2, %o0 /* IEU0 */ -1: be,pt %xcc, 211f /* CTI */ - nop /* IEU1 */ - ldub [%o1 - 1], %g2 /* Load Group */ - stb %g2, [%o0 - 1] /* Store Group + bubble */ -211: retl - mov %g4, %o0 - -282: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5) - RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5) - subcc %g6, 128, %g6 /* IEU1 Group */ - sub %o1, 128, %o1 /* IEU0 */ - bne,pt %xcc, 282b /* CTI */ - sub %o0, 128, %o0 /* IEU0 Group */ - andcc %o2, 0x70, %g6 /* IEU1 */ - be,pn %xcc, 284f /* CTI */ - andcc %o2, 8, %g0 /* IEU1 Group */ - /* Clk1 8-( */ - /* Clk2 8-( */ - /* Clk3 8-( */ - /* Clk4 8-( */ -283: rd %pc, %o5 /* PDU Group */ - sub %o1, %g6, %o1 /* IEU0 Group */ - sub %o5, %g6, %o5 /* IEU1 */ - jmpl %o5 + %lo(284f - 283b), %g0 /* CTI Group brk forced*/ - sub %o0, %g6, %o0 /* IEU0 Group */ - RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3) - RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3) -284: be,pt %xcc, 285f /* CTI Group */ - andcc %o2, 4, %g0 /* IEU1 */ - ldx [%o1 - 8], %g2 /* Load Group */ - sub %o0, 8, %o0 /* IEU0 */ - sub %o1, 8, %o1 /* IEU0 Group */ - stx %g2, [%o0] /* Store */ -285: be,pt %xcc, 1f /* CTI */ - andcc %o2, 2, %g0 /* IEU1 Group */ - lduw [%o1 - 4], %g2 /* Load Group */ - sub %o0, 4, %o0 /* IEU0 */ - sub %o1, 4, %o1 /* IEU0 Group */ - stw %g2, [%o0] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - andcc %o2, 1, %g0 /* IEU1 Group */ - lduh [%o1 - 2], %g2 /* Load Group */ - sub %o0, 2, %o0 /* IEU0 */ - sub %o1, 2, %o1 /* IEU0 Group */ - sth %g2, [%o0] /* Store */ -1: be,pt %xcc, 1f /* CTI */ - nop /* IEU0 Group */ - ldub [%o1 - 1], %g2 /* Load Group */ - stb %g2, [%o0 - 1] /* Store Group + bubble */ -1: retl - mov %g4, %o0 - -232: brz,pt %g2, 2f /* CTI Group */ - sub %o2, %g2, %o2 /* IEU0 Group */ -1: ldub [%o1 - 1], %g5 /* Load Group */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %g2, 1, %g2 /* IEU1 Group */ - bne,pt %xcc, 1b /* CTI */ - stb %g5, [%o0] /* Store */ -2: andn %o2, 7, %g5 /* IEU0 Group */ - and %o2, 7, %o2 /* IEU1 */ - fmovd %f0, %f2 /* FPU */ - alignaddr %o1, %g0, %g1 /* GRU Group */ - ldd [%g1], %f4 /* Load Group */ -1: ldd [%g1 - 8], %f6 /* Load Group */ - sub %g1, 8, %g1 /* IEU0 Group */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f6, %f4, %f0 /* GRU Group */ - std %f0, [%o0 - 8] /* Store */ - sub %o1, 8, %o1 /* IEU0 Group */ - be,pn %xcc, 233f /* CTI */ - sub %o0, 8, %o0 /* IEU1 */ - ldd [%g1 - 8], %f4 /* Load Group */ - sub %g1, 8, %g1 /* IEU0 */ - subcc %g5, 8, %g5 /* IEU1 */ - faligndata %f4, %f6, %f0 /* GRU Group */ - std %f0, [%o0 - 8] /* Store */ - sub %o1, 8, %o1 /* IEU0 */ - bne,pn %xcc, 1b /* CTI Group */ - sub %o0, 8, %o0 /* IEU0 */ -233: brz,pn %o2, 234f /* CTI Group */ - nop /* IEU0 */ -237: ldub [%o1 - 1], %g5 /* LOAD */ - sub %o1, 1, %o1 /* IEU0 */ - sub %o0, 1, %o0 /* IEU1 */ - subcc %o2, 1, %o2 /* IEU1 */ - bne,pt %xcc, 237b /* CTI */ - stb %g5, [%o0] /* Store Group */ -234: wr %g0, FPRS_FEF, %fprs - retl - mov %g4, %o0 -END(memmove) -libc_hidden_def(memmove) - -#ifdef USE_BPR -weak_alias(memcpy,__align_cpy_1) -weak_alias(memcpy,__align_cpy_2) -weak_alias(memcpy,__align_cpy_4) -weak_alias(memcpy,__align_cpy_8) -weak_alias(memcpy,__align_cpy_16) -#endif diff --git a/libc/string/sparc/sparc64/stpcpy.S b/libc/string/sparc/sparc64/stpcpy.S deleted file mode 100644 index 9af0d5667..000000000 --- a/libc/string/sparc/sparc64/stpcpy.S +++ /dev/null @@ -1,270 +0,0 @@ -/* Copy SRC to DEST returning the address of the terminating '\0' in DEST. - For SPARC v9. - Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - - 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 - . */ - -#include -#ifndef XCC - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(stpcpy) - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - sllx %g1, 32, %g2 /* IEU0 Group */ - - bne,pn %icc, 12f /* CTI */ - andcc %o1, 7, %g3 /* IEU1 */ - or %g1, %g2, %g1 /* IEU0 Group */ - bne,pn %icc, 14f /* CTI */ - - sllx %g1, 7, %g2 /* IEU0 Group */ -1: ldx [%o1], %o3 /* Load */ - add %o1, 8, %o1 /* IEU1 */ -2: mov %o3, %g3 /* IEU0 Group */ - - sub %o3, %g1, %o2 /* IEU1 */ -3: ldxa [%o1] ASI_PNF, %o3 /* Load */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %g3, %o2 /* IEU0 Group */ -#endif - add %o0, 8, %o0 /* IEU0 Group */ - andcc %o2, %g2, %g0 /* IEU1 */ - - add %o1, 8, %o1 /* IEU0 Group */ - be,a,pt %xcc, 2b /* CTI */ - stx %g3, [%o0 - 8] /* Store */ - srlx %g3, 56, %g5 /* IEU0 Group */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 11f /* CTI */ - srlx %g3, 48, %g4 /* IEU0 */ - andcc %g4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 10f /* CTI */ - srlx %g3, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 9f /* CTI */ - - srlx %g3, 32, %g4 /* IEU0 */ - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 8f /* CTI */ - srlx %g3, 24, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - srlx %g3, 16, %g4 /* IEU0 */ - andcc %g4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 6f /* CTI */ - srlx %g3, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - - sub %o3, %g1, %o2 /* IEU0 */ - stx %g3, [%o0 - 8] /* Store Group */ - andcc %g3, 0xff, %g0 /* IEU1 */ - bne,pt %icc, 3b /* CTI */ - - mov %o3, %g3 /* IEU0 Group */ -4: retl /* CTI+IEU1 Group */ - sub %o0, 1, %o0 /* IEU0 */ - - .align 16 -6: ba,pt %xcc, 23f /* CTI Group */ - sub %o0, 3, %g6 /* IEU0 */ -5: sub %o0, 2, %g6 /* IEU0 Group */ - stb %g5, [%o0 - 2] /* Store */ - - srlx %g3, 16, %g4 /* IEU0 Group */ -23: sth %g4, [%o0 - 4] /* Store */ - srlx %g3, 32, %g4 /* IEU0 Group */ - stw %g4, [%o0 - 8] /* Store */ - - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -8: ba,pt %xcc, 24f /* CTI Group */ - sub %o0, 5, %g6 /* IEU0 */ - -7: sub %o0, 4, %g6 /* IEU0 Group */ - stb %g5, [%o0 - 4] /* Store */ - srlx %g3, 32, %g4 /* IEU0 Group */ -24: stw %g4, [%o0 - 8] /* Store */ - - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -10: ba,pt %xcc, 25f /* CTI Group */ - sub %o0, 7, %g6 /* IEU0 */ - -9: sub %o0, 6, %g6 /* IEU0 Group */ - stb %g5, [%o0 - 6] /* Store */ - srlx %g3, 48, %g4 /* IEU0 */ -25: sth %g4, [%o0 - 8] /* Store Group */ - - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -11: stb %g5, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - - sub %o0, 8, %o0 /* IEU0 */ - - .align 16 -12: or %g1, %g2, %g1 /* IEU0 Group */ - ldub [%o1], %o3 /* Load */ - sllx %g1, 7, %g2 /* IEU0 Group */ - stb %o3, [%o0] /* Store Group */ - -13: add %o0, 1, %o0 /* IEU0 */ - add %o1, 1, %o1 /* IEU1 */ - andcc %o3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - - lduba [%o1] ASI_PNF, %o3 /* Load */ - andcc %o0, 7, %g0 /* IEU1 Group */ - bne,a,pt %icc, 13b /* CTI */ - stb %o3, [%o0] /* Store */ - - andcc %o1, 7, %g3 /* IEU1 Group */ - be,a,pt %icc, 1b /* CTI */ - ldx [%o1], %o3 /* Load */ -14: orcc %g0, 64, %g4 /* IEU1 Group */ - - sllx %g3, 3, %g5 /* IEU0 */ - sub %o1, %g3, %o1 /* IEU0 Group */ - sub %g4, %g5, %g4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080808080808080 * - * %g3 = source alignment * - * %g5 = number of bits to shift left * - * %g4 = number of bits to shift right */ - ldxa [%o1] ASI_PNF, %o5 /* Load Group */ - - addcc %o1, 8, %o1 /* IEU1 */ -15: sllx %o5, %g5, %o3 /* IEU0 Group */ - ldxa [%o1] ASI_PNF, %o5 /* Load */ - srlx %o5, %g4, %o4 /* IEU0 Group */ - - add %o0, 8, %o0 /* IEU1 */ - or %o3, %o4, %o3 /* IEU0 Group */ - add %o1, 8, %o1 /* IEU1 */ - sub %o3, %g1, %o4 /* IEU0 Group */ - -#ifdef EIGHTBIT_NOT_RARE - andn %o4, %o3, %o4 /* IEU0 Group */ -#endif - andcc %o4, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - srlx %o3, 56, %o4 /* IEU0 Group */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 22f /* CTI */ - srlx %o3, 48, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 21f /* CTI */ - srlx %o3, 40, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 20f /* CTI */ - - srlx %o3, 32, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 19f /* CTI */ - srlx %o3, 24, %o4 /* IEU0 */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 18f /* CTI */ - srlx %o3, 16, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 17f /* CTI */ - srlx %o3, 8, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 16f /* CTI */ - - andcc %o3, 0xff, %g0 /* IEU1 Group */ - bne,pn %icc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - - sub %o0, 1, %o0 /* IEU0 */ - - .align 16 -17: ba,pt %xcc, 26f /* CTI Group */ - subcc %o0, 3, %g6 /* IEU1 */ -18: ba,pt %xcc, 27f /* CTI Group */ - subcc %o0, 4, %g6 /* IEU1 */ - -19: ba,pt %xcc, 28f /* CTI Group */ - subcc %o0, 5, %g6 /* IEU1 */ -16: subcc %o0, 2, %g6 /* IEU1 Group */ - srlx %o3, 8, %o4 /* IEU0 */ - - stb %o4, [%o0 - 2] /* Store */ -26: srlx %o3, 16, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 3] /* Store */ -27: srlx %o3, 24, %o4 /* IEU0 Group */ - - stb %o4, [%o0 - 4] /* Store */ -28: srlx %o3, 32, %o4 /* IEU0 Group */ - stw %o4, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ - - .align 16 -21: ba,pt %xcc, 29f /* CTI Group */ - subcc %o0, 7, %g6 /* IEU1 */ -22: ba,pt %xcc, 30f /* CTI Group */ - subcc %o0, 8, %g6 /* IEU1 */ - -20: subcc %o0, 6, %g6 /* IEU1 Group */ - srlx %o3, 40, %o4 /* IEU0 */ - stb %o4, [%o0 - 6] /* Store */ -29: srlx %o3, 48, %o4 /* IEU0 Group */ - - stb %o4, [%o0 - 7] /* Store */ -30: srlx %o3, 56, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ -END(stpcpy) -libc_hidden_def(stpcpy) diff --git a/libc/string/sparc/sparc64/strcat.S b/libc/string/sparc/sparc64/strcat.S deleted file mode 100644 index 56725cc91..000000000 --- a/libc/string/sparc/sparc64/strcat.S +++ /dev/null @@ -1,338 +0,0 @@ -/* strcat (dest, src) -- Append SRC on the end of DEST. - For SPARC v9. - Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek and - Jan Vondrak . - - 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 - . */ - -#include -#ifndef XCC -#define XCC xcc -#define USE_BPR - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(strcat) - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - ldub [%o0], %o3 /* Load */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - mov %o0, %g6 /* IEU1 */ - - sllx %g1, 32, %g2 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - or %g1, %g2, %g1 /* IEU0 Group */ - bne,pn %icc, 32f /* CTI */ - - sllx %g1, 7, %g2 /* IEU0 Group */ - brz,pn %o3, 30f /* CTI+IEU1 */ - ldx [%o0], %o3 /* Load */ -48: add %o0, 8, %o0 /* IEU0 Group */ - -49: sub %o3, %g1, %o2 /* IEU0 Group */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %o3, %g5 /* IEU0 Group */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %g5, %g2, %g0 /* IEU1 Group */ -#else - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g2, %g0 /* IEU1 Group */ -#endif - be,pt %xcc, 49b /* CTI */ - - add %o0, 8, %o0 /* IEU0 */ - addcc %o2, %g1, %g3 /* IEU1 Group */ - srlx %o2, 32, %o2 /* IEU0 */ -50: andcc %o2, %g2, %g0 /* IEU1 Group */ - - be,pn %xcc, 51f /* CTI */ - srlx %g3, 56, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 29f /* CTI */ - - srlx %g3, 48, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 28f /* CTI */ - srlx %g3, 40, %o2 /* IEU0 */ - - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 27f /* CTI */ - srlx %g3, 32, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 26f /* CTI */ -51: srlx %g3, 24, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 25f /* CTI */ - - srlx %g3, 16, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 24f /* CTI */ - srlx %g3, 8, %o2 /* IEU0 */ - - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 23f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 52f /* CTI */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 49b /* CTI */ - - add %o0, 8, %o0 /* IEU0 */ - addcc %o2, %g1, %g3 /* IEU1 Group */ - ba,pt %xcc, 50b /* CTI */ - srlx %o2, 32, %o2 /* IEU0 */ - - .align 16 -52: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -9, %o0 /* IEU0 */ -23: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -10, %o0 /* IEU0 */ - -24: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -11, %o0 /* IEU0 */ -25: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -12, %o0 /* IEU0 */ - -26: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -13, %o0 /* IEU0 */ -27: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -14, %o0 /* IEU0 */ - -28: ba,pt %xcc, 12f /* CTI Group */ - add %o0, -15, %o0 /* IEU0 */ -29: add %o0, -16, %o0 /* IEU0 Group */ -30: andcc %o1, 7, %g3 /* IEU1 */ - -31: bne,pn %icc, 14f /* CTI */ - orcc %g0, 64, %g4 /* IEU1 Group */ -1: ldx [%o1], %o3 /* Load */ - add %o1, 8, %o1 /* IEU1 */ - -2: mov %o3, %g3 /* IEU0 Group */ -3: sub %o3, %g1, %o2 /* IEU1 */ - ldxa [%o1] ASI_PNF, %o3 /* Load */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %g3, %o2 /* IEU0 Group */ -#endif - add %o0, 8, %o0 /* IEU0 Group */ - - andcc %o2, %g2, %g0 /* IEU1 */ - add %o1, 8, %o1 /* IEU0 Group */ - be,a,pt %xcc, 2b /* CTI */ - stx %g3, [%o0 - 8] /* Store */ - - srlx %g3, 56, %g5 /* IEU0 Group */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 11f /* CTI */ - srlx %g3, 48, %g4 /* IEU0 */ - - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 10f /* CTI */ - srlx %g3, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 9f /* CTI */ - srlx %g3, 32, %g4 /* IEU0 */ - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 8f /* CTI */ - - srlx %g3, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - srlx %g3, 16, %g4 /* IEU0 */ - - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 6f /* CTI */ - srlx %g3, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 5f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - stx %g3, [%o0 - 8] /* Store Group */ - andcc %g3, 0xff, %g0 /* IEU1 */ - - bne,pt %icc, 3b /* CTI */ - mov %o3, %g3 /* IEU0 Group */ -4: retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - - .align 16 -5: stb %g5, [%o0 - 2] /* Store Group */ - srlx %g3, 16, %g4 /* IEU0 */ -6: sth %g4, [%o0 - 4] /* Store Group */ - srlx %g3, 32, %g4 /* IEU0 */ - - stw %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -7: stb %g5, [%o0 - 4] /* Store Group */ - - srlx %g3, 32, %g4 /* IEU0 */ -8: stw %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - -9: stb %g5, [%o0 - 6] /* Store Group */ - srlx %g3, 48, %g4 /* IEU0 */ -10: sth %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ -11: stb %g5, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - - .align 16 -32: andcc %o0, 7, %g0 /* IEU1 Group */ - be,a,pn %icc, 48b /* CTI */ - ldx [%o0], %o3 /* Load */ - add %o0, 1, %o0 /* IEU0 Group */ - - brnz,a,pt %o3, 32b /* CTI+IEU1 */ - lduba [%o0] ASI_PNF, %o3 /* Load */ - add %o0, -1, %o0 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 Group */ - - be,a,pn %icc, 31b /* CTI */ - andcc %o1, 7, %g3 /* IEU1 Group */ -12: ldub [%o1], %o3 /* Load */ - stb %o3, [%o0] /* Store Group */ - -13: add %o0, 1, %o0 /* IEU0 */ - add %o1, 1, %o1 /* IEU1 */ - andcc %o3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - - lduba [%o1] ASI_PNF, %o3 /* Load */ - andcc %o0, 7, %g0 /* IEU1 Group */ - bne,a,pt %icc, 13b /* CTI */ - stb %o3, [%o0] /* Store */ - - andcc %o1, 7, %g3 /* IEU1 Group */ - be,a,pt %icc, 1b /* CTI */ - ldx [%o1], %o3 /* Load */ - orcc %g0, 64, %g4 /* IEU1 Group */ - -14: sllx %g3, 3, %g5 /* IEU0 */ - sub %o1, %g3, %o1 /* IEU0 Group */ - sub %g4, %g5, %g4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080808080808080 * - * %g3 = source alignment * - * %g5 = number of bits to shift left * - * %g4 = number of bits to shift right */ - ldxa [%o1] ASI_PNF, %o5 /* Load Group */ - - addcc %o1, 8, %o1 /* IEU1 */ -15: sllx %o5, %g5, %o3 /* IEU0 Group */ - ldxa [%o1] ASI_PNF, %o5 /* Load */ - srlx %o5, %g4, %o4 /* IEU0 Group */ - - add %o0, 8, %o0 /* IEU1 */ - or %o3, %o4, %o3 /* IEU0 Group */ - add %o1, 8, %o1 /* IEU1 */ - sub %o3, %g1, %o4 /* IEU0 Group */ - -#ifdef EIGHTBIT_NOT_RARE - andn %o4, %o3, %o4 /* IEU0 Group */ -#endif - andcc %o4, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - srlx %o3, 56, %o4 /* IEU0 Group */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 22f /* CTI */ - srlx %o3, 48, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 21f /* CTI */ - srlx %o3, 40, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 20f /* CTI */ - - srlx %o3, 32, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 19f /* CTI */ - srlx %o3, 24, %o4 /* IEU0 */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 18f /* CTI */ - srlx %o3, 16, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 17f /* CTI */ - srlx %o3, 8, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 16f /* CTI */ - - andcc %o3, 0xff, %g0 /* IEU1 Group */ - bne,pn %icc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ - - .align 16 -16: srlx %o3, 8, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 2] /* Store */ -17: srlx %o3, 16, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 3] /* Store */ - -18: srlx %o3, 24, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 4] /* Store */ -19: srlx %o3, 32, %o4 /* IEU0 Group */ - stw %o4, [%o0 - 8] /* Store */ - - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - nop - nop - -20: srlx %o3, 40, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 6] /* Store */ -21: srlx %o3, 48, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 7] /* Store */ - -22: srlx %o3, 56, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -END(strcat) -libc_hidden_def(strcat) diff --git a/libc/string/sparc/sparc64/strchr.S b/libc/string/sparc/sparc64/strchr.S deleted file mode 100644 index 25810fd1a..000000000 --- a/libc/string/sparc/sparc64/strchr.S +++ /dev/null @@ -1,485 +0,0 @@ -/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. - For SPARC v9. - Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - - 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 - . */ - -#include -#include -#ifndef XCC -#define XCC xcc -#define USE_BPR - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(strchr) - andcc %o1, 0xff, %o1 /* IEU1 Group */ - be,pn %icc, 17f /* CTI */ - sllx %o1, 8, %g3 /* IEU0 Group */ - sethi %hi(0x01010101), %g1 /* IEU1 */ - - or %g3, %o1, %g3 /* IEU0 Group */ - ldub [%o0], %o3 /* Load */ - sllx %g3, 16, %g5 /* IEU0 Group */ - or %g1, %lo(0x01010101), %g1 /* IEU1 */ - - sllx %g1, 32, %g2 /* IEU0 Group */ - brz,pn %o3, 5f /* CTI+IEU1 */ - orcc %g3, %g5, %g3 /* IEU1 Group */ - sllx %g3, 32, %g5 /* IEU0 */ - - cmp %o3, %o1 /* IEU1 Group */ - be,pn %xcc, 14f /* CTI */ - or %g1, %g2, %g1 /* IEU0 */ - andcc %o0, 7, %g0 /* IEU1 Group */ - - bne,a,pn %icc, 15f /* CTI */ - add %o0, 1, %o0 /* IEU0 */ - ldx [%o0], %o3 /* Load Group */ -1: sllx %g1, 7, %g2 /* IEU0 */ - - or %g3, %g5, %g3 /* IEU1 */ - add %o0, 8, %o0 /* IEU0 Group */ - xor %o3, %g3, %o4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080088080808080 * - * %g3 = c c c c c c c c * - * %o3 = value * - * %o4 = value XOR c */ -2: sub %o3, %g1, %o2 /* IEU0 Group */ - - sub %o4, %g1, %o5 /* IEU1 */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %o3, %g6 /* IEU0 Group */ - andn %o5, %o4, %o5 /* IEU1 */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - or %o5, %g6, %o5 /* IEU0 Group */ -#else - ldxa [%o0] ASI_PNF, %o3 /* Load */ - or %o5, %o2, %o5 /* IEU0 Group */ -#endif - add %o0, 8, %o0 /* IEU1 */ - - andcc %o5, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 2b /* CTI */ - xor %o3, %g3, %o4 /* IEU0 */ - srlx %o5, 32, %g5 /* IEU0 Group */ - - add %o2, %g1, %o2 /* IEU1 */ -3: andcc %g5, %g2, %g0 /* IEU1 Group */ - be,pn %xcc, 4f /* CTI */ - srlx %o2, 56, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - srlx %o4, 56, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 6f /* CTI */ - srlx %o2, 48, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - - srlx %o4, 48, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - srlx %o2, 40, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - srlx %o4, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 8f /* CTI */ - srlx %o2, 32, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - - srlx %o4, 32, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 9f /* CTI */ -4: srlx %o2, 24, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - srlx %o4, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 10f /* CTI */ - srlx %o2, 16, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - - srlx %o4, 16, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 11f /* CTI */ - srlx %o2, 8, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - srlx %o4, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 12f /* CTI */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 13f /* CTI */ - xor %o3, %g3, %o4 /* IEU0 */ - ldxa [%o0] ASI_PNF, %o3 /* Load Group */ - - sub %o4, %g1, %o5 /* IEU0 */ - or %o5, %o2, %o5 /* IEU1 */ - add %o0, 8, %o0 /* IEU0 Group */ - andcc %o5, %g2, %g0 /* IEU1 */ - - be,a,pt %xcc, 2b /* CTI */ - xor %o3, %g3, %o4 /* IEU0 Group */ - srlx %o5, 32, %g5 /* IEU0 Group */ - ba,pt %xcc, 3b /* CTI */ - - add %o2, %g1, %o2 /* IEU1 */ - - .align 16 -5: retl /* CTI+IEU1 Group */ - clr %o0 /* IEU0 */ -6: retl /* CTI+IEU1 Group */ - add %o0, -16, %o0 /* IEU0 */ - -7: retl /* CTI+IEU1 Group */ - add %o0, -15, %o0 /* IEU0 */ -8: retl /* CTI+IEU1 Group */ - add %o0, -14, %o0 /* IEU0 */ - -9: retl /* CTI+IEU1 Group */ - add %o0, -13, %o0 /* IEU0 */ -10: retl /* CTI+IEU1 Group */ - add %o0, -12, %o0 /* IEU0 */ - -11: retl /* CTI+IEU1 Group */ - add %o0, -11, %o0 /* IEU0 */ -12: retl /* CTI+IEU1 Group */ - add %o0, -10, %o0 /* IEU0 */ - -13: retl /* CTI+IEU1 Group */ - add %o0, -9, %o0 /* IEU0 */ -14: retl /* CTI+IEU1 Group */ - nop /* IEU0 */ - - .align 16 -15: ldub [%o0], %o3 /* Load Group */ -16: andcc %o0, 7, %g0 /* IEU1 */ - be,a,pn %icc, 1b /* CTI */ - ldx [%o0], %o3 /* Load Group */ - - andcc %o3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5b /* CTI */ - add %o0, 1, %o0 /* IEU0 */ - cmp %o3, %o1 /* IEU1 Group */ - - bne,a,pn %icc, 16b /* CTI */ - ldub [%o0], %o3 /* Load */ - retl /* CTI+IEU1 Group */ - add %o0, -1, %o0 /* IEU0 */ - - /* strchr (str, 0) */ - .align 32 - nop - .align 16 -17: sethi %hi(0x01010101), %g1 /* IEU0 Group */ - ldub [%o0], %o3 /* Load */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - sllx %g1, 32, %g2 /* IEU0 Group */ - - andcc %o0, 7, %g0 /* IEU1 */ - or %g1, %g2, %g1 /* IEU0 Group */ - bne,pn %icc, 32f /* CTI */ - sllx %g1, 7, %g2 /* IEU0 Group */ - - brz,pn %o3, 30f /* CTI+IEU1 */ - ldx [%o0], %o3 /* Load */ -18: add %o0, 8, %o0 /* IEU0 Group */ -19: sub %o3, %g1, %o2 /* IEU0 Group */ - -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %o3, %g6 /* IEU0 Group */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %g6, %g2, %g0 /* IEU1 Group */ -#else - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g2, %g0 /* IEU1 Group */ -#endif - be,pt %xcc, 19b /* CTI */ - add %o0, 8, %o0 /* IEU0 */ - - addcc %o2, %g1, %g3 /* IEU1 Group */ - srlx %o2, 32, %o2 /* IEU0 */ -20: andcc %o2, %g2, %g0 /* IEU1 Group */ - be,pn %xcc, 21f /* CTI */ - - srlx %g3, 56, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 29f /* CTI */ - srlx %g3, 48, %o2 /* IEU0 */ - - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 28f /* CTI */ - srlx %g3, 40, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 27f /* CTI */ - srlx %g3, 32, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 26f /* CTI */ - -21: srlx %g3, 24, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 25f /* CTI */ - srlx %g3, 16, %o2 /* IEU0 */ - - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 24f /* CTI */ - srlx %g3, 8, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 23f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 22f /* CTI */ - - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 19b /* CTI */ - add %o0, 8, %o0 /* IEU0 */ - - addcc %o2, %g1, %g3 /* IEU1 Group */ - ba,pt %xcc, 20b /* CTI */ - srlx %o2, 32, %o2 /* IEU0 */ - - .align 16 -22: retl /* CTI+IEU1 Group */ - add %o0, -9, %o0 /* IEU0 */ -23: retl /* CTI+IEU1 Group */ - add %o0, -10, %o0 /* IEU0 */ - -24: retl /* CTI+IEU1 Group */ - add %o0, -11, %o0 /* IEU0 */ -25: retl /* CTI+IEU1 Group */ - add %o0, -12, %o0 /* IEU0 */ - -26: retl /* CTI+IEU1 Group */ - add %o0, -13, %o0 /* IEU0 */ -27: retl /* CTI+IEU1 Group */ - add %o0, -14, %o0 /* IEU0 */ - -28: retl /* CTI+IEU1 Group */ - add %o0, -15, %o0 /* IEU0 */ -29: retl /* CTI+IEU1 Group */ - add %o0, -16, %o0 /* IEU0 */ - -30: retl /* CTI+IEU1 Group */ - nop /* IEU0 */ - - .align 16 -32: andcc %o0, 7, %g0 /* IEU1 Group */ - be,a,pn %icc, 18b /* CTI */ - ldx [%o0], %o3 /* Load */ - add %o0, 1, %o0 /* IEU0 Group */ - - brnz,a,pt %o3, 32b /* CTI+IEU1 */ - lduba [%o0] ASI_PNF, %o3 /* Load */ - retl /* CTI+IEU1 Group */ - add %o0, -1, %o0 /* IEU0 */ -END(strchr) -libc_hidden_def(strchr) -#ifdef __UCLIBC_SUSV3_LEGACY__ -strong_alias(strchr,index) -#endif - - .align 32 -ENTRY(strrchr) - andcc %o1, 0xff, %o1 /* IEU1 Group */ - be,pn %icc, 17b /* CTI */ - clr %g4 /* IEU0 */ - andcc %o0, 7, %g0 /* IEU1 Group */ - - bne,pn %icc, 13f /* CTI */ - sllx %o1, 8, %g3 /* IEU0 */ - ldx [%o0], %o3 /* Load Group */ -1: sethi %hi(0x01010101), %g1 /* IEU0 */ - - or %g3, %o1, %g3 /* IEU1 */ - sllx %g3, 16, %g5 /* IEU0 Group */ - or %g1, %lo(0x01010101), %g1 /* IEU1 */ - sllx %g1, 32, %g2 /* IEU0 Group */ - - or %g3, %g5, %g3 /* IEU1 */ - sllx %g3, 32, %g5 /* IEU0 Group */ - or %g1, %g2, %g1 /* IEU1 */ - sllx %g1, 7, %g2 /* IEU0 Group */ - - or %g3, %g5, %g3 /* IEU1 */ - add %o0, 8, %o0 /* IEU0 Group */ - xor %o3, %g3, %o4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080088080808080 * - * %g3 = c c c c c c c c * - * %o3 = value * - * %o4 = value XOR c */ -2: sub %o3, %g1, %o2 /* IEU0 Group */ - -3: sub %o4, %g1, %o5 /* IEU1 */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %o3, %g6 /* IEU0 Group */ - andn %o5, %o4, %o5 /* IEU1 */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - - or %o5, %g6, %o5 /* IEU0 Group */ -#else - ldxa [%o0] ASI_PNF, %o3 /* Load */ - - or %o5, %o2, %o5 /* IEU0 Group */ -#endif - add %o0, 8, %o0 /* IEU1 */ - andcc %o5, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 2b /* CTI */ - - xor %o3, %g3, %o4 /* IEU0 */ - srlx %o5, 32, %g5 /* IEU0 Group */ - add %o2, %g1, %o2 /* IEU1 */ - andcc %g5, %g2, %g0 /* IEU1 Group */ - - be,pn %xcc, 7f /* CTI */ - srlx %o2, 56, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - - srlx %o4, 56, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - srlx %o2, 48, %g5 /* IEU0 */ - be,a,pn %icc, 4f /* CTI */ - - add %o0, -16, %g4 /* IEU0 Group */ -4: andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - srlx %o4, 48, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - srlx %o2, 40, %g5 /* IEU0 */ - be,a,pn %icc, 5f /* CTI */ - add %o0, -15, %g4 /* IEU0 Group */ - -5: andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - srlx %o4, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - srlx %o2, 32, %g5 /* IEU0 */ - be,a,pn %icc, 6f /* CTI */ - add %o0, -14, %g4 /* IEU0 Group */ -6: andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 12f /* CTI */ - srlx %o4, 32, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,a,pn %icc, 7f /* CTI */ - - add %o0, -13, %g4 /* IEU0 */ -7: srlx %o2, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - - srlx %o4, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - srlx %o2, 16, %g5 /* IEU0 */ - be,a,pn %icc, 8f /* CTI */ - - add %o0, -12, %g4 /* IEU0 Group */ -8: andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - srlx %o4, 16, %g5 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - srlx %o2, 8, %g5 /* IEU0 */ - be,a,pn %icc, 9f /* CTI */ - add %o0, -11, %g4 /* IEU0 Group */ - -9: andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - srlx %o4, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,a,pn %icc, 10f /* CTI */ - add %o0, -10, %g4 /* IEU0 */ -10: andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12f /* CTI */ - - sub %o3, %g1, %o2 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,a,pn %icc, 11f /* CTI */ - add %o0, -9, %g4 /* IEU0 */ - -11: ba,pt %xcc, 3b /* CTI Group */ - xor %o3, %g3, %o4 /* IEU0 Group */ -12: retl /* CTI+IEU1 Group */ - mov %g4, %o0 /* IEU0 */ - - .align 16 -13: ldub [%o0], %o3 /* Load Group */ - add %o0, 1, %o0 /* IEU0 */ -14: andcc %o3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 12b /* CTI */ - - cmp %o3, %o1 /* IEU1 Group */ - ldub [%o0], %o3 /* Load */ - be,a,pn %icc, 15f /* CTI */ - add %o0, -1, %g4 /* IEU0 Group */ - -15: andcc %o0, 7, %g0 /* IEU1 Group */ - bne,a,pt %icc, 14b /* CTI */ - add %o0, 1, %o0 /* IEU0 */ - ba,pt %xcc, 1b /* CTI Group */ - - ldx [%o0], %o3 /* Load */ -END(strrchr) -libc_hidden_def(strrchr) -#ifdef __UCLIBC_SUSV3_LEGACY__ -strong_alias(strrchr,rindex) -#endif diff --git a/libc/string/sparc/sparc64/strcmp.S b/libc/string/sparc/sparc64/strcmp.S deleted file mode 100644 index 7b8500714..000000000 --- a/libc/string/sparc/sparc64/strcmp.S +++ /dev/null @@ -1,278 +0,0 @@ -/* Compare two strings for differences. - For SPARC v9. - Copyright (C) 1997, 1999, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - - 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 - . */ - -#include -#ifndef XCC - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(strcmp) - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - bne,pn %icc, 7f /* CTI */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - - andcc %o1, 7, %g3 /* IEU1 */ - bne,pn %icc, 9f /* CTI */ - sllx %g1, 32, %g2 /* IEU0 Group */ - ldx [%o0], %o2 /* Load */ - - or %g1, %g2, %g1 /* IEU0 Group */ -1: ldx [%o1], %o3 /* Load */ - sub %o1, %o0, %o1 /* IEU1 */ - sllx %g1, 7, %g2 /* IEU0 Group */ - -2: add %o0, 8, %o0 /* IEU1 */ - sub %o2, %g1, %g3 /* IEU0 Group */ - subcc %o2, %o3, %g0 /* IEU1 */ - bne,pn %xcc, 13f /* CTI */ - -#ifdef EIGHTBIT_NOT_RARE - andn %g3, %o2, %g4 /* IEU0 Group */ - ldxa [%o0] ASI_PNF, %o2 /* Load */ - andcc %g4, %g2, %g0 /* IEU1 Group */ -#else - ldxa [%o0] ASI_PNF, %o2 /* Load Group */ - andcc %g3, %g2, %g0 /* IEU1 */ -#endif - be,a,pt %xcc, 2b /* CTI */ - ldxa [%o1 + %o0] ASI_PNF, %o3 /* Load Group */ - - addcc %g3, %g1, %o4 /* IEU1 */ - srlx %g3, 32, %g3 /* IEU0 */ - andcc %g3, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 3f /* CTI */ - - srlx %o4, 56, %o5 /* IEU0 */ - andcc %o5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4f /* CTI */ - srlx %o4, 48, %o5 /* IEU0 */ - - andcc %o5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4f /* CTI */ - srlx %o4, 40, %o5 /* IEU0 */ - andcc %o5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 4f /* CTI */ - srlx %o4, 32, %o5 /* IEU0 */ - andcc %o5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4f /* CTI */ - -3: srlx %o4, 24, %o5 /* IEU0 */ - andcc %o5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4f /* CTI */ - srlx %o4, 16, %o5 /* IEU0 */ - - andcc %o5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4f /* CTI */ - srlx %o4, 8, %o5 /* IEU0 */ - andcc %o5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 4f /* CTI */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - bne,a,pn %icc, 2b /* CTI */ - ldxa [%o1 + %o0] ASI_PNF, %o3 /* Load */ - -4: retl /* CTI+IEU1 Group */ - clr %o0 /* IEU0 */ - - .align 32 -13: mov 0xff, %g6 /* IEU0 Group */ -#ifdef EIGHTBIT_NOT_RARE - andcc %g4, %g2, %g0 /* IEU1 */ -#else - andcc %g3, %g2, %g0 /* IEU1 */ -#endif - be,pt %xcc, 25f /* CTI */ - addcc %g3, %g1, %o4 /* IEU1 Group */ - - srlx %g3, 32, %g3 /* IEU0 */ - andcc %g3, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 23f /* CTI */ - sllx %g6, 56, %o5 /* IEU0 */ - - andcc %o4, %o5, %g0 /* IEU1 Group */ - be,pn %xcc, 24f /* CTI */ - sllx %g6, 48, %o5 /* IEU0 */ - andcc %o4, %o5, %g0 /* IEU1 Group */ - - be,pn %xcc, 24f /* CTI */ - sllx %g6, 40, %o5 /* IEU0 */ - andcc %o4, %o5, %g0 /* IEU1 Group */ - be,pn %xcc, 24f /* CTI */ - - sllx %g6, 32, %o5 /* IEU0 */ - andcc %o4, %o5, %g0 /* IEU1 Group */ - be,pn %xcc, 24f /* CTI */ -23: sllx %g6, 24, %o5 /* IEU0 */ - - andcc %o4, %o5, %g0 /* IEU1 Group */ - be,pn %icc, 24f /* CTI */ - sllx %g6, 16, %o5 /* IEU0 */ - andcc %o4, %o5, %g0 /* IEU1 Group */ - - be,pn %icc, 24f /* CTI */ - sllx %g6, 8, %o5 /* IEU0 */ - andcc %o4, %o5, %g0 /* IEU1 Group */ - be,pn %icc, 24f /* CTI */ - - mov %g6, %o5 /* IEU0 */ -25: cmp %o4, %o3 /* IEU1 Group */ -5: mov -1, %o0 /* IEU0 */ - retl /* CTI+IEU1 Group */ - - movgu %xcc, 1, %o0 /* Single Group */ - - .align 16 -24: sub %o5, 1, %g6 /* IEU0 Group */ - clr %o0 /* IEU1 */ - or %o5, %g6, %o5 /* IEU0 Group */ - andn %o4, %o5, %o4 /* IEU0 Group */ - - andn %o3, %o5, %o3 /* IEU1 */ - cmp %o4, %o3 /* IEU1 Group */ - movgu %xcc, 1, %o0 /* Single Group */ - retl /* CTI+IEU1 Group */ - - movlu %xcc, -1, %o0 /* Single Group */ -6: retl /* CTI+IEU1 Group */ - mov %o4, %o0 /* IEU0 */ - - .align 16 -7: ldub [%o0], %o2 /* Load */ - add %o0, 1, %o0 /* IEU1 */ - ldub [%o1], %o3 /* Load Group */ - sllx %g1, 32, %g2 /* IEU0 */ - -8: add %o1, 1, %o1 /* IEU1 */ - subcc %o2, %o3, %o4 /* IEU1 Group */ - bne,pn %xcc, 6b /* CTI */ - lduba [%o0] ASI_PNF, %o2 /* Load */ - - brz,pn %o3, 4b /* CTI+IEU1 Group */ - lduba [%o1] ASI_PNF, %o3 /* Load */ - andcc %o0, 7, %g0 /* IEU1 Group */ - bne,a,pn %icc, 8b /* CTI */ - - add %o0, 1, %o0 /* IEU0 */ - or %g1, %g2, %g1 /* IEU0 Group */ - andcc %o1, 7, %g3 /* IEU1 */ - be,a,pn %icc, 1b /* CTI */ - - ldxa [%o0] ASI_PNF, %o2 /* Load Group */ -9: sllx %g3, 3, %g5 /* IEU0 */ - mov 64, %o5 /* IEU1 */ - sub %o1, %g3, %o1 /* IEU0 Group */ - - sub %o5, %g5, %o5 /* IEU1 */ - ldxa [%o1] ASI_PNF, %g6 /* Load Group */ - or %g1, %g2, %g1 /* IEU0 */ - sub %o1, %o0, %o1 /* IEU1 */ - - sllx %g1, 7, %g2 /* IEU0 Group */ - add %o1, 8, %o1 /* IEU1 */ - /* %g1 = 0101010101010101 - * %g2 = 8080808080800880 - * %g5 = number of bits to shift left - * %o5 = number of bits to shift right */ -10: sllx %g6, %g5, %o3 /* IEU0 Group */ - ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */ - -11: srlx %g6, %o5, %o4 /* IEU0 Group */ - ldxa [%o0] ASI_PNF, %o2 /* Load */ - or %o3, %o4, %o3 /* IEU1 */ - add %o0, 8, %o0 /* IEU0 Group */ - - subcc %o2, %o3, %g0 /* IEU1 */ -#ifdef EIGHTBIT_NOT_RARE - sub %o2, %g1, %g3 /* IEU0 Group */ - bne,pn %xcc, 13b /* CTI */ - andn %g3, %o2, %g4 /* IEU0 Group */ - - andcc %g4, %g2, %g0 /* IEU1 Group */ - be,pt %xcc, 10b /* CTI */ - srlx %g4, 32, %g4 /* IEU0 */ - andcc %g4, %g2, %g0 /* IEU1 Group */ -#else - bne,pn %xcc, 13b /* CTI */ - sub %o2, %g1, %g3 /* IEU0 Group */ - andcc %g3, %g2, %g0 /* IEU1 Group */ - - be,pt %xcc, 10b /* CTI */ - srlx %g3, 32, %g3 /* IEU0 */ - andcc %g3, %g2, %g0 /* IEU1 Group */ -#endif - be,pt %xcc, 12f /* CTI */ - - srlx %o2, 56, %g3 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - srlx %o2, 48, %g3 /* IEU0 */ - - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - srlx %o2, 40, %g3 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 4b /* CTI */ - srlx %o2, 32, %g3 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - -12: srlx %o2, 24, %g3 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - srlx %o2, 16, %g3 /* IEU0 */ - - andcc %g3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - srlx %o2, 8, %g3 /* IEU0 */ - andcc %g3, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 4b /* CTI */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - sllx %g6, %g5, %o3 /* IEU0 */ - - ba,pt %xcc, 11b /* CTI Group */ - ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */ -END(strcmp) -libc_hidden_def(strcmp) diff --git a/libc/string/sparc/sparc64/strcpy.S b/libc/string/sparc/sparc64/strcpy.S deleted file mode 100644 index 28799e4f6..000000000 --- a/libc/string/sparc/sparc64/strcpy.S +++ /dev/null @@ -1,244 +0,0 @@ -/* Copy SRC to DEST returning DEST. - For SPARC v9. - Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - - 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 - . */ - -#include -#ifndef XCC - .register %g2, #scratch - .register %g3, #scratch - .register %g6, #scratch -#endif - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(strcpy) - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - mov %o0, %g6 /* IEU1 */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - - sllx %g1, 32, %g2 /* IEU0 Group */ - bne,pn %icc, 12f /* CTI */ - andcc %o1, 7, %g3 /* IEU1 */ - or %g1, %g2, %g1 /* IEU0 Group */ - - bne,pn %icc, 14f /* CTI */ - sllx %g1, 7, %g2 /* IEU0 Group */ -1: ldx [%o1], %o3 /* Load */ - add %o1, 8, %o1 /* IEU1 */ - -2: mov %o3, %g3 /* IEU0 Group */ -3: sub %o3, %g1, %o2 /* IEU1 */ - ldxa [%o1] ASI_PNF, %o3 /* Load */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %g3, %o2 /* IEU0 Group */ -#endif - add %o0, 8, %o0 /* IEU0 Group */ - - andcc %o2, %g2, %g0 /* IEU1 */ - add %o1, 8, %o1 /* IEU0 Group */ - be,a,pt %xcc, 2b /* CTI */ - stx %g3, [%o0 - 8] /* Store */ - - srlx %g3, 56, %g5 /* IEU0 Group */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 11f /* CTI */ - srlx %g3, 48, %g4 /* IEU0 */ - - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 10f /* CTI */ - srlx %g3, 40, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 9f /* CTI */ - srlx %g3, 32, %g4 /* IEU0 */ - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 8f /* CTI */ - - srlx %g3, 24, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - srlx %g3, 16, %g4 /* IEU0 */ - - andcc %g4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 6f /* CTI */ - srlx %g3, 8, %g5 /* IEU0 */ - andcc %g5, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 5f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - stx %g3, [%o0 - 8] /* Store Group */ - andcc %g3, 0xff, %g0 /* IEU1 */ - - bne,pt %icc, 3b /* CTI */ - mov %o3, %g3 /* IEU0 Group */ -4: retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - - .align 16 -5: stb %g5, [%o0 - 2] /* Store Group */ - srlx %g3, 16, %g4 /* IEU0 */ -6: sth %g4, [%o0 - 4] /* Store Group */ - srlx %g3, 32, %g4 /* IEU0 */ - - stw %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -7: stb %g5, [%o0 - 4] /* Store Group */ - - srlx %g3, 32, %g4 /* IEU0 */ -8: stw %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - -9: stb %g5, [%o0 - 6] /* Store Group */ - srlx %g3, 48, %g4 /* IEU0 */ -10: sth %g4, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ -11: stb %g5, [%o0 - 8] /* Store Group */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - -12: or %g1, %g2, %g1 /* IEU0 Group */ - ldub [%o1], %o3 /* Load */ - sllx %g1, 7, %g2 /* IEU0 Group */ - stb %o3, [%o0] /* Store Group */ - -13: add %o0, 1, %o0 /* IEU0 */ - add %o1, 1, %o1 /* IEU1 */ - andcc %o3, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 4b /* CTI */ - - lduba [%o1] ASI_PNF, %o3 /* Load */ - andcc %o0, 7, %g0 /* IEU1 Group */ - bne,a,pt %icc, 13b /* CTI */ - stb %o3, [%o0] /* Store */ - - andcc %o1, 7, %g3 /* IEU1 Group */ - be,a,pt %icc, 1b /* CTI */ - ldx [%o1], %o3 /* Load */ -14: orcc %g0, 64, %g4 /* IEU1 Group */ - - sllx %g3, 3, %g5 /* IEU0 */ - sub %o1, %g3, %o1 /* IEU0 Group */ - sub %g4, %g5, %g4 /* IEU1 */ - /* %g1 = 0101010101010101 * - * %g2 = 8080808080808080 * - * %g3 = source alignment * - * %g5 = number of bits to shift left * - * %g4 = number of bits to shift right */ - ldxa [%o1] ASI_PNF, %o5 /* Load Group */ - - addcc %o1, 8, %o1 /* IEU1 */ -15: sllx %o5, %g5, %o3 /* IEU0 Group */ - ldxa [%o1] ASI_PNF, %o5 /* Load */ - srlx %o5, %g4, %o4 /* IEU0 Group */ - - add %o0, 8, %o0 /* IEU1 */ - or %o3, %o4, %o3 /* IEU0 Group */ - add %o1, 8, %o1 /* IEU1 */ - sub %o3, %g1, %o4 /* IEU0 Group */ - -#ifdef EIGHTBIT_NOT_RARE - andn %o4, %o3, %o4 /* IEU0 Group */ -#endif - andcc %o4, %g2, %g0 /* IEU1 Group */ - be,a,pt %xcc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - srlx %o3, 56, %o4 /* IEU0 Group */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 22f /* CTI */ - srlx %o3, 48, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 21f /* CTI */ - srlx %o3, 40, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 20f /* CTI */ - - srlx %o3, 32, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 19f /* CTI */ - srlx %o3, 24, %o4 /* IEU0 */ - - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 18f /* CTI */ - srlx %o3, 16, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 17f /* CTI */ - srlx %o3, 8, %o4 /* IEU0 */ - andcc %o4, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 16f /* CTI */ - - andcc %o3, 0xff, %g0 /* IEU1 Group */ - bne,pn %icc, 15b /* CTI */ - stx %o3, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - - mov %g6, %o0 /* IEU0 */ - - .align 16 -16: srlx %o3, 8, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 2] /* Store */ -17: srlx %o3, 16, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 3] /* Store */ - -18: srlx %o3, 24, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 4] /* Store */ -19: srlx %o3, 32, %o4 /* IEU0 Group */ - stw %o4, [%o0 - 8] /* Store */ - - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ - nop - nop - -20: srlx %o3, 40, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 6] /* Store */ -21: srlx %o3, 48, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 7] /* Store */ - -22: srlx %o3, 56, %o4 /* IEU0 Group */ - stb %o4, [%o0 - 8] /* Store */ - retl /* CTI+IEU1 Group */ - mov %g6, %o0 /* IEU0 */ -END(strcpy) - -libc_hidden_def(strcpy) diff --git a/libc/string/sparc/sparc64/strlen.S b/libc/string/sparc/sparc64/strlen.S deleted file mode 100644 index f58c1c232..000000000 --- a/libc/string/sparc/sparc64/strlen.S +++ /dev/null @@ -1,172 +0,0 @@ -/* Determine the length of a string. For SPARC v9. - Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jan Vondrak and - Jakub Jelinek . - - 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 - . */ - -#include - - /* Normally, this uses - ((xword - 0x0101010101010101) & 0x8080808080808080) test - to find out if any byte in xword could be zero. This is fast, but - also gives false alarm for any byte in range 0x81-0xff. It does - not matter for correctness, as if this test tells us there could - be some zero byte, we check it byte by byte, but if bytes with - high bits set are common in the strings, then this will give poor - performance. You can #define EIGHTBIT_NOT_RARE and the algorithm - will use one tick slower, but more precise test - ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080), - which does not give any false alarms (but if some bits are set, - one cannot assume from it which bytes are zero and which are not). - It is yet to be measured, what is the correct default for glibc - in these days for an average user. - */ - - .text - .align 32 -ENTRY(strlen) - sethi %hi(0x01010101), %g1 /* IEU0 Group */ - ldub [%o0], %o3 /* Load */ - or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ - mov %o0, %o1 /* IEU1 */ - - sllx %g1, 32, %g4 /* IEU0 Group */ - andcc %o0, 7, %g0 /* IEU1 */ - or %g1, %g4, %g1 /* IEU0 Group */ - brz,pn %o3, 13f /* CTI+IEU1 */ - - sllx %g1, 7, %g4 /* IEU0 Group */ - bne,a,pn %icc, 15f /* CTI */ - add %o0, 1, %o0 /* IEU1 */ - /* %g1 = 0x0101010101010101 * - * %g4 = 0x8080808080808080 * - * %o0 = string pointer * - * %o1 = start of string */ -1: ldx [%o0], %o3 /* Load Group */ - - add %o0, 8, %o0 /* IEU1 */ -2: sub %o3, %g1, %o2 /* IEU0 Group */ -#ifdef EIGHTBIT_NOT_RARE - andn %o2, %o3, %o5 /* IEU0 Group */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o5, %g4, %g0 /* IEU1 Group */ -#else - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g4, %g0 /* IEU1 Group */ -#endif - - be,pt %xcc, 2b /* CTI */ - add %o0, 8, %o0 /* IEU0 */ - addcc %o2, %g1, %g5 /* IEU1 Group */ -#ifdef EIGHTBIT_NOT_RARE - srlx %o5, 32, %o5 /* IEU0 */ - -3: andcc %o5, %g4, %g0 /* IEU1 Group */ -#else - srlx %o2, 32, %o2 /* IEU0 */ - -3: andcc %o2, %g4, %g0 /* IEU1 Group */ -#endif - be,pn %xcc, 4f /* CTI */ - srlx %g5, 56, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 12f /* CTI */ - srlx %g5, 48, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 11f /* CTI */ - - srlx %g5, 40, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 10f /* CTI */ - srlx %g5, 32, %o2 /* IEU0 */ - - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 9f /* CTI */ -4: srlx %g5, 24, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - - be,pn %icc, 8f /* CTI */ - srlx %g5, 16, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 7f /* CTI */ - - srlx %g5, 8, %o2 /* IEU0 */ - andcc %o2, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 6f /* CTI */ - sub %o3, %g1, %o2 /* IEU0 */ - - andcc %g5, 0xff, %g0 /* IEU1 Group */ - be,pn %icc, 5f /* CTI */ - ldxa [%o0] ASI_PNF, %o3 /* Load */ - andcc %o2, %g4, %g0 /* IEU1 Group */ - - be,pt %xcc, 2b /* CTI */ - add %o0, 8, %o0 /* IEU0 */ - addcc %o2, %g1, %g5 /* IEU1 Group */ - ba,pt %xcc, 3b /* CTI */ - - srlx %o2, 32, %o2 /* IEU0 */ -5: add %o0, -9, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ - -6: add %o0, -10, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ -7: add %o0, -11, %o0 /* IEU0 Group */ - - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ -8: add %o0, -12, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - - sub %o0, %o1, %o0 /* IEU0 */ -9: add %o0, -13, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ - -10: add %o0, -14, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ -11: add %o0, -15, %o0 /* IEU0 Group */ - - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ -12: add %o0, -16, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - - sub %o0, %o1, %o0 /* IEU0 */ -13: retl /* CTI+IEU1 Group */ - mov 0, %o0 /* IEU0 */ - nop - -15: ldub [%o0], %o3 /* Load Group */ -16: andcc %o0, 7, %g0 /* IEU1 */ - be,pn %icc, 1b /* CTI */ - nop /* IEU0 Group */ - - add %o0, 1, %o0 /* IEU1 */ - andcc %o3, 0xff, %g0 /* IEU1 Group */ - bne,a,pt %icc, 16b /* CTI */ - lduba [%o0] ASI_PNF, %o3 /* Load */ - - add %o0, -1, %o0 /* IEU0 Group */ - retl /* CTI+IEU1 Group */ - sub %o0, %o1, %o0 /* IEU0 */ -END(strlen) -libc_hidden_def(strlen) diff --git a/libc/sysdeps/linux/sparc/bits/setjmp.h b/libc/sysdeps/linux/sparc/bits/setjmp.h index 5ec4da582..26f62126a 100644 --- a/libc/sysdeps/linux/sparc/bits/setjmp.h +++ b/libc/sysdeps/linux/sparc/bits/setjmp.h @@ -25,37 +25,6 @@ #include -#if 0 /*__WORDSIZE == 64*/ - -typedef struct __sparc64_jmp_buf - { - struct __sparc64_jmp_buf *uc_link; - unsigned long uc_flags; - unsigned long uc_sigmask; - struct __sparc64_jmp_buf_mcontext - { - unsigned long mc_gregs[19]; - unsigned long mc_fp; - unsigned long mc_i7; - struct __sparc64_jmp_buf_fpu - { - union - { - unsigned int sregs[32]; - unsigned long dregs[32]; - long double qregs[16]; - } mcfpu_fpregs; - unsigned long mcfpu_fprs; - unsigned long mcfpu_gsr; - void *mcfpu_fq; - unsigned char mcfpu_qcnt; - unsigned char mcfpu_qentsz; - unsigned char mcfpu_enab; - } mc_fpregs; - } uc_mcontext; - } __jmp_buf[1]; -#else typedef int __jmp_buf[3]; -#endif #endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/sparc/bits/sigcontext.h b/libc/sysdeps/linux/sparc/bits/sigcontext.h index 943548514..251032f33 100644 --- a/libc/sysdeps/linux/sparc/bits/sigcontext.h +++ b/libc/sysdeps/linux/sparc/bits/sigcontext.h @@ -21,8 +21,6 @@ #include -#if __WORDSIZE == 32 - /* It is quite hard to choose what to put here, because Linux/sparc32 had at least 3 totally incompatible signal stack layouts. @@ -42,36 +40,3 @@ struct sigcontext int si_mask; }; -#else /* sparc64 */ - -typedef struct - { - unsigned int si_float_regs [64]; - unsigned long si_fsr; - unsigned long si_gsr; - unsigned long si_fprs; - } __siginfo_fpu_t; - -struct sigcontext - { - char sigc_info[128]; - struct - { - unsigned long u_regs[16]; /* globals and ins */ - unsigned long tstate; - unsigned long tpc; - unsigned long tnpc; - unsigned int y; - unsigned int fprs; - } sigc_regs; - __siginfo_fpu_t * sigc_fpu_save; - struct - { - void * ss_sp; - int ss_flags; - unsigned long ss_size; - } sigc_stack; - unsigned long sigc_mask; -}; - -#endif /* sparc64 */ diff --git a/libc/sysdeps/linux/sparc/crt1.S b/libc/sysdeps/linux/sparc/crt1.S index 25b5ee59c..77e9147f5 100644 --- a/libc/sysdeps/linux/sparc/crt1.S +++ b/libc/sysdeps/linux/sparc/crt1.S @@ -39,16 +39,9 @@ #include #include -/* macro out the 32 / 64 bit differences */ -#if __WORDSIZE == 32 # define STACK_BIAS 0 # define ELE_SIZE 4 # define LD ld -#else -# define STACK_BIAS 2047 /* see glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h */ -# define ELE_SIZE 8 -# define LD ldx -#endif .text .align 4 @@ -116,11 +109,7 @@ _start: nop /* Die very horribly if exit returns. */ -#if __WORDSIZE == 32 unimp -#else - illtrap 0 -#endif .size _start,.-_start diff --git a/libc/sysdeps/linux/sparc/jmpbuf-unwind.h b/libc/sysdeps/linux/sparc/jmpbuf-unwind.h index 40303f0cd..90efb7719 100644 --- a/libc/sysdeps/linux/sparc/jmpbuf-unwind.h +++ b/libc/sysdeps/linux/sparc/jmpbuf-unwind.h @@ -6,26 +6,19 @@ #include #include -#if __WORDSIZE == 64 - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp) - -#else - /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ ((int) (address) < (jmpbuf)[JB_SP]) -#endif - #ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#if defined(__arch64__) -#include "sparc64/jmpbuf-unwind.h" -#else -#include "sparc32/jmpbuf-unwind.h" -#endif +#include +#include +#include + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) #endif diff --git a/libc/sysdeps/linux/sparc/qp_ops.c b/libc/sysdeps/linux/sparc/qp_ops.c index 123be53fb..97f98da99 100644 --- a/libc/sysdeps/linux/sparc/qp_ops.c +++ b/libc/sysdeps/linux/sparc/qp_ops.c @@ -1,5 +1,3 @@ -/* XXX add ops from glibc sysdeps/sparc/sparc64/soft-fp */ - #include #include @@ -9,11 +7,7 @@ static void fakedef(void) exit(-1); } -#ifdef __sparc_v9__ -# define fakedef(sym) strong_alias(fakedef, _Qp_##sym) -#else # define fakedef(sym) strong_alias(fakedef, _Q_##sym) -#endif fakedef(fne) fakedef(feq) @@ -31,7 +25,6 @@ fakedef(qtos) fakedef(stoq) fakedef(itoq) fakedef(add) -#ifndef __sparc_v9__ fakedef(qtou) fakedef(utoq) fakedef(cmp) @@ -44,4 +37,3 @@ fakedef(qtoll) fakedef(qtoull) fakedef(sqrt) fakedef(ulltoq) -#endif diff --git a/libc/sysdeps/linux/sparc/sparcv9/clone.S b/libc/sysdeps/linux/sparc/sparcv9/clone.S deleted file mode 100644 index 2ee62a0f8..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/clone.S +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@tamu.edu). - - 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 - . */ - -/* clone() is even more special than fork() as it mucks with stacks - and invokes a function in the right context after its all over. */ - -#include -#include -#include -#include - -#define CLONE_VM 0x00000100 -#define CLONE_THREAD 0x00010000 - -/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, - pid_t *ptid, void *tls, pid_t *ctid); */ - - .register %g2,#scratch - .register %g3,#scratch - - .text - -ENTRY (__clone) - save %sp, -192, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - cfi_register(%o7, %i7) - - /* sanity check arguments */ - brz,pn %i0, 99f /* fn non-NULL? */ - mov %i0, %g2 - brz,pn %i1, 99f /* child_stack non-NULL? */ - mov %i2, %o0 /* clone flags */ - - /* The child_stack is the top of the stack, allocate one - whole stack frame from that as this is what the kernel - expects. Also, subtract STACK_BIAS. */ - sub %i1, 192 + 0x7ff, %o1 - mov %i3, %g3 - mov %i2, %g4 - - mov %i4,%o2 /* PTID */ - mov %i5,%o3 /* TLS */ - ldx [%fp+0x7ff+176],%o4 /* CTID */ - - /* Do the system call */ - set __NR_clone, %g1 - ta 0x6d - bcs,pn %xcc, 98f - nop - brnz,pn %o1, __thread_start - nop - jmpl %i7 + 8, %g0 - restore %o0, %g0, %o0 -99: mov EINVAL, %o0 -98: call HIDDEN_JUMPTARGET(__errno_location) - mov %o0, %i0 - st %i0, [%o0] - jmpl %i7 + 8, %g0 - restore %g0,-1,%o0 -END(__clone) - - .type __thread_start,@function -__thread_start: -#ifdef RESET_PID - sethi %hi(CLONE_THREAD), %l0 - andcc %g4, %l0, %g0 - bne,pt %icc, 1f - andcc %g4, CLONE_VM, %g0 - bne,a,pn %icc, 2f - mov -1,%o0 - set __NR_getpid,%g1 - ta 0x6d -2: st %o0,[%g7 + PID] - st %o0,[%g7 + TID] -1: -#endif - mov %g0, %fp /* terminate backtrace */ - call %g2 - mov %g3,%o0 - call HIDDEN_JUMPTARGET(_exit),0 - nop - - .size __thread_start, .-__thread_start - -weak_alias (__clone, clone) diff --git a/libc/sysdeps/linux/sparc/sparcv9/rem.S b/libc/sysdeps/linux/sparc/sparcv9/rem.S deleted file mode 100644 index 1474e32ae..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/rem.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Sparc v9 has divide. - * As divx takes 68 cycles and sdivcc only 36, - * we use sdivcc eventhough it is deprecated. - */ - - .text - .align 32 -ENTRY(.rem) - - sra %o0, 31, %o2 - wr %o2, 0, %y - sdivcc %o0, %o1, %o2 - xnor %o2, %g0, %o3 - movvs %icc, %o3, %o2 - smul %o2, %o1, %o2 - retl - sub %o0, %o2, %o0 - -END(.rem) diff --git a/libc/sysdeps/linux/sparc/sparcv9/sdiv.S b/libc/sysdeps/linux/sparc/sparcv9/sdiv.S deleted file mode 100644 index 45535bb68..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/sdiv.S +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Sparc v9 has divide. - * As divx takes 68 cycles and sdivcc only 36, - * we use sdivcc eventhough it is deprecated. - */ - - .text - .align 32 -ENTRY(.div) - - sra %o0, 31, %o2 - wr %o2, 0, %y - sdivcc %o0, %o1, %o0 - xnor %o0, %g0, %o2 - retl - movvs %icc, %o2, %o0 - -END(.div) diff --git a/libc/sysdeps/linux/sparc/sparcv9/udiv.S b/libc/sysdeps/linux/sparc/sparcv9/udiv.S deleted file mode 100644 index 303f29bdf..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/udiv.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Sparc v9 has divide. - * As divx takes 68 cycles and udiv only 37, - * we use udiv eventhough it is deprecated. - */ - - .text - .align 32 -ENTRY(.udiv) - - wr %g0, 0, %y - retl - udiv %o0, %o1, %o0 - -END(.udiv) diff --git a/libc/sysdeps/linux/sparc/sparcv9/umul.S b/libc/sysdeps/linux/sparc/sparcv9/umul.S deleted file mode 100644 index e65e4b95f..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/umul.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Sparc v9 has multiply. - */ - - .text - .align 32 -ENTRY(.umul) - - srl %o0, 0, %o0 - srl %o1, 0, %o1 - mulx %o0, %o1, %o0 - retl - srlx %o0, 32, %o1 - -END(.umul) diff --git a/libc/sysdeps/linux/sparc/sparcv9/urem.S b/libc/sysdeps/linux/sparc/sparcv9/urem.S deleted file mode 100644 index 93542698d..000000000 --- a/libc/sysdeps/linux/sparc/sparcv9/urem.S +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Sparc v9 has divide. - * As divx takes 68 cycles and udiv only 37, - * we use udiv eventhough it is deprecated. - */ - - .text - .align 32 -ENTRY(.urem) - - wr %g0, 0, %y - udiv %o0, %o1, %o2 - umul %o2, %o1, %o2 - retl - sub %o0, %o2, %o0 - -END(.urem) diff --git a/libc/sysdeps/linux/sparc/sys/procfs.h b/libc/sysdeps/linux/sparc/sys/procfs.h index 37d6a615f..edbd5a5ba 100644 --- a/libc/sysdeps/linux/sparc/sys/procfs.h +++ b/libc/sysdeps/linux/sparc/sys/procfs.h @@ -32,20 +32,6 @@ __BEGIN_DECLS -#if __WORDSIZE == 64 - -#define ELF_NGREG 36 - -typedef struct - { - unsigned long pr_regs[32]; - unsigned long pr_fsr; - unsigned long pr_gsr; - unsigned long pr_fprs; - } elf_fpregset_t; - -#else /* sparc32 */ - #define ELF_NGREG 38 typedef struct @@ -63,8 +49,6 @@ typedef struct unsigned int pr_q[64]; } elf_fpregset_t; -#endif /* sparc32 */ - typedef unsigned long elf_greg_t; typedef elf_greg_t elf_gregset_t[ELF_NGREG]; @@ -110,13 +94,8 @@ struct elf_prpsinfo char pr_zomb; /* Zombie. */ char pr_nice; /* Nice val. */ unsigned long int pr_flag; /* Flags. */ -#if __WORDSIZE == 64 - unsigned int pr_uid; - unsigned int pr_gid; -#else unsigned short int pr_uid; unsigned short int pr_gid; -#endif int pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* Filename of executable. */ @@ -138,73 +117,6 @@ typedef __pid_t lwpid_t; typedef struct elf_prstatus prstatus_t; typedef struct elf_prpsinfo prpsinfo_t; -#if __WORDSIZE == 64 - -/* Provide 32-bit variants so that BFD can read 32-bit - core files. */ -#define ELF_NGREG32 38 -typedef struct - { - union - { - unsigned int pr_regs[32]; - double pr_dregs[16]; - } pr_fr; - unsigned int __unused; - unsigned int pr_fsr; - unsigned char pr_qcnt; - unsigned char pr_q_entrysize; - unsigned char pr_en; - unsigned int pr_q[64]; - } elf_fpregset_t32; - -typedef unsigned int elf_greg_t32; -typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG32]; - -struct elf_prstatus32 - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned int pr_sigpend; /* Set of pending signals. */ - unsigned int pr_sighold; /* Set of held signals. */ - __pid_t pr_pid; - __pid_t pr_ppid; - __pid_t pr_pgrp; - __pid_t pr_sid; - struct - { - int tv_sec, tv_usec; - } pr_utime, /* User time. */ - pr_stime, /* System time. */ - pr_cutime, /* Cumulative user time. */ - pr_cstime; /* Cumulative system time. */ - elf_gregset_t32 pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - -struct elf_prpsinfo32 - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned int pr_flag; /* Flags. */ - unsigned short int pr_uid; - unsigned short int pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - -typedef elf_gregset_t32 prgregset32_t; -typedef elf_fpregset_t32 prfpregset32_t; - -typedef struct elf_prstatus32 prstatus32_t; -typedef struct elf_prpsinfo32 prpsinfo32_t; - -#endif /* sparc64 */ - __END_DECLS #endif /* sys/procfs.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h index ab90810f1..d502c759a 100644 --- a/libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h @@ -1,8 +1,82 @@ -#include -#include +/* Machine-dependent pthreads configuration and inline functions. + sparc version. + Copyright (C) 1996-1998, 2000-2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson . -#if __WORDSIZE == 32 -# include "sparc32/pt-machine.h" -#else -# include "sparc64/pt-machine.h" + 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; see the file COPYING.LIB. If + not, see . */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + +#ifndef PT_EI +# define PT_EI __extern_always_inline #endif + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +/* Spinlock implementation; required. */ +PT_EI long int +testandset (int *spinlock) +{ + int ret; + + __asm__ __volatile__("ldstub %1,%0" + : "=r"(ret), "=m"(*spinlock) + : "m"(*spinlock)); + + return ret; +} + + +/* Memory barrier; default is to do nothing */ +#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") + + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) +register char *stack_pointer __asm__("%sp"); + + +/* Registers %g6 and %g7 are reserved by the ABI for "system use". + %g7 is specified in the TLS ABI as thread pointer -- we do the same. */ +struct _pthread_descr_struct; +register struct _pthread_descr_struct *__thread_self __asm__("%g7"); + +/* Return the thread descriptor for the current thread. */ +#define THREAD_SELF __thread_self + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) + +/* Access to data in the thread descriptor is easy. */ +#define THREAD_GETMEM(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_GETMEM_NC(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_SETMEM(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) +#define THREAD_SETMEM_NC(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 8*1024*1024 + +#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h deleted file mode 100644 index d502c759a..000000000 --- a/libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - sparc version. - Copyright (C) 1996-1998, 2000-2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -extern long int testandset (int *spinlock); -extern int __compare_and_swap (long int *p, long int oldval, long int newval); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__("ldstub %1,%0" - : "=r"(ret), "=m"(*spinlock) - : "m"(*spinlock)); - - return ret; -} - - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) -register char *stack_pointer __asm__("%sp"); - - -/* Registers %g6 and %g7 are reserved by the ABI for "system use". - %g7 is specified in the TLS ABI as thread pointer -- we do the same. */ -struct _pthread_descr_struct; -register struct _pthread_descr_struct *__thread_self __asm__("%g7"); - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF __thread_self - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) - -/* Access to data in the thread descriptor is easy. */ -#define THREAD_GETMEM(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_GETMEM_NC(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_SETMEM(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) -#define THREAD_SETMEM_NC(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 8*1024*1024 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h deleted file mode 100644 index e3c73d967..000000000 --- a/libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - Sparc v9 version. - Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -extern long int testandset (int *spinlock); -extern int __compare_and_swap (long int *p, long int oldval, long int newval); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__("ldstub %1,%0" - : "=r" (ret), "=m" (*spinlock) : "m" (*spinlock)); - - return ret; -} - - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() \ - __asm__ __volatile__("membar #LoadLoad | #LoadStore | #StoreLoad | #StoreStore" : : : "memory") -/* Read barrier. */ -#define READ_MEMORY_BARRIER() \ - __asm__ __volatile__("membar #LoadLoad | #LoadStore" : : : "memory") -/* Write barrier. */ -#define WRITE_MEMORY_BARRIER() \ - __asm__ __volatile__("membar #StoreLoad | #StoreStore" : : : "memory") - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 128)) -register char *stack_pointer __asm__ ("%sp"); - - -/* Registers %g6 and %g7 are reserved by the ABI for "system use". The - TLS ABI specifies %g7 as the thread pointer. */ -struct _pthread_descr_struct; -register struct _pthread_descr_struct *__thread_self __asm__ ("%g7"); - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF __thread_self - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) - - -/* Compare-and-swap for semaphores. */ - -#define HAS_COMPARE_AND_SWAP -PT_EI int -__compare_and_swap (long int *p, long int oldval, long int newval) -{ - long int readval; - - __asm__ __volatile__ ("casx [%4], %2, %0" - : "=r"(readval), "=m"(*p) - : "r"(oldval), "m"(*p), "r"(p), "0"(newval)); - MEMORY_BARRIER(); - return readval == oldval; -} - -/* Access to data in the thread descriptor is easy. */ -#define THREAD_GETMEM(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_GETMEM_NC(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_SETMEM(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) -#define THREAD_SETMEM_NC(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 32*1024*1024 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/sparc/pspinlock.c b/libpthread/linuxthreads/sysdeps/sparc/pspinlock.c index 72a9af5b1..4de152be3 100644 --- a/libpthread/linuxthreads/sysdeps/sparc/pspinlock.c +++ b/libpthread/linuxthreads/sysdeps/sparc/pspinlock.c @@ -1,14 +1,87 @@ -#include -#include +/* POSIX spinlock implementation. SPARC32 version. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#if __WORDSIZE == 32 + 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. -# if defined(__CONFIG_SPARC_V9B__) -# include "sparc32/sparcv9b/pspinlock.c" -# else -# include "sparc32/pspinlock.c" -# endif + 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. -#else -# include "sparc64/pspinlock.c" -#endif + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#include +#include +#include "internals.h" + +/* This implementation is similar to the one used in the Linux kernel. */ +int +__pthread_spin_lock (pthread_spinlock_t *lock) +{ + __asm__ __volatile__ + ("1: ldstub [%0], %%g2\n" + " orcc %%g2, 0x0, %%g0\n" + " bne,a 2f\n" + " ldub [%0], %%g2\n" + ".subsection 2\n" + "2: orcc %%g2, 0x0, %%g0\n" + " bne,a 2b\n" + " ldub [%0], %%g2\n" + " b,a 1b\n" + ".previous" + : /* no outputs */ + : "r" (lock) + : "g2", "memory", "cc"); + return 0; +} +weak_alias (__pthread_spin_lock, pthread_spin_lock) + + +int +__pthread_spin_trylock (pthread_spinlock_t *lock) +{ + int result; + __asm__ __volatile__ + ("ldstub [%1], %0" + : "=r" (result) + : "r" (lock) + : "memory"); + return result == 0 ? 0 : EBUSY; +} +weak_alias (__pthread_spin_trylock, pthread_spin_trylock) + + +int +__pthread_spin_unlock (pthread_spinlock_t *lock) +{ + *lock = 0; + return 0; +} +weak_alias (__pthread_spin_unlock, pthread_spin_unlock) + + +int +__pthread_spin_init (pthread_spinlock_t *lock, int pshared) +{ + /* We can ignore the `pshared' parameter. Since we are busy-waiting + all processes which can access the memory location `lock' points + to can use the spinlock. */ + *lock = 0; + return 0; +} +weak_alias (__pthread_spin_init, pthread_spin_init) + + +int +__pthread_spin_destroy (pthread_spinlock_t *lock) +{ + /* Nothing to do. */ + return 0; +} +weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/libpthread/linuxthreads/sysdeps/sparc/pt-machine.h b/libpthread/linuxthreads/sysdeps/sparc/pt-machine.h index ab90810f1..d502c759a 100644 --- a/libpthread/linuxthreads/sysdeps/sparc/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/sparc/pt-machine.h @@ -1,8 +1,82 @@ -#include -#include +/* Machine-dependent pthreads configuration and inline functions. + sparc version. + Copyright (C) 1996-1998, 2000-2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson . -#if __WORDSIZE == 32 -# include "sparc32/pt-machine.h" -#else -# include "sparc64/pt-machine.h" + 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; see the file COPYING.LIB. If + not, see . */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + +#ifndef PT_EI +# define PT_EI __extern_always_inline #endif + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +/* Spinlock implementation; required. */ +PT_EI long int +testandset (int *spinlock) +{ + int ret; + + __asm__ __volatile__("ldstub %1,%0" + : "=r"(ret), "=m"(*spinlock) + : "m"(*spinlock)); + + return ret; +} + + +/* Memory barrier; default is to do nothing */ +#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") + + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) +register char *stack_pointer __asm__("%sp"); + + +/* Registers %g6 and %g7 are reserved by the ABI for "system use". + %g7 is specified in the TLS ABI as thread pointer -- we do the same. */ +struct _pthread_descr_struct; +register struct _pthread_descr_struct *__thread_self __asm__("%g7"); + +/* Return the thread descriptor for the current thread. */ +#define THREAD_SELF __thread_self + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) + +/* Access to data in the thread descriptor is easy. */ +#define THREAD_GETMEM(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_GETMEM_NC(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_SETMEM(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) +#define THREAD_SETMEM_NC(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 8*1024*1024 + +#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c b/libpthread/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c deleted file mode 100644 index 4de152be3..000000000 --- a/libpthread/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c +++ /dev/null @@ -1,87 +0,0 @@ -/* POSIX spinlock implementation. SPARC32 version. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include "internals.h" - -/* This implementation is similar to the one used in the Linux kernel. */ -int -__pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g2\n" - " orcc %%g2, 0x0, %%g0\n" - " bne,a 2f\n" - " ldub [%0], %%g2\n" - ".subsection 2\n" - "2: orcc %%g2, 0x0, %%g0\n" - " bne,a 2b\n" - " ldub [%0], %%g2\n" - " b,a 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g2", "memory", "cc"); - return 0; -} -weak_alias (__pthread_spin_lock, pthread_spin_lock) - - -int -__pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int result; - __asm__ __volatile__ - ("ldstub [%1], %0" - : "=r" (result) - : "r" (lock) - : "memory"); - return result == 0 ? 0 : EBUSY; -} -weak_alias (__pthread_spin_trylock, pthread_spin_trylock) - - -int -__pthread_spin_unlock (pthread_spinlock_t *lock) -{ - *lock = 0; - return 0; -} -weak_alias (__pthread_spin_unlock, pthread_spin_unlock) - - -int -__pthread_spin_init (pthread_spinlock_t *lock, int pshared) -{ - /* We can ignore the `pshared' parameter. Since we are busy-waiting - all processes which can access the memory location `lock' points - to can use the spinlock. */ - *lock = 0; - return 0; -} -weak_alias (__pthread_spin_init, pthread_spin_init) - - -int -__pthread_spin_destroy (pthread_spinlock_t *lock) -{ - /* Nothing to do. */ - return 0; -} -weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/libpthread/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h b/libpthread/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h deleted file mode 100644 index d502c759a..000000000 --- a/libpthread/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - sparc version. - Copyright (C) 1996-1998, 2000-2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -extern long int testandset (int *spinlock); -extern int __compare_and_swap (long int *p, long int oldval, long int newval); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__("ldstub %1,%0" - : "=r"(ret), "=m"(*spinlock) - : "m"(*spinlock)); - - return ret; -} - - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() __asm__ __volatile__("stbar" : : : "memory") - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) -register char *stack_pointer __asm__("%sp"); - - -/* Registers %g6 and %g7 are reserved by the ABI for "system use". - %g7 is specified in the TLS ABI as thread pointer -- we do the same. */ -struct _pthread_descr_struct; -register struct _pthread_descr_struct *__thread_self __asm__("%g7"); - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF __thread_self - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) - -/* Access to data in the thread descriptor is easy. */ -#define THREAD_GETMEM(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_GETMEM_NC(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_SETMEM(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) -#define THREAD_SETMEM_NC(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 8*1024*1024 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c b/libpthread/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c deleted file mode 100644 index fb49ca37e..000000000 --- a/libpthread/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c +++ /dev/null @@ -1,93 +0,0 @@ -/* POSIX spinlock implementation. SPARC v9 version. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include "internals.h" - - -/* This implementation is similar to the one used in the Linux kernel. */ -int -__pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g2\n" - " brnz,pn %%g2, 2f\n" - " membar #StoreLoad | #StoreStore\n" - ".subsection 2\n" - "2: ldub [%0], %%g2\n" - " brnz,pt %%g2, 2b\n" - " membar #LoadLoad\n" - " b,a,pt %%xcc, 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g2", "memory"); - return 0; -} -weak_alias (__pthread_spin_lock, pthread_spin_lock) - - -int -__pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int result; - __asm__ __volatile__ - ("ldstub [%1], %0\n" - "membar #StoreLoad | #StoreStore" - : "=r" (result) - : "r" (lock) - : "memory"); - return result == 0 ? 0 : EBUSY; -} -weak_alias (__pthread_spin_trylock, pthread_spin_trylock) - - -int -__pthread_spin_unlock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("membar #StoreStore | #LoadStore\n" - "stb %%g0, [%0]" - : - : "r" (lock) - : "memory"); - return 0; -} -weak_alias (__pthread_spin_unlock, pthread_spin_unlock) - - -int -__pthread_spin_init (pthread_spinlock_t *lock, int pshared) -{ - /* We can ignore the `pshared' parameter. Since we are busy-waiting - all processes which can access the memory location `lock' points - to can use the spinlock. */ - *lock = 0; - return 0; -} -weak_alias (__pthread_spin_init, pthread_spin_init) - - -int -__pthread_spin_destroy (pthread_spinlock_t *lock) -{ - /* Nothing to do. */ - return 0; -} -weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/libpthread/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c b/libpthread/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c deleted file mode 100644 index 743cb77bf..000000000 --- a/libpthread/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c +++ /dev/null @@ -1,92 +0,0 @@ -/* POSIX spinlock implementation. SPARC64 version. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include "internals.h" - -/* This implementation is similar to the one used in the Linux kernel. */ -int -__pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g5\n" - " brnz,pn %%g5, 2f\n" - " membar #StoreLoad | #StoreStore\n" - ".subsection 2\n" - "2: ldub [%0], %%g5\n" - " brnz,pt %%g5, 2b\n" - " membar #LoadLoad\n" - " b,a,pt %%xcc, 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g5", "memory"); - return 0; -} -weak_alias (__pthread_spin_lock, pthread_spin_lock) - - -int -__pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int result; - __asm__ __volatile__ - ("ldstub [%1], %0\n" - "membar #StoreLoad | #StoreStore" - : "=r" (result) - : "r" (lock) - : "memory"); - return result == 0 ? 0 : EBUSY; -} -weak_alias (__pthread_spin_trylock, pthread_spin_trylock) - - -int -__pthread_spin_unlock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("membar #StoreStore | #LoadStore\n" - "stb %%g0, [%0]" - : - : "r" (lock) - : "memory"); - return 0; -} -weak_alias (__pthread_spin_unlock, pthread_spin_unlock) - - -int -__pthread_spin_init (pthread_spinlock_t *lock, int pshared) -{ - /* We can ignore the `pshared' parameter. Since we are busy-waiting - all processes which can access the memory location `lock' points - to can use the spinlock. */ - *lock = 0; - return 0; -} -weak_alias (__pthread_spin_init, pthread_spin_init) - - -int -__pthread_spin_destroy (pthread_spinlock_t *lock) -{ - /* Nothing to do. */ - return 0; -} -weak_alias (__pthread_spin_destroy, pthread_spin_destroy) diff --git a/libpthread/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h b/libpthread/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h deleted file mode 100644 index e3c73d967..000000000 --- a/libpthread/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Machine-dependent pthreads configuration and inline functions. - Sparc v9 version. - Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson . - - 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; see the file COPYING.LIB. If - not, see . */ - -#ifndef _PT_MACHINE_H -#define _PT_MACHINE_H 1 - -#ifndef PT_EI -# define PT_EI __extern_always_inline -#endif - -extern long int testandset (int *spinlock); -extern int __compare_and_swap (long int *p, long int oldval, long int newval); - -/* Spinlock implementation; required. */ -PT_EI long int -testandset (int *spinlock) -{ - int ret; - - __asm__ __volatile__("ldstub %1,%0" - : "=r" (ret), "=m" (*spinlock) : "m" (*spinlock)); - - return ret; -} - - -/* Memory barrier; default is to do nothing */ -#define MEMORY_BARRIER() \ - __asm__ __volatile__("membar #LoadLoad | #LoadStore | #StoreLoad | #StoreStore" : : : "memory") -/* Read barrier. */ -#define READ_MEMORY_BARRIER() \ - __asm__ __volatile__("membar #LoadLoad | #LoadStore" : : : "memory") -/* Write barrier. */ -#define WRITE_MEMORY_BARRIER() \ - __asm__ __volatile__("membar #StoreLoad | #StoreStore" : : : "memory") - - -/* Get some notion of the current stack. Need not be exactly the top - of the stack, just something somewhere in the current frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 128)) -register char *stack_pointer __asm__ ("%sp"); - - -/* Registers %g6 and %g7 are reserved by the ABI for "system use". The - TLS ABI specifies %g7 as the thread pointer. */ -struct _pthread_descr_struct; -register struct _pthread_descr_struct *__thread_self __asm__ ("%g7"); - -/* Return the thread descriptor for the current thread. */ -#define THREAD_SELF __thread_self - -/* Initialize the thread-unique value. */ -#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) - - -/* Compare-and-swap for semaphores. */ - -#define HAS_COMPARE_AND_SWAP -PT_EI int -__compare_and_swap (long int *p, long int oldval, long int newval) -{ - long int readval; - - __asm__ __volatile__ ("casx [%4], %2, %0" - : "=r"(readval), "=m"(*p) - : "r"(oldval), "m"(*p), "r"(p), "0"(newval)); - MEMORY_BARRIER(); - return readval == oldval; -} - -/* Access to data in the thread descriptor is easy. */ -#define THREAD_GETMEM(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_GETMEM_NC(descr, member) \ - ((void) sizeof (descr), THREAD_SELF->member) -#define THREAD_SETMEM(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) -#define THREAD_SETMEM_NC(descr, member, value) \ - ((void) sizeof (descr), THREAD_SELF->member = (value)) - -/* We want the OS to assign stack addresses. */ -#define FLOATING_STACKS 1 - -/* Maximum size of the stack if the rlimit is unlimited. */ -#define ARCH_STACK_MAX_SIZE 32*1024*1024 - -#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h deleted file mode 100644 index bd9bb0d6a..000000000 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2002. - - 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 - . */ - -#include -#ifndef __ASSEMBLER__ -# include -#endif - -#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ -ENTRY(name) \ - ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1; \ - cmp %g1, 0; \ - bne 1f; \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x10; \ - bcs __syscall_error_handler; \ - nop; \ - .subsection 2; \ -1: save %sp, -96, %sp; \ - CENABLE; \ - nop; \ - mov %o0, %l0; \ - COPY_ARGS_##args \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x10; \ - bcs __syscall_error_handler2; \ - mov %o0, %l1; \ - CDISABLE; \ - mov %l0, %o0; \ - jmpl %i7 + 8, %g0; \ - restore %g0, %l1, %o0; \ - .previous; \ - SYSCALL_ERROR_HANDLER \ - SYSCALL_ERROR_HANDLER2 - -#define SYSCALL_ERROR_HANDLER2 \ -SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2) \ - .global __errno_location; \ - .type __errno_location,@function; \ - CDISABLE; \ - mov %l0, %o0; \ - call __errno_location; \ - nop; \ - st %l1, [%o0]; \ - jmpl %i7 + 8, %g0; \ - restore %g0, -1, %o0; \ - .previous; - -# ifdef IS_IN_libpthread -# define CENABLE call __pthread_enable_asynccancel -# define CDISABLE call __pthread_disable_asynccancel -# elif !defined NOT_IN_libc -# define CENABLE call __libc_enable_asynccancel -# define CDISABLE call __libc_disable_asynccancel -# else -# define CENABLE call __librt_enable_asynccancel -# define CDISABLE call __librt_disable_asynccancel -# endif - -#define COPY_ARGS_0 /* Nothing */ -#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; -#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; -#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; -#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; -#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; -#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; - -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - p_header.data.multiple_threads) == 0, 1) -# else -# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 -# endif - -#elif !defined __ASSEMBLER__ - -/* This code should never be used but we define it anyhow. */ -# define SINGLE_THREAD_P (1) - -#endif diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S deleted file mode 100644 index ab2286ee8..000000000 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include - - .text -#ifdef SHARED -.LLGETPC0: - retl - add %o7, %o0, %o0 -#endif -ENTRY(__vfork) -#ifdef SHARED - mov %o7, %o1 - sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0 - call .LLGETPC0 - add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0 - sethi %hi(__libc_pthread_functions), %o2 - mov %o1, %o7 - or %o2, %lo(__libc_pthread_functions), %o2 - ld [%o0 + %o2], %o2 - ld [%o2], %o2 - cmp %o2, 0 -#else - .weak pthread_create - sethi %hi(pthread_create), %o0 - orcc %o0, %lo(pthread_create), %o0 -#endif -#if defined SHARED && !defined BROKEN_SPARC_WDISP22 - bne HIDDEN_JUMPTARGET(fork) -#else - bne 1f -#endif - mov __NR_vfork, %g1 - ta 0x10 - bcs __syscall_error_handler - nop - sub %o1, 1, %o1 - retl - and %o0, %o1, %o0 -#if !defined SHARED || defined BROKEN_SPARC_WDISP22 -1: mov %o7, %g1 - call HIDDEN_JUMPTARGET(fork) - mov %g1, %o7 -#endif - SYSCALL_ERROR_HANDLER -PSEUDO_END (__vfork) -libc_hidden_def (__vfork) -weak_alias (__vfork, vfork) diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c deleted file mode 100644 index d57283ad2..000000000 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../ia64/pt-sigsuspend.c" diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h deleted file mode 100644 index 9972ee408..000000000 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2002. - - 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 - . */ - -#include -#ifndef __ASSEMBLER__ -# include -#endif - -#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ -ENTRY(name) \ - ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1; \ - brnz,pn %g1, 1f; \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x6d; \ - bcs,pn %xcc, __syscall_error_handler; \ - nop; \ - .subsection 2; \ -1: save %sp, -192, %sp; \ - CENABLE; \ - nop; \ - mov %o0, %l0; \ - COPY_ARGS_##args \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x6d; \ - bcs,pn %xcc, __syscall_error_handler2; \ - mov %o0, %l1; \ - CDISABLE; \ - mov %l0, %o0; \ - jmpl %i7 + 8, %g0; \ - restore %g0, %l1, %o0; \ - .previous; \ - SYSCALL_ERROR_HANDLER \ - SYSCALL_ERROR_HANDLER2 - -#define SYSCALL_ERROR_HANDLER2 \ -SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2) \ - .global __errno_location; \ - .type __errno_location,@function; \ - CDISABLE; \ - mov %l0, %o0; \ - call __errno_location; \ - nop; \ - st %l1, [%o0]; \ - jmpl %i7 + 8, %g0; \ - restore %g0, -1, %o0; \ - .previous; - -# ifdef IS_IN_libpthread -# define CENABLE call __pthread_enable_asynccancel -# define CDISABLE call __pthread_disable_asynccancel -# elif !defined NOT_IN_libc -# define CENABLE call __libc_enable_asynccancel -# define CDISABLE call __libc_disable_asynccancel -# else -# define CENABLE call __librt_enable_asynccancel -# define CDISABLE call __librt_disable_asynccancel -# endif - -#define COPY_ARGS_0 /* Nothing */ -#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; -#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; -#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; -#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; -#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; -#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; - -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - p_header.data.multiple_threads) == 0, 1) -# else -# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 -# endif - -#elif !defined __ASSEMBLER__ - -/* This code should never be used but we define it anyhow. */ -# define SINGLE_THREAD_P (1) - -#endif diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S deleted file mode 100644 index 3ff16b115..000000000 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include - -#ifdef SHARED -.LLGETPC0: - retl - add %o7, %o0, %o0 -#endif -ENTRY(__vfork) -#ifdef SHARED - mov %o7, %o1 - sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0 - call .LLGETPC0 - add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0 - sethi %hi(__libc_pthread_functions), %o2 - mov %o1, %o7 - or %o2, %lo(__libc_pthread_functions), %o2 - ldx [%o0 + %o2], %o2 - ldx [%o2], %o0 -#else - .weak pthread_create - sethi %hi(pthread_create), %o0 - or %o0, %lo(pthread_create), %o0 -#endif -#if defined SHARED && !defined BROKEN_SPARC_WDISP22 - cmp %o0, 0 - bne HIDDEN_JUMPTARGET(fork) -#else - brnz,pn %o0, 1f -#endif - mov __NR_vfork, %g1 - ta 0x6d - bcs,pn %xcc, __syscall_error_handler - nop - sub %o1, 1, %o1 - retl - and %o0, %o1, %o0 -#if !defined SHARED || defined BROKEN_SPARC_WDISP22 -1: mov %o7, %g1 - call HIDDEN_JUMPTARGET(fork) - mov %g1, %o7 -#endif - SYSCALL_ERROR_HANDLER -PSEUDO_END (__vfork) -libc_hidden_def (__vfork) -weak_alias (__vfork, vfork) diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h index fa656b34e..bd9bb0d6a 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h @@ -1,10 +1,100 @@ -#ifndef SPARC_SYSDEP_CANCEL_H -#define SPARC_SYSDEP_CANCEL_H +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2002. -#if defined(__arch64__) -#include -#else -#include + 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 + . */ + +#include +#ifndef __ASSEMBLER__ +# include #endif +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .text; \ +ENTRY(name) \ + ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1; \ + cmp %g1, 0; \ + bne 1f; \ + mov SYS_ify(syscall_name), %g1; \ + ta 0x10; \ + bcs __syscall_error_handler; \ + nop; \ + .subsection 2; \ +1: save %sp, -96, %sp; \ + CENABLE; \ + nop; \ + mov %o0, %l0; \ + COPY_ARGS_##args \ + mov SYS_ify(syscall_name), %g1; \ + ta 0x10; \ + bcs __syscall_error_handler2; \ + mov %o0, %l1; \ + CDISABLE; \ + mov %l0, %o0; \ + jmpl %i7 + 8, %g0; \ + restore %g0, %l1, %o0; \ + .previous; \ + SYSCALL_ERROR_HANDLER \ + SYSCALL_ERROR_HANDLER2 + +#define SYSCALL_ERROR_HANDLER2 \ +SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2) \ + .global __errno_location; \ + .type __errno_location,@function; \ + CDISABLE; \ + mov %l0, %o0; \ + call __errno_location; \ + nop; \ + st %l1, [%o0]; \ + jmpl %i7 + 8, %g0; \ + restore %g0, -1, %o0; \ + .previous; + +# ifdef IS_IN_libpthread +# define CENABLE call __pthread_enable_asynccancel +# define CDISABLE call __pthread_disable_asynccancel +# elif !defined NOT_IN_libc +# define CENABLE call __libc_enable_asynccancel +# define CDISABLE call __libc_disable_asynccancel +# else +# define CENABLE call __librt_enable_asynccancel +# define CDISABLE call __librt_disable_asynccancel +# endif + +#define COPY_ARGS_0 /* Nothing */ +#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; +#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; +#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; +#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; +#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; +#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; + +# ifndef __ASSEMBLER__ +# define SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + p_header.data.multiple_threads) == 0, 1) +# else +# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 +# endif + +#elif !defined __ASSEMBLER__ + +/* This code should never be used but we define it anyhow. */ +# define SINGLE_THREAD_P (1) + #endif diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/vfork.S new file mode 100644 index 000000000..ab2286ee8 --- /dev/null +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/vfork.S @@ -0,0 +1,64 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include + + .text +#ifdef SHARED +.LLGETPC0: + retl + add %o7, %o0, %o0 +#endif +ENTRY(__vfork) +#ifdef SHARED + mov %o7, %o1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0 + call .LLGETPC0 + add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0 + sethi %hi(__libc_pthread_functions), %o2 + mov %o1, %o7 + or %o2, %lo(__libc_pthread_functions), %o2 + ld [%o0 + %o2], %o2 + ld [%o2], %o2 + cmp %o2, 0 +#else + .weak pthread_create + sethi %hi(pthread_create), %o0 + orcc %o0, %lo(pthread_create), %o0 +#endif +#if defined SHARED && !defined BROKEN_SPARC_WDISP22 + bne HIDDEN_JUMPTARGET(fork) +#else + bne 1f +#endif + mov __NR_vfork, %g1 + ta 0x10 + bcs __syscall_error_handler + nop + sub %o1, 1, %o1 + retl + and %o0, %o1, %o0 +#if !defined SHARED || defined BROKEN_SPARC_WDISP22 +1: mov %o7, %g1 + call HIDDEN_JUMPTARGET(fork) + mov %g1, %o7 +#endif + SYSCALL_ERROR_HANDLER +PSEUDO_END (__vfork) +libc_hidden_def (__vfork) +weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/jmpbuf-unwind.h new file mode 100644 index 000000000..2f64e7d7c --- /dev/null +++ b/libpthread/nptl/sysdeps/jmpbuf-unwind.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include +#include +#include + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) diff --git a/libpthread/nptl/sysdeps/pthread_spin_lock.c b/libpthread/nptl/sysdeps/pthread_spin_lock.c new file mode 100644 index 000000000..2dfcd3c24 --- /dev/null +++ b/libpthread/nptl/sysdeps/pthread_spin_lock.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include "pthreadP.h" + +int +pthread_spin_lock (pthread_spinlock_t *lock) +{ + __asm__ __volatile__ + ("1: ldstub [%0], %%g2\n" + " orcc %%g2, 0x0, %%g0\n" + " bne,a 2f\n" + " ldub [%0], %%g2\n" + ".subsection 2\n" + "2: orcc %%g2, 0x0, %%g0\n" + " bne,a 2b\n" + " ldub [%0], %%g2\n" + " b,a 1b\n" + ".previous" + : /* no outputs */ + : "r" (lock) + : "g2", "memory", "cc"); + return 0; +} diff --git a/libpthread/nptl/sysdeps/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/pthread_spin_trylock.c new file mode 100644 index 000000000..c1b7b2397 --- /dev/null +++ b/libpthread/nptl/sysdeps/pthread_spin_trylock.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include +#include "pthreadP.h" + +int +pthread_spin_trylock (pthread_spinlock_t *lock) +{ + int res; + __asm__ __volatile__ ("ldstub [%1], %0" : "=r" (res) : "r" (lock) : "memory"); + return res == 0 ? 0 : EBUSY; +} diff --git a/libpthread/nptl/sysdeps/pthreaddef.h b/libpthread/nptl/sysdeps/pthreaddef.h new file mode 100644 index 000000000..435fedcf3 --- /dev/null +++ b/libpthread/nptl/sysdeps/pthreaddef.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 + . */ + +/* Default stack size. */ +#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) + +/* Required stack pointer alignment at beginning. */ +#define STACK_ALIGN 16 + +/* Minimal stack size after allocating thread descriptor and guard size. */ +#define MINIMAL_REST_STACK 2048 + +/* Alignment requirement for TCB. */ +#define TCB_ALIGNMENT 16 + + +/* Location of current stack frame. */ +#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) +register char *stack_pointer __asm__("%sp"); + +/* XXX Until we have a better place keep the definitions here. */ + +/* While there is no such syscall. */ +#define __exit_thread_inline(val) \ + INLINE_SYSCALL (exit, 1, (val)) diff --git a/libpthread/nptl/sysdeps/sparc/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/sparc/jmpbuf-unwind.h index 6cbb37baf..2f64e7d7c 100644 --- a/libpthread/nptl/sysdeps/sparc/jmpbuf-unwind.h +++ b/libpthread/nptl/sysdeps/sparc/jmpbuf-unwind.h @@ -1,5 +1,27 @@ -#if defined(__arch64__) -#include "sparc64/jmpbuf-unwind.h" -#else -#include "sparc32/jmpbuf-unwind.h" -#endif +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include +#include +#include + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) diff --git a/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c b/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c index dcc5ae28e..2dfcd3c24 100644 --- a/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c +++ b/libpthread/nptl/sysdeps/sparc/pthread_spin_lock.c @@ -1,5 +1,39 @@ -#if defined(__arch64__) -#include "sparc64/pthread_spin_lock.c" -#else -#include "sparc32/pthread_spin_lock.c" -#endif +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include "pthreadP.h" + +int +pthread_spin_lock (pthread_spinlock_t *lock) +{ + __asm__ __volatile__ + ("1: ldstub [%0], %%g2\n" + " orcc %%g2, 0x0, %%g0\n" + " bne,a 2f\n" + " ldub [%0], %%g2\n" + ".subsection 2\n" + "2: orcc %%g2, 0x0, %%g0\n" + " bne,a 2b\n" + " ldub [%0], %%g2\n" + " b,a 1b\n" + ".previous" + : /* no outputs */ + : "r" (lock) + : "g2", "memory", "cc"); + return 0; +} diff --git a/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c index af63eec73..c1b7b2397 100644 --- a/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c +++ b/libpthread/nptl/sysdeps/sparc/pthread_spin_trylock.c @@ -1,5 +1,28 @@ -#if defined(__arch64__) -#include "sparc64/pthread_spin_trylock.c" -#else -#include "sparc32/pthread_spin_trylock.c" -#endif +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include +#include "pthreadP.h" + +int +pthread_spin_trylock (pthread_spinlock_t *lock) +{ + int res; + __asm__ __volatile__ ("ldstub [%1], %0" : "=r" (res) : "r" (lock) : "memory"); + return res == 0 ? 0 : EBUSY; +} diff --git a/libpthread/nptl/sysdeps/sparc/pthreaddef.h b/libpthread/nptl/sysdeps/sparc/pthreaddef.h index d4695c47d..435fedcf3 100644 --- a/libpthread/nptl/sysdeps/sparc/pthreaddef.h +++ b/libpthread/nptl/sysdeps/sparc/pthreaddef.h @@ -1,5 +1,39 @@ -#if defined(__arch64__) -#include "sparc64/pthreaddef.h" -#else -#include "sparc32/pthreaddef.h" -#endif +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 + . */ + +/* Default stack size. */ +#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) + +/* Required stack pointer alignment at beginning. */ +#define STACK_ALIGN 16 + +/* Minimal stack size after allocating thread descriptor and guard size. */ +#define MINIMAL_REST_STACK 2048 + +/* Alignment requirement for TCB. */ +#define TCB_ALIGNMENT 16 + + +/* Location of current stack frame. */ +#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) +register char *stack_pointer __asm__("%sp"); + +/* XXX Until we have a better place keep the definitions here. */ + +/* While there is no such syscall. */ +#define __exit_thread_inline(val) \ + INLINE_SYSCALL (exit, 1, (val)) diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h deleted file mode 100644 index 2f64e7d7c..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include -#include -#include - -#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ - _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) - -#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c b/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c deleted file mode 100644 index 2dfcd3c24..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include "pthreadP.h" - -int -pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g2\n" - " orcc %%g2, 0x0, %%g0\n" - " bne,a 2f\n" - " ldub [%0], %%g2\n" - ".subsection 2\n" - "2: orcc %%g2, 0x0, %%g0\n" - " bne,a 2b\n" - " ldub [%0], %%g2\n" - " b,a 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g2", "memory", "cc"); - return 0; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c deleted file mode 100644 index c1b7b2397..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/pthread_spin_trylock.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include -#include "pthreadP.h" - -int -pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int res; - __asm__ __volatile__ ("ldstub [%1], %0" : "=r" (res) : "r" (lock) : "memory"); - return res == 0 ? 0 : EBUSY; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/pthreaddef.h b/libpthread/nptl/sysdeps/sparc/sparc32/pthreaddef.h deleted file mode 100644 index 435fedcf3..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/pthreaddef.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 - . */ - -/* Default stack size. */ -#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) - -/* Required stack pointer alignment at beginning. */ -#define STACK_ALIGN 16 - -/* Minimal stack size after allocating thread descriptor and guard size. */ -#define MINIMAL_REST_STACK 2048 - -/* Alignment requirement for TCB. */ -#define TCB_ALIGNMENT 16 - - -/* Location of current stack frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 64)) -register char *stack_pointer __asm__("%sp"); - -/* XXX Until we have a better place keep the definitions here. */ - -/* While there is no such syscall. */ -#define __exit_thread_inline(val) \ - INLINE_SYSCALL (exit, 1, (val)) diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c b/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c deleted file mode 100644 index 3d314be75..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include "pthreadP.h" - -int -pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g2\n" - " brnz,pn %%g2, 2f\n" - " membar #StoreLoad | #StoreStore\n" - ".subsection 2\n" - "2: ldub [%0], %%g2\n" - " brnz,pt %%g2, 2b\n" - " membar #LoadLoad\n" - " b,a,pt %%xcc, 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g2", "memory"); - return 0; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c deleted file mode 100644 index 3b20a2180..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c b/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c deleted file mode 100644 index 482cbe3d7..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libpthread/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h deleted file mode 100644 index 2f64e7d7c..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include -#include -#include - -#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ - _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) - -#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) diff --git a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c b/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c deleted file mode 100644 index 023505630..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include "pthreadP.h" - -int -pthread_spin_lock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ - ("1: ldstub [%0], %%g5\n" - " brnz,pn %%g5, 2f\n" - " membar #StoreLoad | #StoreStore\n" - ".subsection 2\n" - "2: ldub [%0], %%g5\n" - " brnz,pt %%g5, 2b\n" - " membar #LoadLoad\n" - " b,a,pt %%xcc, 1b\n" - ".previous" - : /* no outputs */ - : "r" (lock) - : "g5", "memory"); - return 0; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c deleted file mode 100644 index b14621b57..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_trylock.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include -#include "pthreadP.h" - -int -pthread_spin_trylock (pthread_spinlock_t *lock) -{ - int res; - __asm__ __volatile__ - ("ldstub [%1], %0\n" - "membar #StoreLoad | #StoreStore" - : "=r" (res) - : "r" (lock) - : "memory"); - return res == 0 ? 0 : EBUSY; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c b/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c deleted file mode 100644 index a00fad376..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc64/pthread_spin_unlock.c +++ /dev/null @@ -1,29 +0,0 @@ -/* pthread_spin_unlock -- unlock a spin lock. Generic version. - Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras , 2003. - - 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 - . */ - -#include "pthreadP.h" -#include - -int -pthread_spin_unlock (pthread_spinlock_t *lock) -{ - __asm__ __volatile__ ("membar #StoreStore | #LoadStore"); - *lock = 0; - return 0; -} diff --git a/libpthread/nptl/sysdeps/sparc/sparc64/pthreaddef.h b/libpthread/nptl/sysdeps/sparc/sparc64/pthreaddef.h deleted file mode 100644 index 845f4bfbb..000000000 --- a/libpthread/nptl/sysdeps/sparc/sparc64/pthreaddef.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 - . */ - -/* Default stack size. */ -#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024) - -/* Required stack pointer alignment at beginning. */ -#define STACK_ALIGN 16 - -/* Minimal stack size after allocating thread descriptor and guard size. */ -#define MINIMAL_REST_STACK 4096 - -/* Alignment requirement for TCB. */ -#define TCB_ALIGNMENT 16 - - -/* Location of current stack frame. */ -#define CURRENT_STACK_FRAME (stack_pointer + (2 * 128)) -register char *stack_pointer __asm__("%sp"); - -/* XXX Until we have a better place keep the definitions here. */ - -/* While there is no such syscall. */ -#define __exit_thread_inline(val) \ - INLINE_SYSCALL (exit, 1, (val)) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S index dfc5e8261..a6142aafe 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S @@ -1,5 +1,2 @@ -#if defined(__arch64__) -#include "./sparc64/clone.S" -#else -#include "./sparc32/clone.S" -#endif +#define RESET_PID +#include diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S index e8705c54b..37231a8c3 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S @@ -1,5 +1,44 @@ -#if defined(__arch64__) -#include "sparc64/pt-vfork.S" -#else -#include "sparc32/pt-vfork.S" -#endif +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 + . */ + +#include +#include + + .text + .globl __syscall_error +ENTRY(__vfork) + ld [%g7 + PID], %o5 + sub %g0, %o5, %o4 + st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x10 + bcc 2f + mov %o7, %g1 + st %o5, [%g7 + PID] + call __syscall_error + mov %g1, %o7 +2: sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a 1f + st %o5, [%g7 + PID] +1: retl + nop +END(__vfork) + +weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c index 73eaa695e..169f6e784 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/pthread_barrier_wait.c @@ -1 +1,93 @@ -#include "sparc32/pthread_barrier_wait.c" +/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky , 2003. + + 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 + . */ + +#include +#include +#include +#include + +/* Wait on barrier. */ +int +pthread_barrier_wait ( + pthread_barrier_t *barrier) +{ + union sparc_pthread_barrier *ibarrier + = (union sparc_pthread_barrier *) barrier; + int result = 0; + int private = ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE; + + /* Make sure we are alone. */ + lll_lock (ibarrier->b.lock, private); + + /* One more arrival. */ + --ibarrier->b.left; + + /* Are these all? */ + if (ibarrier->b.left == 0) + { + /* Yes. Increment the event counter to avoid invalid wake-ups and + tell the current waiters that it is their turn. */ + ++ibarrier->b.curr_event; + + /* Wake up everybody. */ + lll_futex_wake (&ibarrier->b.curr_event, INT_MAX, private); + + /* This is the thread which finished the serialization. */ + result = PTHREAD_BARRIER_SERIAL_THREAD; + } + else + { + /* The number of the event we are waiting for. The barrier's event + number must be bumped before we continue. */ + unsigned int event = ibarrier->b.curr_event; + + /* Before suspending, make the barrier available to others. */ + lll_unlock (ibarrier->b.lock, private); + + /* Wait for the event counter of the barrier to change. */ + do + lll_futex_wait (&ibarrier->b.curr_event, event, private); + while (event == ibarrier->b.curr_event); + } + + /* Make sure the init_count is stored locally or in a register. */ + unsigned int init_count = ibarrier->b.init_count; + + /* If this was the last woken thread, unlock. */ + if (__atomic_is_v9 || ibarrier->s.pshared == 0) + { + if (atomic_increment_val (&ibarrier->b.left) == init_count) + /* We are done. */ + lll_unlock (ibarrier->b.lock, private); + } + else + { + unsigned int left; + /* Slightly more complicated. On pre-v9 CPUs, atomic_increment_val + is only atomic for threads within the same process, not for + multiple processes. */ + __sparc32_atomic_do_lock24 (&ibarrier->s.left_lock); + left = ++ibarrier->b.left; + __sparc32_atomic_do_unlock24 (&ibarrier->s.left_lock); + if (left == init_count) + /* We are done. */ + lll_unlock (ibarrier->b.lock, private); + } + + return result; +} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c new file mode 100644 index 000000000..8da419348 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c @@ -0,0 +1,52 @@ +/* sem_post -- post to a POSIX semaphore. SPARC version. + Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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 + . */ + +#include +#include +#include +#include +#include + +int +sem_post (sem_t *sem) +{ + struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; + int nr; + + if (__atomic_is_v9) + nr = atomic_increment_val (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + nr = ++(isem->value); + __sparc32_atomic_do_unlock24 (&isem->lock); + } + atomic_full_barrier (); + if (isem->nwaiters > 0) + { + int err = lll_futex_wake (&isem->value, 1, + isem->private ^ FUTEX_PRIVATE_FLAG); + if (__builtin_expect (err, 0) < 0) + { + __set_errno (-err); + return -1; + } + } + return 0; +} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c new file mode 100644 index 000000000..64c9abfc7 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_timedwait.c @@ -0,0 +1,147 @@ +/* sem_timedwait -- wait on a semaphore. SPARC version. + Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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 + . */ + +#include +#include +#include +#include +#include + +#include + + +extern void __sem_wait_cleanup (void *arg) attribute_hidden; + + +int +sem_timedwait (sem_t *sem, const struct timespec *abstime) +{ + struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; + int err; + int val; + + if (__atomic_is_v9) + val = atomic_decrement_if_positive (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + val = isem->value; + if (val > 0) + isem->value = val - 1; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + if (val > 0) + return 0; + + if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) + { + __set_errno (EINVAL); + return -1; + } + + if (__atomic_is_v9) + atomic_increment (&isem->nwaiters); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + isem->nwaiters++; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + pthread_cleanup_push (__sem_wait_cleanup, isem); + + while (1) + { + struct timeval tv; + struct timespec rt; + int sec, nsec; + + /* Get the current time. */ + __gettimeofday (&tv, NULL); + + /* Compute relative timeout. */ + sec = abstime->tv_sec - tv.tv_sec; + nsec = abstime->tv_nsec - tv.tv_usec * 1000; + if (nsec < 0) + { + nsec += 1000000000; + --sec; + } + + /* Already timed out? */ + err = -ETIMEDOUT; + if (sec < 0) + { + __set_errno (ETIMEDOUT); + err = -1; + break; + } + + /* Do wait. */ + rt.tv_sec = sec; + rt.tv_nsec = nsec; + + /* Enable asynchronous cancellation. Required by the standard. */ + int oldtype = __pthread_enable_asynccancel (); + + err = lll_futex_timed_wait (&isem->value, 0, &rt, + isem->private ^ FUTEX_PRIVATE_FLAG); + + /* Disable asynchronous cancellation. */ + __pthread_disable_asynccancel (oldtype); + + if (err != 0 && err != -EWOULDBLOCK) + { + __set_errno (-err); + err = -1; + break; + } + + if (__atomic_is_v9) + val = atomic_decrement_if_positive (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + val = isem->value; + if (val > 0) + isem->value = val - 1; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + if (val > 0) + { + err = 0; + break; + } + } + + pthread_cleanup_pop (0); + + if (__atomic_is_v9) + atomic_decrement (&isem->nwaiters); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + isem->nwaiters--; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + return err; +} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_trywait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_trywait.c new file mode 100644 index 000000000..36e859ba4 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_trywait.c @@ -0,0 +1,51 @@ +/* sem_trywait -- wait on a semaphore. SPARC version. + Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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 + . */ + +#include +#include +#include +#include +#include + + +int +sem_trywait (sem_t *sem) +{ + struct sparc_old_sem *isem = (struct sparc_old_sem *) sem; + int val; + + if (isem->value > 0) + { + if (__atomic_is_v9) + val = atomic_decrement_if_positive (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + val = isem->value; + if (val > 0) + isem->value = val - 1; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + if (val > 0) + return 0; + } + + __set_errno (EAGAIN); + return -1; +} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_wait.c new file mode 100644 index 000000000..5d887ab89 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sem_wait.c @@ -0,0 +1,124 @@ +/* sem_wait -- wait on a semaphore. Generic futex-using version. + Copyright (C) 2003, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Paul Mackerras , 2003. + + 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 + . */ + +#include +#include +#include +#include +#include + +#include + + +void +attribute_hidden +__sem_wait_cleanup (void *arg) +{ + struct sparc_new_sem *isem = (struct sparc_new_sem *) arg; + + if (__atomic_is_v9) + atomic_decrement (&isem->nwaiters); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + isem->nwaiters--; + __sparc32_atomic_do_unlock24 (&isem->lock); + } +} + + +int +sem_wait (sem_t *sem) +{ + struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; + int err; + int val; + + if (__atomic_is_v9) + val = atomic_decrement_if_positive (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + val = isem->value; + if (val > 0) + isem->value = val - 1; + else + isem->nwaiters++; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + if (val > 0) + return 0; + + if (__atomic_is_v9) + atomic_increment (&isem->nwaiters); + else + /* Already done above while still holding isem->lock. */; + + pthread_cleanup_push (__sem_wait_cleanup, isem); + + while (1) + { + /* Enable asynchronous cancellation. Required by the standard. */ + int oldtype = __pthread_enable_asynccancel (); + + err = lll_futex_wait (&isem->value, 0, + isem->private ^ FUTEX_PRIVATE_FLAG); + + /* Disable asynchronous cancellation. */ + __pthread_disable_asynccancel (oldtype); + + if (err != 0 && err != -EWOULDBLOCK) + { + __set_errno (-err); + err = -1; + break; + } + + if (__atomic_is_v9) + val = atomic_decrement_if_positive (&isem->value); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + val = isem->value; + if (val > 0) + isem->value = val - 1; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + if (val > 0) + { + err = 0; + break; + } + } + + pthread_cleanup_pop (0); + + if (__atomic_is_v9) + atomic_decrement (&isem->nwaiters); + else + { + __sparc32_atomic_do_lock24 (&isem->lock); + isem->nwaiters--; + __sparc32_atomic_do_unlock24 (&isem->lock); + } + + return err; +} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S deleted file mode 100644 index a6142aafe..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S +++ /dev/null @@ -1,2 +0,0 @@ -#define RESET_PID -#include diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S deleted file mode 100644 index 37231a8c3..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2004. - - 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 - . */ - -#include -#include - - .text - .globl __syscall_error -ENTRY(__vfork) - ld [%g7 + PID], %o5 - sub %g0, %o5, %o4 - st %o4, [%g7 + PID] - - LOADSYSCALL(vfork) - ta 0x10 - bcc 2f - mov %o7, %g1 - st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 -2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 - bne,a 1f - st %o5, [%g7 + PID] -1: retl - nop -END(__vfork) - -weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c deleted file mode 100644 index 169f6e784..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pthread_barrier_wait.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky , 2003. - - 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 - . */ - -#include -#include -#include -#include - -/* Wait on barrier. */ -int -pthread_barrier_wait ( - pthread_barrier_t *barrier) -{ - union sparc_pthread_barrier *ibarrier - = (union sparc_pthread_barrier *) barrier; - int result = 0; - int private = ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE; - - /* Make sure we are alone. */ - lll_lock (ibarrier->b.lock, private); - - /* One more arrival. */ - --ibarrier->b.left; - - /* Are these all? */ - if (ibarrier->b.left == 0) - { - /* Yes. Increment the event counter to avoid invalid wake-ups and - tell the current waiters that it is their turn. */ - ++ibarrier->b.curr_event; - - /* Wake up everybody. */ - lll_futex_wake (&ibarrier->b.curr_event, INT_MAX, private); - - /* This is the thread which finished the serialization. */ - result = PTHREAD_BARRIER_SERIAL_THREAD; - } - else - { - /* The number of the event we are waiting for. The barrier's event - number must be bumped before we continue. */ - unsigned int event = ibarrier->b.curr_event; - - /* Before suspending, make the barrier available to others. */ - lll_unlock (ibarrier->b.lock, private); - - /* Wait for the event counter of the barrier to change. */ - do - lll_futex_wait (&ibarrier->b.curr_event, event, private); - while (event == ibarrier->b.curr_event); - } - - /* Make sure the init_count is stored locally or in a register. */ - unsigned int init_count = ibarrier->b.init_count; - - /* If this was the last woken thread, unlock. */ - if (__atomic_is_v9 || ibarrier->s.pshared == 0) - { - if (atomic_increment_val (&ibarrier->b.left) == init_count) - /* We are done. */ - lll_unlock (ibarrier->b.lock, private); - } - else - { - unsigned int left; - /* Slightly more complicated. On pre-v9 CPUs, atomic_increment_val - is only atomic for threads within the same process, not for - multiple processes. */ - __sparc32_atomic_do_lock24 (&ibarrier->s.left_lock); - left = ++ibarrier->b.left; - __sparc32_atomic_do_unlock24 (&ibarrier->s.left_lock); - if (left == init_count) - /* We are done. */ - lll_unlock (ibarrier->b.lock, private); - } - - return result; -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c deleted file mode 100644 index 8da419348..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c +++ /dev/null @@ -1,52 +0,0 @@ -/* sem_post -- post to a POSIX semaphore. SPARC version. - Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - 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 - . */ - -#include -#include -#include -#include -#include - -int -sem_post (sem_t *sem) -{ - struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; - int nr; - - if (__atomic_is_v9) - nr = atomic_increment_val (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - nr = ++(isem->value); - __sparc32_atomic_do_unlock24 (&isem->lock); - } - atomic_full_barrier (); - if (isem->nwaiters > 0) - { - int err = lll_futex_wake (&isem->value, 1, - isem->private ^ FUTEX_PRIVATE_FLAG); - if (__builtin_expect (err, 0) < 0) - { - __set_errno (-err); - return -1; - } - } - return 0; -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c deleted file mode 100644 index 64c9abfc7..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_timedwait.c +++ /dev/null @@ -1,147 +0,0 @@ -/* sem_timedwait -- wait on a semaphore. SPARC version. - Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras , 2003. - - 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 - . */ - -#include -#include -#include -#include -#include - -#include - - -extern void __sem_wait_cleanup (void *arg) attribute_hidden; - - -int -sem_timedwait (sem_t *sem, const struct timespec *abstime) -{ - struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; - int err; - int val; - - if (__atomic_is_v9) - val = atomic_decrement_if_positive (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - val = isem->value; - if (val > 0) - isem->value = val - 1; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - if (val > 0) - return 0; - - if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) - { - __set_errno (EINVAL); - return -1; - } - - if (__atomic_is_v9) - atomic_increment (&isem->nwaiters); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - isem->nwaiters++; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - pthread_cleanup_push (__sem_wait_cleanup, isem); - - while (1) - { - struct timeval tv; - struct timespec rt; - int sec, nsec; - - /* Get the current time. */ - __gettimeofday (&tv, NULL); - - /* Compute relative timeout. */ - sec = abstime->tv_sec - tv.tv_sec; - nsec = abstime->tv_nsec - tv.tv_usec * 1000; - if (nsec < 0) - { - nsec += 1000000000; - --sec; - } - - /* Already timed out? */ - err = -ETIMEDOUT; - if (sec < 0) - { - __set_errno (ETIMEDOUT); - err = -1; - break; - } - - /* Do wait. */ - rt.tv_sec = sec; - rt.tv_nsec = nsec; - - /* Enable asynchronous cancellation. Required by the standard. */ - int oldtype = __pthread_enable_asynccancel (); - - err = lll_futex_timed_wait (&isem->value, 0, &rt, - isem->private ^ FUTEX_PRIVATE_FLAG); - - /* Disable asynchronous cancellation. */ - __pthread_disable_asynccancel (oldtype); - - if (err != 0 && err != -EWOULDBLOCK) - { - __set_errno (-err); - err = -1; - break; - } - - if (__atomic_is_v9) - val = atomic_decrement_if_positive (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - val = isem->value; - if (val > 0) - isem->value = val - 1; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - if (val > 0) - { - err = 0; - break; - } - } - - pthread_cleanup_pop (0); - - if (__atomic_is_v9) - atomic_decrement (&isem->nwaiters); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - isem->nwaiters--; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - return err; -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c deleted file mode 100644 index 36e859ba4..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_trywait.c +++ /dev/null @@ -1,51 +0,0 @@ -/* sem_trywait -- wait on a semaphore. SPARC version. - Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras , 2003. - - 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 - . */ - -#include -#include -#include -#include -#include - - -int -sem_trywait (sem_t *sem) -{ - struct sparc_old_sem *isem = (struct sparc_old_sem *) sem; - int val; - - if (isem->value > 0) - { - if (__atomic_is_v9) - val = atomic_decrement_if_positive (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - val = isem->value; - if (val > 0) - isem->value = val - 1; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - if (val > 0) - return 0; - } - - __set_errno (EAGAIN); - return -1; -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c deleted file mode 100644 index 5d887ab89..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c +++ /dev/null @@ -1,124 +0,0 @@ -/* sem_wait -- wait on a semaphore. Generic futex-using version. - Copyright (C) 2003, 2007 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras , 2003. - - 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 - . */ - -#include -#include -#include -#include -#include - -#include - - -void -attribute_hidden -__sem_wait_cleanup (void *arg) -{ - struct sparc_new_sem *isem = (struct sparc_new_sem *) arg; - - if (__atomic_is_v9) - atomic_decrement (&isem->nwaiters); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - isem->nwaiters--; - __sparc32_atomic_do_unlock24 (&isem->lock); - } -} - - -int -sem_wait (sem_t *sem) -{ - struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; - int err; - int val; - - if (__atomic_is_v9) - val = atomic_decrement_if_positive (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - val = isem->value; - if (val > 0) - isem->value = val - 1; - else - isem->nwaiters++; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - if (val > 0) - return 0; - - if (__atomic_is_v9) - atomic_increment (&isem->nwaiters); - else - /* Already done above while still holding isem->lock. */; - - pthread_cleanup_push (__sem_wait_cleanup, isem); - - while (1) - { - /* Enable asynchronous cancellation. Required by the standard. */ - int oldtype = __pthread_enable_asynccancel (); - - err = lll_futex_wait (&isem->value, 0, - isem->private ^ FUTEX_PRIVATE_FLAG); - - /* Disable asynchronous cancellation. */ - __pthread_disable_asynccancel (oldtype); - - if (err != 0 && err != -EWOULDBLOCK) - { - __set_errno (-err); - err = -1; - break; - } - - if (__atomic_is_v9) - val = atomic_decrement_if_positive (&isem->value); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - val = isem->value; - if (val > 0) - isem->value = val - 1; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - if (val > 0) - { - err = 0; - break; - } - } - - pthread_cleanup_pop (0); - - if (__atomic_is_v9) - atomic_decrement (&isem->nwaiters); - else - { - __sparc32_atomic_do_lock24 (&isem->lock); - isem->nwaiters--; - __sparc32_atomic_do_unlock24 (&isem->lock); - } - - return err; -} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h deleted file mode 100644 index b61ca7b52..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2002. - - 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 - . */ - -#include -#include -#ifndef __ASSEMBLER__ -# include -#endif - -#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ - .globl __syscall_error; \ -ENTRY(name) \ - ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\ - cmp %g1, 0; \ - bne 1f; \ -.type __##syscall_name##_nocancel,@function; \ -.globl __##syscall_name##_nocancel; \ -__##syscall_name##_nocancel: \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x10; \ - bcc 8f; \ - mov %o7, %g1; \ - call __syscall_error; \ - mov %g1, %o7; \ -8: jmpl %o7 + 8, %g0; \ - nop; \ -.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\ -1: save %sp, -96, %sp; \ - cfi_def_cfa_register(%fp); \ - cfi_window_save; \ - cfi_register(%o7, %i7); \ - CENABLE; \ - nop; \ - mov %o0, %l0; \ - COPY_ARGS_##args \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x10; \ - bcc 1f; \ - mov %o0, %l1; \ - CDISABLE; \ - mov %l0, %o0; \ - call __syscall_error; \ - mov %l1, %o0; \ - b 2f; \ - mov -1, %l1; \ -1: CDISABLE; \ - mov %l0, %o0; \ -2: jmpl %i7 + 8, %g0; \ - restore %g0, %l1, %o0; - - -# ifdef IS_IN_libpthread -# define CENABLE call __pthread_enable_asynccancel -# define CDISABLE call __pthread_disable_asynccancel -# elif !defined NOT_IN_libc -# define CENABLE call __libc_enable_asynccancel -# define CDISABLE call __libc_disable_asynccancel -# elif defined IS_IN_librt -# define CENABLE call __librt_enable_asynccancel -# define CDISABLE call __librt_disable_asynccancel -# else -# error Unsupported library -# endif - -#define COPY_ARGS_0 /* Nothing */ -#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; -#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; -#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; -#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; -#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; -#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; - -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -# else -# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 -# endif - -#elif !defined __ASSEMBLER__ - -# define SINGLE_THREAD_P (1) -# define NO_CANCELLATION 1 - -#endif - -#ifndef __ASSEMBLER__ -# define RTLD_SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S deleted file mode 100644 index 71f0662a2..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2004. - - 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 - . */ - -#include -#include - - .text - .globl __syscall_error -ENTRY(__vfork) - ld [%g7 + PID], %o5 - cmp %o5, 0 - bne 1f - sub %g0, %o5, %o4 - sethi %hi(0x80000000), %o4 -1: st %o4, [%g7 + PID] - - LOADSYSCALL(vfork) - ta 0x10 - bcc 2f - mov %o7, %g1 - st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 -2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 - bne,a 1f - st %o5, [%g7 + PID] -1: retl - nop -END(__vfork) - -libc_hidden_def (vfork) -weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S deleted file mode 100644 index 64e3bfc12..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S +++ /dev/null @@ -1,2 +0,0 @@ -#define RESET_PID -#include diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S deleted file mode 100644 index a058d89de..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2004. - - 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 - . */ - -#include -#include - - .text - .globl __syscall_error -ENTRY(__vfork) - ld [%g7 + PID], %o5 - sub %g0, %o5, %o4 - st %o4, [%g7 + PID] - - LOADSYSCALL(vfork) - ta 0x6d - bcc,pt %xcc, 2f - mov %o7, %g1 - st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 -2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 - bne,a,pt %icc, 1f - st %o5, [%g7 + PID] -1: retl - nop -END(__vfork) - -weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h deleted file mode 100644 index 0e9d2634a..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2002. - - 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 - . */ - -#include -#include -#ifndef __ASSEMBLER__ -# include -#endif - -#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ - .globl __syscall_error; \ -ENTRY(name) \ - ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\ - brnz,pn %g1, 1f; \ -.type __##syscall_name##_nocancel,@function; \ -.globl __##syscall_name##_nocancel; \ -__##syscall_name##_nocancel: \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x6d; \ - bcc,pt %xcc, 8f; \ - mov %o7, %g1; \ - call __syscall_error; \ - mov %g1, %o7; \ -8: jmpl %o7 + 8, %g0; \ - nop; \ -.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\ -1: save %sp, -192, %sp; \ - cfi_def_cfa_register(%fp); \ - cfi_window_save; \ - cfi_register(%o7, %i7); \ - CENABLE; \ - nop; \ - mov %o0, %l0; \ - COPY_ARGS_##args \ - mov SYS_ify(syscall_name), %g1; \ - ta 0x6d; \ - bcc,pt %xcc, 1f; \ - mov %o0, %l1; \ - CDISABLE; \ - mov %l0, %o0; \ - call __syscall_error; \ - mov %l1, %o0; \ - ba,pt %xcc, 2f; \ - mov -1, %l1; \ -1: CDISABLE; \ - mov %l0, %o0; \ -2: jmpl %i7 + 8, %g0; \ - restore %g0, %l1, %o0; - -# ifdef IS_IN_libpthread -# define CENABLE call __pthread_enable_asynccancel -# define CDISABLE call __pthread_disable_asynccancel -# elif !defined NOT_IN_libc -# define CENABLE call __libc_enable_asynccancel -# define CDISABLE call __libc_disable_asynccancel -# elif defined IS_IN_librt -# define CENABLE call __librt_enable_asynccancel -# define CDISABLE call __librt_disable_asynccancel -# else -# error Unsupported library -# endif - -#define COPY_ARGS_0 /* Nothing */ -#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; -#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; -#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; -#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; -#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; -#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; - -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -# else -# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 -# endif - -#elif !defined __ASSEMBLER__ - -# define SINGLE_THREAD_P (1) -# define NO_CANCELLATION 1 - -#endif - -#ifndef __ASSEMBLER__ -# define RTLD_SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_create.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_create.c deleted file mode 100644 index 0a9c3372b..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_create.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../x86_64/timer_create.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_delete.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_delete.c deleted file mode 100644 index f0d4fd21d..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_delete.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../x86_64/timer_delete.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_getoverr.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_getoverr.c deleted file mode 100644 index 82121a7a2..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_getoverr.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../x86_64/timer_getoverr.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_gettime.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_gettime.c deleted file mode 100644 index 313c05fea..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_gettime.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../x86_64/timer_gettime.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_settime.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_settime.c deleted file mode 100644 index 76f549cb4..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/timer_settime.c +++ /dev/null @@ -1 +0,0 @@ -#include "../../x86_64/timer_settime.c" diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S deleted file mode 100644 index bea4f2fd2..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2004. - - 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 - . */ - -#include -#include - - .text - .globl __syscall_error -ENTRY(__vfork) - ld [%g7 + PID], %o5 - sethi %hi(0x80000000), %o3 - cmp %o5, 0 - sub %g0, %o5, %o4 - move %icc, %o3, %o4 - st %o4, [%g7 + PID] - - LOADSYSCALL(vfork) - ta 0x6d - bcc,pt %xcc, 2f - mov %o7, %g1 - st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 -2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 - bne,a,pt %icc, 1f - st %o5, [%g7 + PID] -1: retl - nop -END(__vfork) - -hidden_def (vfork) -weak_alias (__vfork, vfork) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h index 5be9beb92..b61ca7b52 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h @@ -1,5 +1,111 @@ -#if defined(__arch64__) -#include "sparc64/sysdep-cancel.h" -#else -#include "sparc32/sysdep-cancel.h" +/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2002. + + 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 + . */ + +#include +#include +#ifndef __ASSEMBLER__ +# include +#endif + +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .text; \ + .globl __syscall_error; \ +ENTRY(name) \ + ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\ + cmp %g1, 0; \ + bne 1f; \ +.type __##syscall_name##_nocancel,@function; \ +.globl __##syscall_name##_nocancel; \ +__##syscall_name##_nocancel: \ + mov SYS_ify(syscall_name), %g1; \ + ta 0x10; \ + bcc 8f; \ + mov %o7, %g1; \ + call __syscall_error; \ + mov %g1, %o7; \ +8: jmpl %o7 + 8, %g0; \ + nop; \ +.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\ +1: save %sp, -96, %sp; \ + cfi_def_cfa_register(%fp); \ + cfi_window_save; \ + cfi_register(%o7, %i7); \ + CENABLE; \ + nop; \ + mov %o0, %l0; \ + COPY_ARGS_##args \ + mov SYS_ify(syscall_name), %g1; \ + ta 0x10; \ + bcc 1f; \ + mov %o0, %l1; \ + CDISABLE; \ + mov %l0, %o0; \ + call __syscall_error; \ + mov %l1, %o0; \ + b 2f; \ + mov -1, %l1; \ +1: CDISABLE; \ + mov %l0, %o0; \ +2: jmpl %i7 + 8, %g0; \ + restore %g0, %l1, %o0; + + +# ifdef IS_IN_libpthread +# define CENABLE call __pthread_enable_asynccancel +# define CDISABLE call __pthread_disable_asynccancel +# elif !defined NOT_IN_libc +# define CENABLE call __libc_enable_asynccancel +# define CDISABLE call __libc_disable_asynccancel +# elif defined IS_IN_librt +# define CENABLE call __librt_enable_asynccancel +# define CDISABLE call __librt_disable_asynccancel +# else +# error Unsupported library +# endif + +#define COPY_ARGS_0 /* Nothing */ +#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0; +#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1; +#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2; +#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3; +#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4; +#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5; + +# ifndef __ASSEMBLER__ +# define SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + header.multiple_threads) == 0, 1) +# else +# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1 +# endif + +#elif !defined __ASSEMBLER__ + +# define SINGLE_THREAD_P (1) +# define NO_CANCELLATION 1 + +#endif + +#ifndef __ASSEMBLER__ +# define RTLD_SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + header.multiple_threads) == 0, 1) #endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S index 160cd0b10..71f0662a2 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S @@ -1,5 +1,48 @@ -#if defined(__arch64__) -#include "sparc64/vfork.S" -#else -#include "sparc32/vfork.S" -#endif +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 + . */ + +#include +#include + + .text + .globl __syscall_error +ENTRY(__vfork) + ld [%g7 + PID], %o5 + cmp %o5, 0 + bne 1f + sub %g0, %o5, %o4 + sethi %hi(0x80000000), %o4 +1: st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x10 + bcc 2f + mov %o7, %g1 + st %o5, [%g7 + PID] + call __syscall_error + mov %g1, %o7 +2: sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a 1f + st %o5, [%g7 + PID] +1: retl + nop +END(__vfork) + +libc_hidden_def (vfork) +weak_alias (__vfork, vfork) -- cgit v1.2.3