summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/sparc')
-rw-r--r--libc/sysdeps/linux/sparc/Makefile12
-rw-r--r--libc/sysdeps/linux/sparc/__longjmp.S24
-rw-r--r--libc/sysdeps/linux/sparc/bits/siginfo.h27
-rw-r--r--libc/sysdeps/linux/sparc/clone.S46
-rw-r--r--libc/sysdeps/linux/sparc/crt0.c44
-rw-r--r--libc/sysdeps/linux/sparc/crti.S7
-rw-r--r--libc/sysdeps/linux/sparc/crtn.S6
-rw-r--r--libc/sysdeps/linux/sparc/fork.S13
-rw-r--r--libc/sysdeps/linux/sparc/setjmp.S35
-rw-r--r--libc/sysdeps/linux/sparc/vfork.S24
10 files changed, 93 insertions, 145 deletions
diff --git a/libc/sysdeps/linux/sparc/Makefile b/libc/sysdeps/linux/sparc/Makefile
index 0e9ede2f5..8a2549cb2 100644
--- a/libc/sysdeps/linux/sparc/Makefile
+++ b/libc/sysdeps/linux/sparc/Makefile
@@ -19,15 +19,15 @@
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-CRT0_SRC = crt0.c
-CRT0_OBJ = crt0.o crt1.o
+CRT_SRC = crt1.S
+CRT_OBJ = crt1.o
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
SSRC=__longjmp.S fork.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
urem.S udiv.S umul.S sdiv.S rem.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
-CSRC=brk.c
+CSRC=brk.c __syscall_error.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(SOBJS) $(MOBJ) $(COBJS)
@@ -36,12 +36,12 @@ OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
all: $(OBJ_LIST)
-$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
+$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(CTOR_TARGETS)
echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
$(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT0_OBJ) $(TOPDIR)lib/
+ cp $(CRT_OBJ) $(TOPDIR)lib/
-$(CRT0_OBJ): $(CRT0_SRC)
+$(CRT_OBJ): $(CRT_SRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
diff --git a/libc/sysdeps/linux/sparc/__longjmp.S b/libc/sysdeps/linux/sparc/__longjmp.S
index d6e04bd1e..06828e61e 100644
--- a/libc/sysdeps/linux/sparc/__longjmp.S
+++ b/libc/sysdeps/linux/sparc/__longjmp.S
@@ -25,29 +25,29 @@
#define ST_FLUSH_WINDOWS 3
#define RW_FP [%fp + 0x48]
-.global __longjmp;
-.align 4;
-__longjmp: ;
-.type __longjmp ,@function;
+.global __longjmp
+.type __longjmp,%function
+.align 4
+__longjmp:
/* Store our arguments in global registers so we can still
- use them while unwinding frames and their register windows. */
+ * use them while unwinding frames and their register windows. */
ld ENV(o0,JB_FP), %g3 /* Cache target FP in register %g3. */
mov %o0, %g1 /* ENV in %g1 */
- orcc %o1, %g0, %g2 /* VAL in %g2 */
- be,a 0f /* Branch if zero; else skip delay slot. */
- mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */
+ orcc %o1, %g0, %g2 /* VAL in %g2 */
+ be,a 0f /* Branch if zero; else skip delay slot. */
+ mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */
0:
xor %fp, %g3, %o0
add %fp, 512, %o1
andncc %o0, 4095, %o0
bne .Lthread
- cmp %o1, %g3
+ cmp %o1, %g3
bl .Lthread
/* Now we will loop, unwinding the register windows up the stack
- until the restored %fp value matches the target value in %g3. */
+ * until the restored %fp value matches the target value in %g3. */
.Lloop:
cmp %fp, %g3 /* Have we reached the target frame? */
@@ -71,7 +71,7 @@ __longjmp: ;
sub %fp, 64, %sp /* Allocate a register frame. */
st %g3, RW_FP /* Set saved FP on restore below. */
retl
- restore %g2, 0, %o0 /* Restore values from above register frame. */
+ restore %g2, 0, %o0 /* Restore values from above register frame. */
.Lfound:
/* We have unwound register windows so %fp matches the target. */
@@ -82,4 +82,4 @@ __longjmp: ;
jmp %o0 + 8 /* Return there. */
mov %g2, %o0 /* Delay slot: set return value. */
-.size __longjmp , . - __longjmp
+.size __longjmp,.-__longjmp
diff --git a/libc/sysdeps/linux/sparc/bits/siginfo.h b/libc/sysdeps/linux/sparc/bits/siginfo.h
index 7ff1971c2..da2aed678 100644
--- a/libc/sysdeps/linux/sparc/bits/siginfo.h
+++ b/libc/sysdeps/linux/sparc/bits/siginfo.h
@@ -1,5 +1,5 @@
/* siginfo_t, sigevent and constants. Linux/SPARC version.
- Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001 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
@@ -69,9 +69,8 @@ typedef struct siginfo
/* POSIX.1b timers. */
struct
{
- int si_tid; /* Timer ID. */
- int si_overrun; /* Overrun count. */
- sigval_t si_sigval; /* Signal value. */
+ unsigned int _timer1;
+ unsigned int _timer2;
} _timer;
/* POSIX.1b signals. */
@@ -112,8 +111,8 @@ typedef struct siginfo
/* X/Open requires some more fields with fixed names. */
# define si_pid _sifields._kill.si_pid
# define si_uid _sifields._kill.si_uid
-# define si_timerid _sifields._timer.si_tid
-# define si_overrun _sifields._timer.si_overrun
+# define si_timer1 _sifields._timer._timer1
+# define si_timer2 _sifields._timer._timer2
# define si_status _sifields._sigchld.si_status
# define si_utime _sifields._sigchld.si_utime
# define si_stime _sifields._sigchld.si_stime
@@ -130,10 +129,8 @@ typedef struct siginfo
signals. */
enum
{
- SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */
+ SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */
# define SI_ASYNCNL SI_ASYNCNL
- SI_TKILL = -6, /* Sent by tkill. */
-# define SI_TKILL SI_TKILL
SI_SIGIO, /* Sent by queued SIGIO. */
# define SI_SIGIO SI_SIGIO
SI_ASYNCIO, /* Sent by AIO completion. */
@@ -279,6 +276,9 @@ enum
# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
# endif
+/* Forward declaration of the `pthread_attr_t' type. */
+struct __pthread_attr_s;
+
typedef struct sigevent
{
sigval_t sigev_value;
@@ -291,8 +291,8 @@ typedef struct sigevent
struct
{
- void (*_function) (sigval_t); /* Function to start. */
- void *_attribute; /* Really pthread_attr_t. */
+ void (*_function) (sigval_t); /* Function to start. */
+ struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
@@ -308,11 +308,8 @@ enum
# define SIGEV_SIGNAL SIGEV_SIGNAL
SIGEV_NONE, /* Other notification: meaningless. */
# define SIGEV_NONE SIGEV_NONE
- SIGEV_THREAD, /* Deliver via thread creation. */
+ SIGEV_THREAD /* Deliver via thread creation. */
# define SIGEV_THREAD SIGEV_THREAD
-
- SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */
-#define SIGEV_THREAD_ID SIGEV_THREAD_ID
};
#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S
index 9af88688c..7421ef672 100644
--- a/libc/sysdeps/linux/sparc/clone.S
+++ b/libc/sysdeps/linux/sparc/clone.S
@@ -20,53 +20,49 @@
/* 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 <asm/errno.h>
#include <asm/unistd.h>
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
- .text
- .align 4
- .globl __clone
- .type __clone,@function
+.text
+.global __clone
+.type __clone,%function
+.align 4
__clone:
save %sp,-96,%sp
/* sanity check arguments */
tst %i0
- be .Lerror
- orcc %i1,%g0,%o1
- be .Lerror
- mov %i2,%o0
+ be __error
+ orcc %i1,%g0,%o1
+ be __error
+ mov %i2,%o0
/* Do the system call */
set __NR_clone,%g1
ta 0x10
- bcs .Lerror
- tst %o1
+ bcs __error
+ tst %o1
bne __thread_start
- nop
+ nop
ret
- restore %o0,%g0,%o0
+ restore %o0,%g0,%o0
-.Lerror:
- call __errno_location
- or %g0,EINVAL,%i0
- st %i0,[%o0]
- ret
- restore %g0,-1,%o0
+__error:
+ jmp __syscall_error
- .size __clone, .-__clone
+.size __clone,.-__clone
- .type __thread_start,@function
+.type __thread_start,%function
__thread_start:
call %i0
- mov %i3,%o0
+ mov %i3,%o0
call _exit,0
- nop
+ nop
- .size __thread_start, .-__thread_start
+.size __thread_start,.-__thread_start
-.weak clone ; clone = __clone
+.weak clone
+ clone = __clone
diff --git a/libc/sysdeps/linux/sparc/crt0.c b/libc/sysdeps/linux/sparc/crt0.c
deleted file mode 100644
index 81caf1eed..000000000
--- a/libc/sysdeps/linux/sparc/crt0.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/* uClibc/sysdeps/linux/i386/crt0.S
- * Pull stuff off the stack and get uClibc moving.
- *
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Stick in a dummy reference to main(), so that if an application
- * is linking when the main() function is in a static library (.a)
- * we can be sure that main() actually gets linked in */
-extern void main(int argc,void *argv,void *envp);
-void (*mainp)(int argc,void *argv,void *envp) = main;
-
-extern void __uClibc_main(int argc,void *argv,void *envp);
-
-
-void _start(void)
-{
- unsigned int argc;
- char **argv, **envp;
- unsigned long *stack;
-
- stack = ((unsigned long*)__builtin_frame_address(0))+16;
- argc = *stack;
- argv = (char **)stack + 1;
- envp = (char **)stack + argc + 2;
-
- __uClibc_main(argc, argv, envp);
-}
-
diff --git a/libc/sysdeps/linux/sparc/crti.S b/libc/sysdeps/linux/sparc/crti.S
index 9dff14858..6dfc6c61e 100644
--- a/libc/sysdeps/linux/sparc/crti.S
+++ b/libc/sysdeps/linux/sparc/crti.S
@@ -3,7 +3,7 @@
.section .init
.align 4
.global _init
- .type _init, #function
+ .type _init, %function
.proc 020
_init:
!#PROLOGUE# 0
@@ -15,12 +15,9 @@ _init:
.section .fini
.align 4
.global _fini
- .type _fini, #function
+ .type _fini, %function
.proc 020
_fini:
!#PROLOGUE# 0
save %sp, -104, %sp
.align 4
-
-
- .ident "GCC: (GNU) 3.3.2"
diff --git a/libc/sysdeps/linux/sparc/crtn.S b/libc/sysdeps/linux/sparc/crtn.S
index 345638f67..24b4bf43c 100644
--- a/libc/sysdeps/linux/sparc/crtn.S
+++ b/libc/sysdeps/linux/sparc/crtn.S
@@ -3,7 +3,7 @@
.section .init
.align 4
.global _init
- .type _init, #function
+ .type _init, %function
.proc 020
ret
restore
@@ -12,10 +12,8 @@
.section .fini
.align 4
.global _fini
- .type _fini, #function
+ .type _fini, %function
.proc 020
ret
restore
.size _fini, .-_fini
-
- .ident "GCC: (GNU) 3.3.2"
diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S
index 1b271060b..c382f4b4e 100644
--- a/libc/sysdeps/linux/sparc/fork.S
+++ b/libc/sysdeps/linux/sparc/fork.S
@@ -21,10 +21,10 @@
#include <sys/syscall.h>
-.text;
-.global __libc_fork;
-.align 4;
-.type __libc_fork,@function;
+.text
+.global __libc_fork
+.type __libc_fork,%function
+.align 4
__libc_fork:
mov __NR_fork, %g1
@@ -43,6 +43,7 @@ __libc_fork:
retl
and %o0, %o1, %o0
-.size __libc_fork,.-__libc_fork;
-.weak fork; fork = __libc_fork
+.size __libc_fork,.-__libc_fork
+.weak fork
+ fork = __libc_fork
diff --git a/libc/sysdeps/linux/sparc/setjmp.S b/libc/sysdeps/linux/sparc/setjmp.S
index e01e73b04..796abc763 100644
--- a/libc/sysdeps/linux/sparc/setjmp.S
+++ b/libc/sysdeps/linux/sparc/setjmp.S
@@ -23,35 +23,32 @@
#include <bits/setjmp.h>
#define ST_FLUSH_WINDOWS 3
-.global _setjmp;
-.align 4;
-.type _setjmp ,@function;
-
+.global _setjmp
+.type _setjmp,%function
+.align 4
_setjmp:
b 1f
- set 0, %o1
-.size _setjmp,.-_setjmp;
-
-
+ set 0, %o1
+.size _setjmp,.-_setjmp
-.global setjmp;
-.align 4;
-.type setjmp ,@function;
+.global setjmp
+.type setjmp,%function
+.align 4
setjmp:
set 1, %o1
-.size setjmp,.-setjmp;
+.size setjmp,.-setjmp
-.global __sigsetjmp;
-.align 4;
-.type __sigsetjmp ,@function;
+.global __sigsetjmp
+.type __sigsetjmp,%function
+.align 4
__sigsetjmp:
1:
/* Save our PC, SP and FP. Save the signal mask if requested with
@@ -64,10 +61,10 @@ __sigsetjmp:
mov %o7, %g1
call __sigjmp_save
- mov %g1, %o7
-.size __sigsetjmp,.-__sigsetjmp;
+ mov %g1, %o7
+.size __sigsetjmp,.-__sigsetjmp
-.weak _setjmp
-.weak setjmp
+.weak _setjmp
+.weak setjmp
diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S
index 0df960d65..854b66182 100644
--- a/libc/sysdeps/linux/sparc/vfork.S
+++ b/libc/sysdeps/linux/sparc/vfork.S
@@ -22,16 +22,18 @@
#include <sys/syscall.h>
#ifndef __NR_vfork
-/* uClinux-2.0 only has fork which is really vfork */
-#define __NR_vfork __NR_fork
-#endif
+/* No vfork so use fork instead */
+.weak vfork
+ vfork = __libc_fork
-.text;
-.global vfork;
-.align 4;
-.type vfork,@function;
+#else
-vfork:
+.text
+.global vfork
+.type vfork,%function
+.align 4
+
+__vfork:
mov __NR_vfork, %g1
ta 0x10
bcc,a 9000f
@@ -48,5 +50,9 @@ vfork:
retl
and %o0, %o1, %o0
-.size vfork,.-vfork;
+.size __vfork,.-__vfork
+
+.weak vfork
+ vfork = __vfork
+#endif /* __NR_vfork */