Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/csu/arch Add support for sparc and sparc64



details:   https://anonhg.NetBSD.org/src/rev/de0a55b57078
branches:  trunk
changeset: 787881:de0a55b57078
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 11 06:57:15 2013 +0000

description:
Add support for sparc and sparc64

diffstat:

 lib/csu/arch/sparc/Makefile.inc   |   4 +-
 lib/csu/arch/sparc/crt0.S         |  23 ++++++-----
 lib/csu/arch/sparc/crtbegin.h     |  40 ++++++++++++++++++++
 lib/csu/arch/sparc/crtend.S       |  55 +++++++++++++++++++++++++++
 lib/csu/arch/sparc64/Makefile.inc |   5 ++
 lib/csu/arch/sparc64/crt0.S       |  60 ++++++++++++++++++++++++++++++
 lib/csu/arch/sparc64/crtbegin.h   |  40 ++++++++++++++++++++
 lib/csu/arch/sparc64/crtend.S     |  55 +++++++++++++++++++++++++++
 lib/csu/arch/sparc64/crti.S       |  78 +++++++++++++++++++++++++++++++++++++++
 lib/csu/arch/sparc64/crtn.S       |  74 +++++++++++++++++++++++++++++++++++++
 10 files changed, 421 insertions(+), 13 deletions(-)

diffs (truncated from 491 to 300 lines):

diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc/Makefile.inc
--- a/lib/csu/arch/sparc/Makefile.inc   Thu Jul 11 05:55:13 2013 +0000
+++ b/lib/csu/arch/sparc/Makefile.inc   Thu Jul 11 06:57:15 2013 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.2 2013/07/11 06:57:15 martin Exp $
 
-CPPFLAGS+=     -DELFSIZE=32
+CPPFLAGS+=     -DELFSIZE=32 -I${ARCHDIR}
 
 
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc/crt0.S
--- a/lib/csu/arch/sparc/crt0.S Thu Jul 11 05:55:13 2013 +0000
+++ b/lib/csu/arch/sparc/crt0.S Thu Jul 11 06:57:15 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,20 +37,21 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
+RCSID("$NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $")
 
 STRONG_ALIAS(_start,__start)
 
+       ! called with:
+       !  %g3 = cleanup
+       !  %g2 = obj
+       !  %g1 = ps_strings
+       ! call: ___start(cleanup, obj, ps_strings)
 _ENTRY(__start)
        mov     0, %fp
-       ld      [%sp + 64], %o0         ! get argc
-       add     %sp, 68, %o1            ! get argv
-       sll     %o0, 2, %o2             !
-       add     %o2, 4, %o2             ! envp = argv + (argc << 2) + 4
-       add     %o1, %o2, %o2           !
-       andn    %sp, 7, %sp             ! align
+       andn    %sp, 7, %sp             ! align stack
        sub     %sp, 24, %sp            ! expand to standard stack frame size
-       mov     %g3, %o3
-       mov     %g2, %o4
+       mov     %g3, %o0
+       mov     %g2, %o1
        call    ___start
-        mov    %g1, %o5
+        mov    %g1, %o2
+
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc/crtbegin.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc/crtbegin.h     Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+__asm( "\n\t"
+       ".pushsection .init, \"ax\", @progbits"                 "\n\t"
+       "call   __do_global_ctors_aux"                          "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
+
+__asm( "\n\t"
+       ".pushsection .fini, \"ax\", @progbits" "\n\t"
+       "call   __do_global_dtors_aux"                          "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc/crtend.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc/crtend.S       Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,55 @@
+/*     $NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $        */
+/*-
+ * Copyright (c) 2010 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
+
+       .section        .ctors, "aw", @progbits
+       .align 4
+       .global         __CTOR_LIST_END__
+       .hidden         __CTOR_LIST_END__
+__CTOR_LIST_END__:
+       .long 0
+
+       .section        .dtors, "aw", @progbits
+       .align 4
+       .global         __DTOR_LIST_END__
+       .hidden         __DTOR_LIST_END__
+__DTOR_LIST_END__:
+       .long 0
+
+       .section        .eh_frame, "a", @progbits
+       .align 4
+       .long 0
+
+       .section        .jcr, "aw", @progbits
+       .align 4
+       .long 0
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc64/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc64/Makefile.inc Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile.inc,v 1.1 2013/07/11 06:57:15 martin Exp $
+
+CPPFLAGS+=     -DELFSIZE=64 -I${ARCHDIR}
+
+
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc64/crt0.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc64/crt0.S       Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,60 @@
+/* $NetBSD: crt0.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
+
+/*
+ * Copyright (c) 1998 Christos Zoulas
+ * 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
+ *          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.
+ * 
+ * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: crt0.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
+
+STRONG_ALIAS(_start,__start)
+
+       .align 4
+       .register %g3,#scratch
+       .register %g2,#scratch
+
+       ! called with:
+       !  %g3 = cleanup
+       !  %g2 = obj
+       !  %g1 = ps_strings
+       ! call: ___start(cleanup, obj, ps_strings)
+_ENTRY(__start)
+       clr     %fp
+       clr     %g4                     ! data base for some memory models
+       mov     %g3, %o0
+       mov     %g2, %o1
+       ba,pt   %icc,___start
+        mov    %g1, %o2
+
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc64/crtbegin.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc64/crtbegin.h   Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+__asm( "\n\t"
+       ".pushsection .init, \"ax\", @progbits"                 "\n\t"
+       "call __do_global_ctors_aux"                            "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
+
+__asm( "\n\t"
+       ".pushsection .fini, \"ax\", @progbits"                 "\n\t"
+       "call __do_global_dtors_aux"                            "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
diff -r 5f1d974def12 -r de0a55b57078 lib/csu/arch/sparc64/crtend.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/sparc64/crtend.S     Thu Jul 11 06:57:15 2013 +0000
@@ -0,0 +1,55 @@
+/*     $NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $        */
+/*-
+ * Copyright (c) 2010 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``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
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS 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



Home | Main Index | Thread Index | Old Index