svn commit: r202942 - in projects/ppc64: gnu/lib/csu gnu/lib/libgcc
lib/csu/powerpc64 lib/libc/gmon lib/libc/powerpc64
lib/libc/powerpc64/gen lib/libc/powerpc64/sys lib/libc/stdlib
lib/libthr/arch/...
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Jan 24 18:56:57 UTC 2010
Author: nwhitehorn
Date: Sun Jan 24 18:56:57 2010
New Revision: 202942
URL: http://svn.freebsd.org/changeset/base/202942
Log:
Initial support for a PPC64 userland. RTLD is currently missing, and a
shared version of libc fails to build due to bugs in binutils, but this
is sufficient to build and run a statically linked 64-bit "Hello World".
Added:
projects/ppc64/lib/csu/powerpc64/
projects/ppc64/lib/csu/powerpc64/Makefile
projects/ppc64/lib/csu/powerpc64/crt1.c
projects/ppc64/lib/csu/powerpc64/crti.S
projects/ppc64/lib/csu/powerpc64/crtn.S
projects/ppc64/lib/libc/powerpc64/
- copied from r202650, projects/ppc64/lib/libc/powerpc/
projects/ppc64/lib/libthr/arch/powerpc64/
- copied from r202650, projects/ppc64/lib/libthr/arch/powerpc/
projects/ppc64/lib/libthr/arch/powerpc64/powerpc64/
- copied from r202650, projects/ppc64/lib/libthr/arch/powerpc/powerpc/
projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc64.h
- copied, changed from r202650, projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc.h
Deleted:
projects/ppc64/lib/libthr/arch/powerpc64/powerpc/
Modified:
projects/ppc64/gnu/lib/csu/Makefile
projects/ppc64/gnu/lib/libgcc/Makefile
projects/ppc64/lib/libc/gmon/gmon.c
projects/ppc64/lib/libc/powerpc64/Makefile.inc
projects/ppc64/lib/libc/powerpc64/SYS.h
projects/ppc64/lib/libc/powerpc64/Symbol.map
projects/ppc64/lib/libc/powerpc64/gen/_ctx_start.S
projects/ppc64/lib/libc/powerpc64/gen/makecontext.c
projects/ppc64/lib/libc/powerpc64/gen/signalcontext.c
projects/ppc64/lib/libc/powerpc64/gen/syncicache.c
projects/ppc64/lib/libc/powerpc64/sys/brk.S
projects/ppc64/lib/libc/powerpc64/sys/cerror.S
projects/ppc64/lib/libc/powerpc64/sys/exect.S
projects/ppc64/lib/libc/powerpc64/sys/pipe.S
projects/ppc64/lib/libc/powerpc64/sys/ptrace.S
projects/ppc64/lib/libc/powerpc64/sys/sbrk.S
projects/ppc64/lib/libc/powerpc64/sys/setlogin.S
projects/ppc64/lib/libc/stdlib/malloc.c
projects/ppc64/lib/libthr/arch/powerpc64/include/pthread_md.h
projects/ppc64/sys/powerpc/include/asm.h
projects/ppc64/sys/powerpc/include/profile.h
projects/ppc64/sys/sys/cdefs.h
Modified: projects/ppc64/gnu/lib/csu/Makefile
==============================================================================
--- projects/ppc64/gnu/lib/csu/Makefile Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/gnu/lib/csu/Makefile Sun Jan 24 18:56:57 2010 (r202942)
@@ -30,7 +30,7 @@ CFLAGS+= -x assembler-with-cpp # Ugly ha
CFLAGS+= -include osreldate.h
.undef SRCS # hack for 'make depend'
.endif
-.if ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
TGTOBJS= crtsavres.o
SRCS+= crtsavres.asm
.endif
Modified: projects/ppc64/gnu/lib/libgcc/Makefile
==============================================================================
--- projects/ppc64/gnu/lib/libgcc/Makefile Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/gnu/lib/libgcc/Makefile Sun Jan 24 18:56:57 2010 (r202942)
@@ -136,6 +136,11 @@ LIB2FUNCS_EXTRA = tramp.asm
LIB2FUNCS_STATIC_EXTRA = eabi.asm
.endif
+.if ${TARGET_ARCH} == "powerpc64"
+# from config/rs6000/t-ppccomm
+LIB2FUNCS_EXTRA = tramp.asm
+.endif
+
.if ${TARGET_ARCH} == "sparc64"
# from config/sparc/t-elf
LIB1ASMSRC = lb1spc.asm
Added: projects/ppc64/lib/csu/powerpc64/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ppc64/lib/csu/powerpc64/Makefile Sun Jan 24 18:56:57 2010 (r202942)
@@ -0,0 +1,23 @@
+# $FreeBSD: projects/ppc64/lib/csu/powerpc/Makefile 100872 2002-07-29 09:40:17Z ru $
+
+.PATH: ${.CURDIR}/../common
+
+SRCS= crt1.c crti.S crtn.S
+OBJS= ${SRCS:N*.h:R:S/$/.o/g}
+OBJS+= gcrt1.o
+CFLAGS+= -Wall -Wno-unused \
+ -I${.CURDIR}/../common \
+ -I${.CURDIR}/../../libc/include
+
+all: ${OBJS}
+
+CLEANFILES= ${OBJS}
+
+gcrt1.o: crt1.c
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
+
+realinstall:
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
+.include <bsd.lib.mk>
Added: projects/ppc64/lib/csu/powerpc64/crt1.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ppc64/lib/csu/powerpc64/crt1.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -0,0 +1,123 @@
+/* LINTLIBRARY */
+/*-
+ * Copyright 2001 David E. O'Brien.
+ * All rights reserved.
+ * Copyright 1996-1998 John D. Polstra.
+ * All rights reserved.
+ * Copyright (c) 1997 Jason R. Thorpe.
+ * Copyright (c) 1995 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the
+ * FreeBSD Project. See http://www.freebsd.org/ for
+ * information about FreeBSD.
+ * This product includes software developed for the
+ * NetBSD Project. See http://www.netbsd.org/ for
+ * information about NetBSD.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef lint
+#ifndef __GNUC__
+#error "GCC is needed to compile this file"
+#endif
+#endif /* lint */
+
+#include <stdlib.h>
+
+#include "libc_private.h"
+#include "crtbrand.c"
+
+struct Struct_Obj_Entry;
+struct ps_strings;
+
+extern int _DYNAMIC;
+#pragma weak _DYNAMIC
+
+extern void _fini(void);
+extern void _init(void);
+extern int main(int, char **, char **);
+extern void _start(int, char **, char **, const struct Struct_Obj_Entry *,
+ void (*)(void), struct ps_strings *);
+
+#ifdef GCRT
+extern void _mcleanup(void);
+extern void monstartup(void *, void *);
+extern int eprol;
+extern int etext;
+#endif
+
+char **environ;
+const char *__progname = "";
+struct ps_strings *__ps_strings;
+
+/* The entry function. */
+/*
+ * First 5 arguments are specified by the PowerPC SVR4 ABI.
+ * The last argument, ps_strings, is a BSD extension.
+ */
+/* ARGSUSED */
+void
+_start(int argc, char **argv, char **env,
+ const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void),
+ struct ps_strings *ps_strings)
+{
+ const char *s;
+
+ environ = env;
+
+ if (argc > 0 && argv[0] != NULL) {
+ __progname = argv[0];
+ for (s = __progname; *s != '\0'; s++)
+ if (*s == '/')
+ __progname = s + 1;
+ }
+
+ if (ps_strings != (struct ps_strings *)0)
+ __ps_strings = ps_strings;
+
+ if (&_DYNAMIC != NULL)
+ atexit(cleanup);
+ else
+ _init_tls();
+
+#ifdef GCRT
+ atexit(_mcleanup);
+#endif
+ atexit(_fini);
+#ifdef GCRT
+ monstartup(&eprol, &etext);
+#endif
+ _init();
+ exit( main(argc, argv, env) );
+}
+
+#ifdef GCRT
+__asm__(".text");
+__asm__("eprol:");
+__asm__(".previous");
+#endif
+
+__asm__(".ident\t\"$FreeBSD: projects/ppc64/lib/csu/powerpc/crt1.c 133754 2004-08-15 16:18:52Z dfr $\"");
Added: projects/ppc64/lib/csu/powerpc64/crti.S
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ppc64/lib/csu/powerpc64/crti.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -0,0 +1,67 @@
+/*-
+ * Copyright 2001 David E. O'Brien
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ .section .init,"ax", at progbits
+ .align 2
+ .globl _init
+ .section ".opd","aw"
+ .align 3
+_init:
+ .quad ._init,.TOC. at tocbase,0
+ .previous
+
+ .align 4
+ .global ._init
+ .type ._init, at function
+._init:
+ stdu 1,-48(1)
+ mflr 0
+ std 31,40(1)
+ std 0,64(1)
+ mr 31,1
+
+
+ .section .fini,"ax", at progbits
+ .align 2
+ .globl _fini
+ .section ".opd","aw"
+ .align 3
+_fini:
+ .quad ._fini,.TOC. at tocbase,0
+ .previous
+
+ .align 4
+ .global ._fini
+ .type ._fini, at function
+._fini:
+ stdu 1,-48(1)
+ mflr 0
+ std 31,40(1)
+ std 0,64(1)
+ mr 31,1
+
+
+ .section .rodata
+.ascii "$FreeBSD: projects/ppc64/lib/csu/powerpc/crti.S 96632 2002-05-15 04:19:49Z obrien $\0"
Added: projects/ppc64/lib/csu/powerpc64/crtn.S
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/ppc64/lib/csu/powerpc64/crtn.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -0,0 +1,45 @@
+/*-
+ * Copyright 2001 David E. O'Brien
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ .section .init,"ax", at progbits
+ ld 11,0(1)
+ ld 0,16(11)
+ mtlr 0
+ ld 31,-8(11)
+ mr 1,11
+ blr
+
+
+ .section .fini,"ax", at progbits
+ ld 11,0(1)
+ ld 0,16(11)
+ mtlr 0
+ ld 31,-8(11)
+ mr 1,11
+ blr
+
+
+ .section .rodata
+.ascii "$FreeBSD: projects/ppc64/lib/csu/powerpc/crtn.S 96632 2002-05-15 04:19:49Z obrien $\0"
Modified: projects/ppc64/lib/libc/gmon/gmon.c
==============================================================================
--- projects/ppc64/lib/libc/gmon/gmon.c Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/lib/libc/gmon/gmon.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -49,8 +49,10 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
-#if defined(__i386__) || defined(__sparc64__) || defined(__amd64__) || defined(__powerpc__)
+#if defined(__i386__) || defined(__sparc64__) || defined(__amd64__) || (defined(__powerpc__) && !defined(__powerpc64__))
extern char *minbrk __asm (".minbrk");
+#elif defined(__powerpc64__)
+extern char *minbrk __asm ("_minbrk");
#else
extern char *minbrk __asm ("minbrk");
#endif
Modified: projects/ppc64/lib/libc/powerpc64/Makefile.inc
==============================================================================
--- projects/ppc64/lib/libc/powerpc/Makefile.inc Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/Makefile.inc Sun Jan 24 18:56:57 2010 (r202942)
@@ -2,4 +2,4 @@
# Long double is 64-bits
MDSRCS+=machdep_ldisd.c
-SYM_MAPS+=${.CURDIR}/powerpc/Symbol.map
+SYM_MAPS+=${.CURDIR}/powerpc64/Symbol.map
Modified: projects/ppc64/lib/libc/powerpc64/SYS.h
==============================================================================
--- projects/ppc64/lib/libc/powerpc/SYS.h Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/SYS.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -43,11 +43,16 @@
.text; \
.align 2; \
2: b PIC_PLT(CNAME(HIDENAME(cerror))); \
+ nop; \
ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(x); \
.set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(.,x)); \
+ .set CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\
+ .weak CNAME(__CONCAT(._,x)); \
+ .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
_SYSCALL(x); \
bso 2b
@@ -57,19 +62,28 @@ ENTRY(__CONCAT(__sys_,x)); \
ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(._,x)); \
+ .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
_SYSCALL(x); \
bnslr; \
- b PIC_PLT(CNAME(HIDENAME(cerror)))
+ b PIC_PLT(CNAME(HIDENAME(cerror))); \
+ nop
#define RSYSCALL(x) \
.text; \
.align 2; \
2: b PIC_PLT(CNAME(HIDENAME(cerror))); \
+ nop; \
ENTRY(__CONCAT(__sys_,x)); \
.weak CNAME(x); \
.set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(.,x)); \
+ .set CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\
+ .weak CNAME(__CONCAT(._,x)); \
+ .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\
_SYSCALL(x); \
bnslr; \
- b PIC_PLT(CNAME(HIDENAME(cerror)))
+ b PIC_PLT(CNAME(HIDENAME(cerror))); \
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/Symbol.map
==============================================================================
--- projects/ppc64/lib/libc/powerpc/Symbol.map Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/Symbol.map Sun Jan 24 18:56:57 2010 (r202942)
@@ -53,7 +53,7 @@ FBSDprivate_1.0 {
__signalcontext;
__syncicache;
_end;
- .curbrk;
- .minbrk;
- .cerror;
+ _curbrk;
+ _minbrk;
+ _cerror;
};
Modified: projects/ppc64/lib/libc/powerpc64/gen/_ctx_start.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/gen/_ctx_start.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/gen/_ctx_start.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -32,12 +32,16 @@
.globl CNAME(abort)
ENTRY(_ctx_start)
+ ld %r2,8(%r14)
+ ld %r14,0(%r14)
mtlr %r14
blrl /* branch to start function */
mr %r3,%r15 /* pass pointer to ucontext as argument */
+ nop
bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */
/*
* we should never return from the
* above branch.
*/
+ nop
bl PIC_PLT(CNAME(abort)) /* abort */
Modified: projects/ppc64/lib/libc/powerpc64/gen/makecontext.c
==============================================================================
--- projects/ppc64/lib/libc/powerpc/gen/makecontext.c Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/gen/makecontext.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -79,33 +79,31 @@ __makecontext(ucontext_t *ucp, void (*st
*/
stackargs = (argc > 8) ? argc - 8 : 0;
sp = (char *) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size
- - sizeof(uint32_t)*(stackargs + 2);
- sp = (char *)((uint32_t)sp & ~0x1f);
+ - sizeof(uintptr_t)*(stackargs + 2);
+ sp = (char *)((uintptr_t)sp & ~0x1f);
mc = &ucp->uc_mcontext;
/*
- * Up to 8 register args. Assumes all args are 32-bit and
- * integer only. Not sure how to cater for floating point,
- * although 64-bit args will work if aligned correctly
- * in the arg list.
+ * Up to 8 register args. Assumes all args are 64-bit and
+ * integer only. Not sure how to cater for floating point.
*/
regargs = (argc > 8) ? 8 : argc;
va_start(ap, argc);
for (i = 0; i < regargs; i++)
- mc->mc_gpr[3 + i] = va_arg(ap, uint32_t);
+ mc->mc_gpr[3 + i] = va_arg(ap, uint64_t);
/*
* Overflow args go onto the stack
*/
if (argc > 8) {
- uint32_t *argp;
+ uint64_t *argp;
/* Skip past frame pointer and saved LR */
- argp = (uint32_t *)sp + 2;
+ argp = (uint64_t *)sp + 6;
for (i = 0; i < stackargs; i++)
- *argp++ = va_arg(ap, uint32_t);
+ *argp++ = va_arg(ap, uint64_t);
}
va_end(ap);
@@ -113,8 +111,8 @@ __makecontext(ucontext_t *ucp, void (*st
* Use caller-saved regs 14/15 to hold params that _ctx_start
* will use to invoke the user-supplied func
*/
- mc->mc_srr0 = (uint32_t) _ctx_start;
- mc->mc_gpr[1] = (uint32_t) sp; /* new stack pointer */
- mc->mc_gpr[14] = (uint32_t) start; /* r14 <- start */
- mc->mc_gpr[15] = (uint32_t) ucp; /* r15 <- ucp */
+ mc->mc_srr0 = (uintptr_t) _ctx_start;
+ mc->mc_gpr[1] = (uintptr_t) sp; /* new stack pointer */
+ mc->mc_gpr[14] = (uintptr_t) start; /* r14 <- start */
+ mc->mc_gpr[15] = (uintptr_t) ucp; /* r15 <- ucp */
}
Modified: projects/ppc64/lib/libc/powerpc64/gen/signalcontext.c
==============================================================================
--- projects/ppc64/lib/libc/powerpc/gen/signalcontext.c Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/gen/signalcontext.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -46,7 +46,7 @@ __signalcontext(ucontext_t *ucp, int sig
{
siginfo_t *sig_si;
ucontext_t *sig_uc;
- uint32_t sp;
+ uintptr_t sp;
/* Bail out if we don't have a valid ucontext pointer. */
if (ucp == NULL)
@@ -64,9 +64,9 @@ __signalcontext(ucontext_t *ucp, int sig
sig_si->si_signo = sig;
/*
- * Subtract 8 bytes from stack to allow for frameptr
+ * Subtract 48 bytes from stack to allow for frameptr
*/
- sp -= 2*sizeof(uint32_t);
+ sp -= 6*sizeof(uint64_t);
sp &= ~15UL;
/*
@@ -78,12 +78,12 @@ __signalcontext(ucontext_t *ucp, int sig
ucp->uc_mcontext.mc_vers = _MC_VERSION;
ucp->uc_mcontext.mc_len = sizeof(struct __mcontext);
- ucp->uc_mcontext.mc_srr0 = (uint32_t) ctx_wrapper;
- ucp->uc_mcontext.mc_gpr[1] = (uint32_t) sp;
- ucp->uc_mcontext.mc_gpr[3] = (uint32_t) func;
- ucp->uc_mcontext.mc_gpr[4] = (uint32_t) sig;
- ucp->uc_mcontext.mc_gpr[5] = (uint32_t) sig_si;
- ucp->uc_mcontext.mc_gpr[6] = (uint32_t) sig_uc;
+ ucp->uc_mcontext.mc_srr0 = (uint64_t) ctx_wrapper;
+ ucp->uc_mcontext.mc_gpr[1] = (uint64_t) sp;
+ ucp->uc_mcontext.mc_gpr[3] = (uint64_t) func;
+ ucp->uc_mcontext.mc_gpr[4] = (uint64_t) sig;
+ ucp->uc_mcontext.mc_gpr[5] = (uint64_t) sig_si;
+ ucp->uc_mcontext.mc_gpr[6] = (uint64_t) sig_uc;
return (0);
}
Modified: projects/ppc64/lib/libc/powerpc64/gen/syncicache.c
==============================================================================
--- projects/ppc64/lib/libc/powerpc/gen/syncicache.c Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/gen/syncicache.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -62,7 +62,7 @@ static void
getcachelinesize()
{
static int cachemib[] = { CTL_MACHDEP, CPU_CACHELINE };
- int clen;
+ long clen;
clen = sizeof(cacheline_size);
@@ -76,7 +76,7 @@ getcachelinesize()
void
__syncicache(void *from, int len)
{
- int l, off;
+ off_t l, off;
char *p;
#if !defined(_KERNEL) && !defined(_STANDALONE)
@@ -84,7 +84,7 @@ __syncicache(void *from, int len)
getcachelinesize();
#endif
- off = (u_int)from & (cacheline_size - 1);
+ off = (uintptr_t)from & (cacheline_size - 1);
l = len += off;
p = (char *)from - off;
Modified: projects/ppc64/lib/libc/powerpc64/sys/brk.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/brk.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/brk.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -36,23 +36,14 @@ __FBSDID("$FreeBSD$");
.data
HIDENAME(minbrk):
- .long CNAME(_end)
+ .llong CNAME(_end)
.text
ENTRY(brk)
-#ifdef PIC
- mflr %r10
- bl _GLOBAL_OFFSET_TABLE_ at local-4
- mflr %r9
- mtlr %r10
- lwz %r5,HIDENAME(minbrk)@got(%r9)
- lwz %r6,0(%r5)
-#else
- lis %r5,HIDENAME(minbrk)@ha
- lwz %r6,HIDENAME(minbrk)@l(%r5)
-#endif
- cmplw %r6,%r3 /* if (minbrk <= r3) */
+ ld %r5,HIDENAME(minbrk)@got(%r2)
+ ld %r6,0(%r5)
+ cmpld %r6,%r3 /* if (minbrk <= r3) */
bgt 0f
mr %r6,%r3 /* r6 = r3 */
0:
@@ -60,14 +51,10 @@ ENTRY(brk)
li %r0,SYS_break
sc /* assume, that r5 is kept */
bso 1f
-#ifdef PIC
- lwz %r7,HIDENAME(curbrk)@got(%r9)
- stw %r6,0(%r7)
-#else
- lis %r7,HIDENAME(curbrk)@ha /* record new break */
- stw %r6,HIDENAME(curbrk)@l(%r7)
-#endif
+ ld %r7,HIDENAME(curbrk)@got(%r2) /* record new break */
+ std %r6,0(%r7)
blr /* return 0 */
1:
b PIC_PLT(HIDENAME(cerror))
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/sys/cerror.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/cerror.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/cerror.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -38,18 +38,19 @@ __FBSDID("$FreeBSD$");
* programs and the initial threaded in threaded programs,
* it returns a pointer to the global errno variable.
*/
-HIDENAME(cerror):
+ENTRY(HIDENAME(cerror))
mflr %r0
- stwu %r1,-16(%r1) /* allocate new stack frame */
- stw %r0,20(%r1) /* and save lr, r31 */
- stw %r31,8(%r1)
+ stdu %r1,-56(%r1) /* allocate new stack frame */
+ std %r0,16(%r1) /* and save lr, r31 */
+ std %r31,48(%r1)
mr %r31,%r3 /* stash errval in callee-saved register */
bl PIC_PLT(CNAME(__error))
- stw %r31,0(%r3) /* store errval into &errno */
- lwz %r0,20(%r1)
- lwz %r31,8(%r1)
+ nop
+ std %r31,0(%r3) /* store errval into &errno */
+ ld %r0,16(%r1)
+ ld %r31,48(%r1)
mtlr %r0
- la %r1,16(%r1)
+ ld %r1,0(%r1)
li %r3,-1
li %r4,-1
blr /* return to callers caller */
Modified: projects/ppc64/lib/libc/powerpc64/sys/exect.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/exect.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/exect.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -37,3 +37,4 @@ ENTRY(exect)
blr
1:
b PIC_PLT(HIDENAME(cerror))
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/sys/pipe.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/pipe.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/pipe.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -41,3 +41,4 @@ ENTRY(pipe)
blr /* and return 0 */
1:
b PIC_PLT(HIDENAME(cerror))
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/sys/ptrace.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/ptrace.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/ptrace.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -32,27 +32,29 @@ __FBSDID("$FreeBSD$");
ENTRY(ptrace)
mflr %r0
- stwu %r1,-32(%r1)
- stw %r0,36(%r1)
- stw %r3,8(%r1)
- stw %r4,12(%r1)
- stw %r5,16(%r1)
- stw %r6,20(%r1)
+ stdu %r1,-68(%r1)
+ std %r0,16(%r1)
+ stw %r3,48(%r1)
+ stw %r4,52(%r1)
+ std %r5,56(%r1)
+ stw %r6,64(%r1)
bl PIC_PLT(CNAME(__error))
+ nop
li %r7,0
stw %r7,0(%r3)
- lwz %r3,8(%r1)
- lwz %r4,12(%r1)
- lwz %r5,16(%r1)
- lwz %r0,36(%r1)
- lwz %r6,20(%r1)
+ lwz %r3,48(%r1)
+ lwz %r4,52(%r1)
+ ld %r5,56(%r1)
+ ld %r0,16(%r1)
+ lwz %r6,64(%r1)
mtlr %r0
- la %r1,32(%r1)
+ ld %r1,0(%r1)
li %r0,SYS_ptrace
sc
bso 1f
blr
1:
b PIC_PLT(HIDENAME(cerror))
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/sys/sbrk.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/sbrk.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/sbrk.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -35,36 +35,23 @@ __FBSDID("$FreeBSD$");
.data
HIDENAME(curbrk):
- .long CNAME(_end)
+ .llong CNAME(_end)
.text
ENTRY(sbrk)
-
-#ifdef PIC
- mflr %r10
- bl _GLOBAL_OFFSET_TABLE_ at local-4
- mflr %r5
- mtlr %r10
- lwz %r5,HIDENAME(curbrk)@got(%r5)
- lwz %r6,0(%r5)
-#else
- lis %r5,HIDENAME(curbrk)@ha
- lwz %r6,HIDENAME(curbrk)@l(%r5) /* r6 = old break */
-#endif
- cmpwi %r3,0 /* sbrk(0) - return curbrk */
+ ld %r5,HIDENAME(curbrk)@got(%r2)
+ ld %r6,0(%r5) /* r6 = old break */
+ cmpdi %r3,0 /* sbrk(0) - return curbrk */
beq 1f
add %r3,%r3,%r6
mr %r7,%r3 /* r7 = new break */
li %r0,SYS_break
sc /* break(new_break) */
bso 2f
-#ifdef PIC
- stw %r7,0(%r5)
-#else
- stw %r7,HIDENAME(curbrk)@l(%r5) /* record new break */
-#endif
+ std %r7,0(%r5)
1:
mr %r3,%r6 /* set return value */
blr
2:
b PIC_PLT(HIDENAME(cerror))
+ nop
Modified: projects/ppc64/lib/libc/powerpc64/sys/setlogin.S
==============================================================================
--- projects/ppc64/lib/libc/powerpc/sys/setlogin.S Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libc/powerpc64/sys/setlogin.S Sun Jan 24 18:56:57 2010 (r202942)
@@ -33,17 +33,7 @@ __FBSDID("$FreeBSD$");
.globl CNAME(_logname_valid) /* in _getlogin() */
SYSCALL(setlogin)
-#ifdef PIC
- mflr %r10
- bl _GLOBAL_OFFSET_TABLE_ at local-4
- mflr %r4
- lwz %r4,CNAME(_logname_valid)@got(%r4)
+ ld %r4,CNAME(_logname_valid)@got(%r2)
li %r5,%r0
- stw %r5,0(%r4)
- mtlr %r10
-#else
- lis %r4,CNAME(_logname_valid)@ha
- li %r5,0
- stw %r5,CNAME(_logname_valid)@l(%r4)
-#endif
+ std %r5,0(%r4)
blr
Modified: projects/ppc64/lib/libc/stdlib/malloc.c
==============================================================================
--- projects/ppc64/lib/libc/stdlib/malloc.c Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/lib/libc/stdlib/malloc.c Sun Jan 24 18:56:57 2010 (r202942)
@@ -250,7 +250,10 @@ __FBSDID("$FreeBSD$");
# define SIZEOF_PTR_2POW 2
# define NO_TLS
#endif
-#ifdef __powerpc__
+#ifdef __powerpc64__
+# define QUANTUM_2POW 4
+# define SIZEOF_PTR_2POW 3
+#elif defined(__powerpc__)
# define QUANTUM_2POW 4
# define SIZEOF_PTR_2POW 2
#endif
Modified: projects/ppc64/lib/libthr/arch/powerpc64/include/pthread_md.h
==============================================================================
--- projects/ppc64/lib/libthr/arch/powerpc/include/pthread_md.h Tue Jan 19 20:36:15 2010 (r202650)
+++ projects/ppc64/lib/libthr/arch/powerpc64/include/pthread_md.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -39,7 +39,7 @@
#define CPU_SPINWAIT
#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
-#define TP_OFFSET 0x7008
+#define TP_OFFSET 0x8000
/*
* Variant I tcb. The structure layout is fixed, don't blindly
@@ -57,7 +57,7 @@ void _tcb_dtor(struct tcb *);
static __inline void
_tcb_set(struct tcb *tcb)
{
- register uint8_t *_tp __asm__("%r2");
+ register uint8_t *_tp __asm__("%r13");
__asm __volatile("mr %0,%1" : "=r"(_tp) :
"r"((uint8_t *)tcb + TP_OFFSET));
@@ -66,7 +66,7 @@ _tcb_set(struct tcb *tcb)
static __inline struct tcb *
_tcb_get(void)
{
- register uint8_t *_tp __asm__("%r2");
+ register uint8_t *_tp __asm__("%r13");
return ((struct tcb *)(_tp - TP_OFFSET));
}
Copied and modified: projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc64.h (from r202650, projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc.h)
==============================================================================
--- projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc.h Tue Jan 19 20:36:15 2010 (r202650, copy source)
+++ projects/ppc64/secure/lib/libcrypto/opensslconf-powerpc64.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -110,13 +110,13 @@
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
* %20 speed up (longs are 8 bytes, int's are 4). */
#ifndef DES_LONG
-#define DES_LONG unsigned long
+#define DES_LONG unsigned int
#endif
#endif
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
#define CONFIG_HEADER_BN_H
-#define BN_LLONG
+#undef BN_LLONG
/* Should we define BN_DIV2W here? */
@@ -124,9 +124,9 @@
/* The prime number generation stuff may not work when
* EIGHT_BIT but I don't care since I've only used this mode
* for debuging the bignum libraries */
-#undef SIXTY_FOUR_BIT_LONG
+#define SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
-#define THIRTY_TWO_BIT
+#undef THIRTY_TWO_BIT
#undef SIXTEEN_BIT
#undef EIGHT_BIT
#endif
Modified: projects/ppc64/sys/powerpc/include/asm.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/asm.h Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/sys/powerpc/include/asm.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -53,9 +53,18 @@
#define PIC_GOT(x) x
#endif
+#ifdef __powerpc64__
+#undef PIC_PLT
+#define PIC_PLT(x) __CONCAT(.,x)
+#endif
+
#define CNAME(csym) csym
#define ASMNAME(asmsym) asmsym
+#ifdef __powerpc64__
+#define HIDENAME(asmsym) __CONCAT(_,asmsym)
+#else
#define HIDENAME(asmsym) __CONCAT(.,asmsym)
+#endif
#define _GLOBAL(x) \
.data; .align 2; .globl x; x:
Modified: projects/ppc64/sys/powerpc/include/profile.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/profile.h Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/sys/powerpc/include/profile.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -36,7 +36,7 @@
#define FUNCTION_ALIGNMENT 16
-typedef u_int fptrdiff_t;
+typedef __ptrdiff_t fptrdiff_t;
/*
* The mcount trampoline macro, expanded in libc/gmon/mcount.c
@@ -75,6 +75,13 @@ typedef u_int fptrdiff_t;
* to be restored to what it was on entry to the profiled routine.
*/
+#ifdef __powerpc64__
+/* XXX not implemented */
+
+#define MCOUNT int _mcount(void) {return (0);}
+
+#else
+
#ifdef PIC
#define _PLT "@plt"
#else
@@ -115,6 +122,7 @@ __asm( " .globl _mcount \n" \
" bctr \n" \
"_mcount_end: \n" \
" .size _mcount,_mcount_end-_mcount");
+#endif
#ifdef _KERNEL
#define MCOUNT_ENTER(s) s = intr_disable()
Modified: projects/ppc64/sys/sys/cdefs.h
==============================================================================
--- projects/ppc64/sys/sys/cdefs.h Sun Jan 24 18:18:52 2010 (r202941)
+++ projects/ppc64/sys/sys/cdefs.h Sun Jan 24 18:56:57 2010 (r202942)
@@ -356,9 +356,17 @@
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
#ifdef __STDC__
+#ifdef __powerpc64__
+#define __weak_reference(sym,alias) \
+ __asm__(".weak " #alias); \
+ __asm__(".equ " #alias ", " #sym); \
+ __asm__(".weak ." #alias); \
+ __asm__(".equ ." #alias ", ." #sym)
+#else
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
+#endif
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
More information about the svn-src-projects
mailing list