aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-05-28 11:41:03 +0200
committerH. Peter Anvin <hpa@zytor.com>2006-05-28 15:54:52 -0700
commit6ac93831b2a5884a38f07c0d6118ad3d94b7385d (patch)
tree03ca4b3af88d72a0e337ee2f24f7520532355604
parent603f94b07e59afc1c907af3768d0a37e9d715f41 (diff)
downloadklibc-6ac93831b2a5884a38f07c0d6118ad3d94b7385d.tar.gz
klibc: merge s390/s390x #4klibc-1.3.24
Merge s390/s390x in the standalone klibc tree. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r--Makefile1
-rw-r--r--scripts/Kbuild.klibc9
-rw-r--r--usr/include/arch/s390/klibc/archsetjmp.h11
-rw-r--r--usr/include/arch/s390/klibc/archstat.h23
-rw-r--r--usr/include/arch/s390/klibc/archsys.h2
-rw-r--r--usr/include/arch/s390x/klibc/archconfig.h14
-rw-r--r--usr/include/arch/s390x/klibc/archsetjmp.h15
-rw-r--r--usr/include/arch/s390x/klibc/archsignal.h14
-rw-r--r--usr/include/arch/s390x/klibc/archstat.h26
-rw-r--r--usr/include/arch/s390x/klibc/archsys.h41
-rw-r--r--usr/klibc/Kbuild6
-rw-r--r--usr/klibc/arch/s390/MCONFIG12
-rw-r--r--usr/klibc/arch/s390/Makefile.inc17
-rw-r--r--usr/klibc/arch/s390/crt0.S10
-rw-r--r--usr/klibc/arch/s390/mmap.c36
-rw-r--r--usr/klibc/arch/s390/setjmp.S34
-rw-r--r--usr/klibc/arch/s390/sysstub.ph11
-rw-r--r--usr/klibc/arch/s390x/MCONFIG13
-rw-r--r--usr/klibc/arch/s390x/Makefile.inc18
-rw-r--r--usr/klibc/arch/s390x/crt0.S21
-rw-r--r--usr/klibc/arch/s390x/mmap.c38
-rw-r--r--usr/klibc/arch/s390x/setjmp.S36
-rw-r--r--usr/klibc/arch/s390x/syscall.c16
-rw-r--r--usr/klibc/arch/s390x/sysstub.ph28
-rw-r--r--usr/klibc/syscalls/Kbuild4
25 files changed, 161 insertions, 295 deletions
diff --git a/Makefile b/Makefile
index 041fcdad684d8..1378b3b92c85a 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ NOSTDINC_FLAGS := -nostdlib -nostdinc -isystem $(shell $(CC) -print-file-name=in
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/parisc64/parisc/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
export KLIBCARCH ?= $(ARCH)
+export KLIBCARCHDIR := $(shell echo $(KLIBCARCH) | sed -e s/s390x/s390/)
export HOSTCC := gcc
export HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index 977f3278b8382..ff081432942aa 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -55,9 +55,10 @@ KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter
KLIBCSHAREDFLAGS :=
KLIBCBITSIZE :=
KLIBCLDFLAGS :=
+KLIBCCFLAGS :=
# Arch specific definitions for klibc
-include $(KLIBCSRC)/arch/$(KLIBCARCH)/MCONFIG
+include $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG
# include/asm-* architecture
KLIBCASMARCH ?= $(KLIBCARCH)
@@ -77,7 +78,7 @@ KLIBCOBJCOPY := $(OBJCOPY)
KLIBCOBJDUMP := $(OBJDUMP)
# klibc include paths
-KLIBCCPPFLAGS := -I$(KLIBCINC)/arch/$(KLIBCARCH) \
+KLIBCCPPFLAGS := -I$(KLIBCINC)/arch/$(KLIBCARCHDIR) \
-I$(KLIBCINC)/bits$(KLIBCBITSIZE) \
-I$(KLIBCOBJ)/../include \
-I$(KLIBCINC)
@@ -92,14 +93,14 @@ KLIBCDEFS := -D__KLIBC__=$(KLIBCMAJOR) \
-D__KLIBC_MINOR__=$(KLIBCMINOR) \
-D_BITSIZE=$(KLIBCBITSIZE)
KLIBCCPPFLAGS += $(KLIBCDEFS)
-KLIBCCFLAGS := $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS) \
+KLIBCCFLAGS += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS) \
$(KLIBCOPTFLAGS) $(KLIBCWARNFLAGS)
KLIBCAFLAGS := -D__ASSEMBLY__ $(KLIBCCFLAGS)
KLIBCSTRIPFLAGS := --strip-all -R .comment -R .note
KLIBCLIBGCC_DEF := $(shell $(KLIBCCC) $(KLIBCCFLAGS) --print-libgcc)
KLIBCLIBGCC ?= $(KLIBCLIBGCC_DEF)
-KLIBCCRT0 := $(KLIBCOBJ)/arch/$(KLIBCARCH)/crt0.o
+KLIBCCRT0 := $(KLIBCOBJ)/arch/$(KLIBCARCHDIR)/crt0.o
KLIBCLIBC := $(KLIBCOBJ)/libc.a
KLIBCCRTSHARED := $(KLIBCOBJ)/interp.o
KLIBCLIBCSHARED := $(KLIBCOBJ)/libc.so
diff --git a/usr/include/arch/s390/klibc/archsetjmp.h b/usr/include/arch/s390/klibc/archsetjmp.h
index 7ee82cc0038d9..728780add2df5 100644
--- a/usr/include/arch/s390/klibc/archsetjmp.h
+++ b/usr/include/arch/s390/klibc/archsetjmp.h
@@ -5,11 +5,22 @@
#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H
+#ifndef __s390x__
+
struct __jmp_buf {
uint32_t __gregs[10]; /* general registers r6-r15 */
uint64_t __fpregs[2]; /* fp registers f4 and f6 */
};
+#else /* __s390x__ */
+
+struct __jmp_buf {
+ uint64_t __gregs[10]; /* general registers r6-r15 */
+ uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */
+};
+
+#endif /* __s390x__ */
+
typedef struct __jmp_buf jmp_buf[1];
#endif /* _SETJMP_H */
diff --git a/usr/include/arch/s390/klibc/archstat.h b/usr/include/arch/s390/klibc/archstat.h
index 67a95c546cbcd..de3a9da6ea4ee 100644
--- a/usr/include/arch/s390/klibc/archstat.h
+++ b/usr/include/arch/s390/klibc/archstat.h
@@ -5,6 +5,8 @@
#define _STATBUF_ST_NSEC
+#ifndef __s390x__
+
/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
*/
@@ -30,4 +32,25 @@ struct stat {
unsigned long long st_ino;
};
+#else /* __s390x__ */
+
+struct stat {
+ __stdev64 (st_dev);
+ unsigned long st_ino;
+ unsigned long st_nlink;
+ unsigned int st_mode;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int __pad1;
+ __stdev64 (st_rdev);
+ unsigned long st_size;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned long st_blksize;
+ long st_blocks;
+ unsigned long __unused[3];
+};
+
+#endif /* __s390x__ */
#endif
diff --git a/usr/include/arch/s390/klibc/archsys.h b/usr/include/arch/s390/klibc/archsys.h
index 626b81ea7b2b6..63079b466ffdc 100644
--- a/usr/include/arch/s390/klibc/archsys.h
+++ b/usr/include/arch/s390/klibc/archsys.h
@@ -28,7 +28,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
long __res; \
__asm__ __volatile__ ( \
" svc %b1\n" \
- " lr %0,2" \
+ " la %0,2" \
: "=d" (__res) \
: "i" (__NR_##name), \
"d" (__argp) \
diff --git a/usr/include/arch/s390x/klibc/archconfig.h b/usr/include/arch/s390x/klibc/archconfig.h
deleted file mode 100644
index 87b80ec834ab1..0000000000000
--- a/usr/include/arch/s390x/klibc/archconfig.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * include/arch/s390x/klibc/archconfig.h
- *
- * See include/klibc/sysconfig.h for the options that can be set in
- * this file.
- *
- */
-
-#ifndef _KLIBC_ARCHCONFIG_H
-#define _KLIBC_ARCHCONFIG_H
-
-/* All defaults */
-
-#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/s390x/klibc/archsetjmp.h b/usr/include/arch/s390x/klibc/archsetjmp.h
deleted file mode 100644
index d17c310890097..0000000000000
--- a/usr/include/arch/s390x/klibc/archsetjmp.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * arch/s390x/include/klibc/archsetjmp.h
- */
-
-#ifndef _KLIBC_ARCHSETJMP_H
-#define _KLIBC_ARCHSETJMP_H
-
-struct __jmp_buf {
- uint64_t __gregs[10]; /* general registers r6-r15 */
- uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */
-};
-
-typedef struct __jmp_buf jmp_buf[1];
-
-#endif /* _SETJMP_H */
diff --git a/usr/include/arch/s390x/klibc/archsignal.h b/usr/include/arch/s390x/klibc/archsignal.h
deleted file mode 100644
index cef96bc539e3d..0000000000000
--- a/usr/include/arch/s390x/klibc/archsignal.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * arch/s390x/include/klibc/archsignal.h
- *
- * Architecture-specific signal definitions
- *
- */
-
-#ifndef _KLIBC_ARCHSIGNAL_H
-#define _KLIBC_ARCHSIGNAL_H
-
-#include <asm/signal.h>
-/* No special stuff for this architecture */
-
-#endif
diff --git a/usr/include/arch/s390x/klibc/archstat.h b/usr/include/arch/s390x/klibc/archstat.h
deleted file mode 100644
index 1319e6b7095f0..0000000000000
--- a/usr/include/arch/s390x/klibc/archstat.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _KLIBC_ARCHSTAT_H
-#define _KLIBC_ARCHSTAT_H
-
-#include <klibc/stathelp.h>
-
-#define _STATBUF_ST_NSEC
-
-struct stat {
- __stdev64 (st_dev);
- unsigned long st_ino;
- unsigned long st_nlink;
- unsigned int st_mode;
- unsigned int st_uid;
- unsigned int st_gid;
- unsigned int __pad1;
- __stdev64 (st_rdev);
- unsigned long st_size;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
- unsigned long st_blksize;
- long st_blocks;
- unsigned long __unused[3];
-};
-
-#endif
diff --git a/usr/include/arch/s390x/klibc/archsys.h b/usr/include/arch/s390x/klibc/archsys.h
deleted file mode 100644
index 29ad95edcbf4e..0000000000000
--- a/usr/include/arch/s390x/klibc/archsys.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * arch/s390x/include/klibc/archsys.h
- *
- * Architecture-specific syscall definitions
- */
-
-#ifndef _KLIBC_ARCHSYS_H
-#define _KLIBC_ARCHSYS_H
-
-/* S/390X only has five syscall parameters, and uses a structure for
- 6-argument syscalls. */
-
-#ifndef _syscall6
-
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\
- type4,arg4,type5,arg5,type6,arg6) \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
- type5 arg5, type6 arg6) { \
- unsigned long __arg[6] = { \
- (unsigned long) arg1, \
- (unsigned long) arg2, \
- (unsigned long) arg3, \
- (unsigned long) arg4, \
- (unsigned long) arg5, \
- (unsigned long) arg6 \
- }; \
- register void *__argp asm("2") = &__arg; \
- long __res; \
- __asm__ __volatile__ ( \
- " svc %b1\n" \
- " lgr %0,2" \
- : "=d" (__res) \
- : "i" (__NR_##name), \
- "d" (__argp) \
- : _svc_clobber); \
- __syscall_return(type, __res); \
-}
-
-#endif /* _syscall6() missing */
-
-#endif /* _KLIBC_ARCHSYS_H */
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index 9e651d0fed282..93be3c29c3a5b 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -68,14 +68,14 @@ KLIBCCFLAGS += -DDYNAMIC_CRC_TABLE
#####
# Add any architecture-specific rules
-include $(obj)/arch/$(KLIBCARCH)/Makefile.inc
+include $(obj)/arch/$(KLIBCARCHDIR)/Makefile.inc
#####
# Shared definitions
LIB := libc.a
SOLIB := libc.so
SOHASH := klibc.so
-CRT0 := arch/$(KLIBCARCH)/crt0.o
+CRT0 := arch/$(KLIBCARCHDIR)/crt0.o
INTERP_O := interp.o
always := $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O)
@@ -87,7 +87,7 @@ INTERP_O := $(call objectify,$(INTERP_O))
SOLIBHASH = $(shell cat $(SOLIB).hash)
-targets += arch/$(KLIBCARCH)/crt0.o
+targets += arch/$(KLIBCARCHDIR)/crt0.o
targets += $(libc-y) $(KLIBCARCHOBJS)
# Generate syscall stubs
diff --git a/usr/klibc/arch/s390/MCONFIG b/usr/klibc/arch/s390/MCONFIG
index 5041e09c66b5f..dd4495ad3245d 100644
--- a/usr/klibc/arch/s390/MCONFIG
+++ b/usr/klibc/arch/s390/MCONFIG
@@ -8,6 +8,16 @@
#
KLIBCOPTFLAGS = -Os
-KLIBCBITSIZE = 32
+ifneq ("$(KLIBCARCH)", "s390x")
+ KLIBCBITSIZE = 32
+ KLIBCCFLAGS += -m31
+ KLIBCLDFLAGS += -m elf_s390
+else
+ KLIBCBITSIZE = 64
+ KLIBCCFLAGS += -m64
+ KLIBCLDFLAGS += -m elf64_s390
+endif
+
+KLIBCASMARCH = s390
KLIBCSHAREDFLAGS = -Ttext 0x40000200
diff --git a/usr/klibc/arch/s390/Makefile.inc b/usr/klibc/arch/s390/Makefile.inc
index 54e545afe6fe4..86ff22936c7e3 100644
--- a/usr/klibc/arch/s390/Makefile.inc
+++ b/usr/klibc/arch/s390/Makefile.inc
@@ -7,16 +7,27 @@
# accordingly.
#
+ifneq ("$(KLIBCARCH)", "s390x")
+
KLIBCARCHOBJS = \
- arch/$(KLIBCARCH)/setjmp.o \
- arch/$(KLIBCARCH)/mmap.o \
- arch/$(KLIBCARCH)/syscall.o \
+ arch/$(KLIBCARCHDIR)/setjmp.o \
+ arch/$(KLIBCARCHDIR)/mmap.o \
+ arch/$(KLIBCARCHDIR)/syscall.o \
libgcc/__divdi3.o \
libgcc/__moddi3.o \
libgcc/__udivdi3.o \
libgcc/__umoddi3.o \
libgcc/__udivmoddi4.o
+else
+
+KLIBCARCHOBJS = \
+ arch/$(KLIBCARCHDIR)/setjmp.o \
+ arch/$(KLIBCARCHDIR)/mmap.o \
+ arch/$(KLIBCARCHDIR)/syscall.o
+
+endif
+
KLIBCARCHSOOBJS = $(patsubst %.o,%.lo,$(KLIBCARCHOBJS))
diff --git a/usr/klibc/arch/s390/crt0.S b/usr/klibc/arch/s390/crt0.S
index 49c3e7ebc7036..fd9237ea5a30b 100644
--- a/usr/klibc/arch/s390/crt0.S
+++ b/usr/klibc/arch/s390/crt0.S
@@ -11,6 +11,9 @@
.align 4
.type _start,@function
.globl _start
+
+#ifndef __s390x__
+
_start:
lr %r2,%r15
lhi %r3,0
@@ -21,5 +24,12 @@ _start:
br %r1
.L1:
.long __libc_init
+#else
+_start:
+ lgr %r2,%r15
+ lghi %r3,0
+ aghi %r15,-160
+ jg __libc_init
+#endif
.size _start,.-_start
diff --git a/usr/klibc/arch/s390/mmap.c b/usr/klibc/arch/s390/mmap.c
index eefe23106ed58..2b1935b2ee199 100644
--- a/usr/klibc/arch/s390/mmap.c
+++ b/usr/klibc/arch/s390/mmap.c
@@ -10,6 +10,8 @@ struct mmap_arg_struct {
unsigned long offset;
};
+#ifndef __s390x__
+
void *__mmap2(void *addr, size_t len, int prot, int flags, int fd, long offset)
{
struct mmap_arg_struct args = {
@@ -36,3 +38,37 @@ void *__mmap2(void *addr, size_t len, int prot, int flags, int fd, long offset)
}
return (void *)__res;
}
+
+#else /* __s390x__ */
+
+void * mmap(void * addr, size_t len, int prot, int flags,
+ int fd, off_t offset)
+{
+ struct mmap_arg_struct args = {
+ (unsigned long) addr,
+ (unsigned long) len,
+ (unsigned long) prot,
+ (unsigned long) flags,
+ (unsigned long) fd,
+ (unsigned long) offset,
+ };
+
+ register struct mmap_arg_struct *__arg1 asm("2") = &args;
+ register long __svcres asm("2");
+ unsigned long __res;
+
+ __asm__ __volatile__ (
+ " svc %b1\n"
+ : "=d" (__svcres)
+ : "i" (__NR_mmap),
+ "0" (__arg1)
+ : "1", "cc", "memory");
+ __res = __svcres;
+ if (__res >= (unsigned long)-125) {
+ errno = -__res;
+ __res = -1;
+ }
+ return (void *)__res;
+}
+
+#endif /* __s390x__ */
diff --git a/usr/klibc/arch/s390/setjmp.S b/usr/klibc/arch/s390/setjmp.S
index 97132680ae95f..c36a0517ccf21 100644
--- a/usr/klibc/arch/s390/setjmp.S
+++ b/usr/klibc/arch/s390/setjmp.S
@@ -8,6 +8,9 @@
.align 4
.globl setjmp
.type setjmp, @function
+
+#ifndef __s390x__
+
setjmp:
stm %r6,%r15,0(%r2) # save all general registers
std %f4,40(%r2) # save fp registers f4 and f6
@@ -30,3 +33,34 @@ longjmp:
br %r14 # return to restored address
.size longjmp,.-longjmp
+
+#else
+
+setjmp:
+ stmg %r6,%r15,0(%r2) # save all general registers
+ std %f1,80(%r2) # save fp registers f4 and f6
+ std %f3,88(%r2)
+ std %f5,96(%r2)
+ std %f7,104(%r2)
+ lghi %r2,0 # return 0
+ br %r14
+
+ .size setjmp,.-setjmp
+
+ .text
+ .align 4
+ .globl longjmp
+ .type longjmp, @function
+longjmp:
+ lgr %r1,%r2 # jmp_buf
+ lgr %r2,%r3 # return value
+ ld %f7,104(%r1) # restore all saved registers
+ ld %f5,96(%r1)
+ ld %f3,88(%r1)
+ ld %f1,80(%r1)
+ lmg %r6,%r15,0(%r1)
+ br %r14 # return to restored address
+
+ .size longjmp,.-longjmp
+
+#endif
diff --git a/usr/klibc/arch/s390/sysstub.ph b/usr/klibc/arch/s390/sysstub.ph
index 35f40a0865f1c..880a0da8dd537 100644
--- a/usr/klibc/arch/s390/sysstub.ph
+++ b/usr/klibc/arch/s390/sysstub.ph
@@ -17,13 +17,22 @@ sub make_sysstub($$$$$@) {
print OUT ".if __NR_${sname} < 256\n";
print OUT "\tsvc __NR_${sname}\n";
print OUT ".else\n";
- print OUT "\tlhi %r1,__NR_${sname}\n";
+ print OUT "\tla %r1,__NR_${sname}\n";
print OUT "\tsvc 0\n";
print OUT ".endif\n";
+
+ print OUT "#ifndef __s390x__\n";
+
print OUT "\tbras %r3,1f\n";
print OUT "\t.long __syscall_common\n";
print OUT "1:\tl %r3,0(%r3)\n";
print OUT "\tbr %r3\n";
+
+ print OUT "#else\n";
+
+ print OUT "\tbrasl %r3,__syscall_common\n";
+
+ print OUT "#endif\n";
print OUT "\t.size ${fname},.-${fname}\n";
close(OUT);
}
diff --git a/usr/klibc/arch/s390x/MCONFIG b/usr/klibc/arch/s390x/MCONFIG
deleted file mode 100644
index 64959327b6ded..0000000000000
--- a/usr/klibc/arch/s390x/MCONFIG
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*-
-#
-# arch/s390x/MCONFIG
-#
-# Special rules for this architecture. Note that this is actually
-# included from the main Makefile, and that pathnames should be
-# accordingly.
-#
-
-KLIBCOPTFLAGS = -Os
-KLIBCBITSIZE = 64
-
-KLIBCSHAREDFLAGS = -Ttext 0x40000200
diff --git a/usr/klibc/arch/s390x/Makefile.inc b/usr/klibc/arch/s390x/Makefile.inc
deleted file mode 100644
index ce561fbf69876..0000000000000
--- a/usr/klibc/arch/s390x/Makefile.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- makefile -*-
-#
-# arch/s390x/Makefile.inc
-#
-# Special rules for this architecture. Note that this is actually
-# included from the main Makefile, and that pathnames should be
-# accordingly.
-#
-
-KLIBCARCHOBJS = \
- arch/$(KLIBCARCH)/setjmp.o \
- arch/$(KLIBCARCH)/mmap.o \
- arch/$(KLIBCARCH)/syscall.o
-
-KLIBCARCHSOOBJS = $(patsubst %.o,%.lo,$(KLIBCARCHOBJS))
-
-
-archclean:
diff --git a/usr/klibc/arch/s390x/crt0.S b/usr/klibc/arch/s390x/crt0.S
deleted file mode 100644
index 56f590fb55d58..0000000000000
--- a/usr/klibc/arch/s390x/crt0.S
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# arch/s390/crt0.S
-#
-# Does arch-specific initialization and invokes __libc_init
-# with the appropriate arguments.
-#
-# See __static_init.c or __shared_init.c for the expected
-# arguments.
-#
-
- .text
- .align 4
- .type _start,@function
- .globl _start
-_start:
- lgr %r2,%r15
- lghi %r3,0
- aghi %r15,-160
- jg __libc_init
-
- .size _start,.-_start
diff --git a/usr/klibc/arch/s390x/mmap.c b/usr/klibc/arch/s390x/mmap.c
deleted file mode 100644
index b300d1952163f..0000000000000
--- a/usr/klibc/arch/s390x/mmap.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <sys/types.h>
-#include <linux/unistd.h>
-
-struct mmap_arg_struct {
- unsigned long addr;
- unsigned long len;
- unsigned long prot;
- unsigned long flags;
- unsigned long fd;
- unsigned long offset;
-};
-
-void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
- struct mmap_arg_struct args = {
- (unsigned long)addr,
- (unsigned long)len,
- (unsigned long)prot,
- (unsigned long)flags,
- (unsigned long)fd,
- (unsigned long)offset,
- };
-
- register struct mmap_arg_struct *__arg1 asm("2") = &args;
- register long __svcres asm("2");
- unsigned long __res;
-
- __asm__ __volatile__(" svc %b1\n"
- : "=d"(__svcres)
- : "i"(__NR_mmap), "0"(__arg1)
- : "1", "cc", "memory");
- __res = __svcres;
- if (__res >= (unsigned long)-125) {
- errno = -__res;
- __res = -1;
- }
- return (void *)__res;
-}
diff --git a/usr/klibc/arch/s390x/setjmp.S b/usr/klibc/arch/s390x/setjmp.S
deleted file mode 100644
index 251c57d43a3a4..0000000000000
--- a/usr/klibc/arch/s390x/setjmp.S
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# arch/s390x/setjmp.S
-#
-# setjmp/longjmp for the s390x architecture
-#
-
- .text
- .align 4
- .globl setjmp
- .type setjmp, @function
-setjmp:
- stmg %r6,%r15,0(%r2) # save all general registers
- std %f1,80(%r2) # save fp registers f4 and f6
- std %f3,88(%r2)
- std %f5,96(%r2)
- std %f7,104(%r2)
- lghi %r2,0 # return 0
- br %r14
-
- .size setjmp,.-setjmp
-
- .text
- .align 4
- .globl longjmp
- .type longjmp, @function
-longjmp:
- lgr %r1,%r2 # jmp_buf
- lgr %r2,%r3 # return value
- ld %f7,104(%r1) # restore all saved registers
- ld %f5,96(%r1)
- ld %f3,88(%r1)
- ld %f1,80(%r1)
- lmg %r6,%r15,0(%r1)
- br %r14 # return to restored address
-
- .size longjmp,.-longjmp
diff --git a/usr/klibc/arch/s390x/syscall.c b/usr/klibc/arch/s390x/syscall.c
deleted file mode 100644
index 3a7dd773f100d..0000000000000
--- a/usr/klibc/arch/s390x/syscall.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * arch/s390x/syscall.c
- *
- * Common error-handling path for system calls.
- * The return value from __syscall_common becomes the
- * return value from the system call.
- */
-#include <errno.h>
-
-unsigned long __syscall_common(unsigned long err)
-{
- if (err < -4095UL)
- return err;
- errno = -err;
- return -1;
-}
diff --git a/usr/klibc/arch/s390x/sysstub.ph b/usr/klibc/arch/s390x/sysstub.ph
deleted file mode 100644
index 55c721b558bb8..0000000000000
--- a/usr/klibc/arch/s390x/sysstub.ph
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- perl -*-
-#
-# arch/s390x/sysstub.ph
-#
-# Script to generate system call stubs
-#
-
-sub make_sysstub($$$$$@) {
- my($outputdir, $fname, $type, $sname, $stype, @args) = @_;
-
- open(OUT, '>', "${outputdir}/${fname}.S");
- print OUT "#include <asm/unistd.h>\n";
- print OUT "\n";
- print OUT "\t.type ${fname},\@function\n";
- print OUT "\t.globl ${fname}\n";
- print OUT "${fname}:\n";
- print OUT ".if __NR_${sname} < 256\n";
- print OUT "\tsvc __NR_${sname}\n";
- print OUT ".else\n";
- print OUT "\tlghi %r1,__NR_${sname}\n";
- print OUT "\tsvc 0\n";
- print OUT ".endif\n";
- print OUT "\tbrasl %r3,__syscall_common\n";
- print OUT "\t.size ${fname},.-${fname}\n";
- close(OUT);
-}
-
-1;
diff --git a/usr/klibc/syscalls/Kbuild b/usr/klibc/syscalls/Kbuild
index 11e1b014fbd7f..ba71aa194605f 100644
--- a/usr/klibc/syscalls/Kbuild
+++ b/usr/klibc/syscalls/Kbuild
@@ -53,14 +53,14 @@ $(obj)/syscalls.nrs: $(KLIBCINC)/sys/syscall.h FORCE
quiet_cmd_syscalls = GEN $@
cmd_syscalls = mkdir -p $(KLIBCINC)/klibc/; \
$(PERL) $(KLIBCSRC)/syscalls.pl $(obj)/SYSCALLS.i \
- $(KLIBCSRC)/arch/$(KLIBCARCH)/sysstub.ph \
+ $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/sysstub.ph \
$(KLIBCARCH) $(KLIBCBITSIZE) $(obj)/syscalls.nrs \
$(obj) \
$(KLIBCINC)/klibc/havesyscall.h > $@ \
|| rm -f $@
$(obj)/syscalls.mk: $(KLIBCSRC)/syscalls.pl $(obj)/SYSCALLS.i \
- $(KLIBCSRC)/arch/$(KLIBCARCH)/sysstub.ph \
+ $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/sysstub.ph \
$(call objectify, $(syscall-objs:.o=.S)) \
$(KLIBCSRC)/syscommon.h $(obj)/syscalls.nrs
$(call cmd,syscalls)