Source-Changes-HG archive

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

[src/trunk]: src/lib/csu/arch/hppa Add crtstuff for hppa. Lightly tested.



details:   https://anonhg.NetBSD.org/src/rev/adcbaee362fe
branches:  trunk
changeset: 787919:adcbaee362fe
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jul 13 18:52:35 2013 +0000

description:
Add crtstuff for hppa. Lightly tested.

diffstat:

 lib/csu/arch/hppa/Makefile.inc |   3 +
 lib/csu/arch/hppa/crt0.S       |  67 ++++++++++++++++++++++++++++++++++++++++++
 lib/csu/arch/hppa/crtbegin.h   |  43 ++++++++++++++++++++++++++
 lib/csu/arch/hppa/crtend.S     |  56 +++++++++++++++++++++++++++++++++++
 lib/csu/arch/hppa/crti.S       |  55 ++++++++++++++++++++++++++++++++++
 lib/csu/arch/hppa/crtn.S       |  46 ++++++++++++++++++++++++++++
 6 files changed, 270 insertions(+), 0 deletions(-)

diffs (294 lines):

diff -r 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/Makefile.inc    Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,3 @@
+#      $NetBSD: Makefile.inc,v 1.1 2013/07/13 18:52:35 skrll Exp $
+
+CPPFLAGS+=     -DELFSIZE=32 -I${ARCHDIR}
diff -r 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/crt0.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/crt0.S  Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,67 @@
+/*     $NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $   */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
+
+       .import _GLOBAL_OFFSET_TABLE_
+       .hidden ___start
+
+STRONG_ALIAS(__start,_start)
+
+/*
+ * void _start(struct ps_strings *ps_strings,
+ *    void (*cleanup)(void),
+ *    const Obj_Entry *obj);
+ */
+_ENTRY(_start)
+       .callinfo frame=0, calls
+       .entry
+
+       bl      L$lpc, %r27
+       depi    0, 31, 2, %r27
+L$lpc: addil   L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8), %r27
+       ldo     R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%r1),%r27
+       copy    %r27, %r19
+
+       /*
+        * void ___start(void (*cleanup)(void),
+        *    const Obj_Entry *obj,
+        *    struct ps_strings *ps_strings);
+        */
+       copy    %arg0, %arg3            ; ps_strings -> tmp
+       copy    %arg1, %arg0            ; cleanup -> arg0
+       copy    %arg2, %arg1            ; obj -> arg1
+       b       ___start
+       copy    %arg3, %arg2            ; ps_strings (tmp) -> arg2
+
+EXIT(_start)
diff -r 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/crtbegin.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/crtbegin.h      Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,43 @@
+/*     $NetBSD*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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"
+       "bl __do_global_ctors_aux, %rp"                         "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
+
+__asm( "\n\t"
+       ".pushsection .fini, \"ax\", @progbits"                 "\n\t"
+       "bl __do_global_dtors_aux, %rp"                         "\n\t"
+       " nop"                                                  "\n\t"
+       ".popsection");
+
diff -r 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/crtend.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/crtend.S        Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,56 @@
+/*     $NetBSD: crtend.S,v 1.1 2013/07/13 18:52:35 skrll 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/13 18:52:35 skrll 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 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/crti.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/crti.S  Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,55 @@
+/*     $NetBSD: crti.S,v 1.1 2013/07/13 18:52:35 skrll Exp $   */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: crti.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
+
+#include "sysident.S"
+
+#define        MD_SECTION_PROLOGUE(sect, entry_pt)                     \
+       .section sect,"ax",@progbits                            ! \
+       .global entry_pt                                        ! \
+       .proc                                                   ! \
+       .callinfo frame=HPPA_FRAME_SIZE, calls, save_rp, save_sp, entry_gr=3 ! \
+       .entry                                                  ! \
+       entry_pt:                                               ! \
+       stw     %rp, HPPA_FRAME_CRP(%sp)                        ! \
+       copy    %r3, %r1                                        ! \
+       copy    %sp, %r3                                        ! \
+       stw,ma  %r1, HPPA_FRAME_SIZE(%sp)                       ! \
+       /* fall thru */                                         ! \
+       .exit                                                   ! \
+       .procend                                                ! \
+       .previous
+
+MD_SECTION_PROLOGUE(.init, _init)
+MD_SECTION_PROLOGUE(.fini, _fini)
diff -r 7f29feb13674 -r adcbaee362fe lib/csu/arch/hppa/crtn.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/arch/hppa/crtn.S  Sat Jul 13 18:52:35 2013 +0000
@@ -0,0 +1,46 @@
+/*     $NetBSD: crtn.S,v 1.1 2013/07/13 18:52:35 skrll Exp $   */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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.
+ */
+
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: crtn.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
+
+#define        MD_SECTION_EPILOGUE(sect)                       \
+       .section #sect,"ax",@progbits                   ! \
+       ldw     HPPA_FRAME_CRP(%r3) ,%rp                ! \
+       ldo     HPPA_FRAME_SIZE(%r3), %sp               ! \
+       ldw,mb  -HPPA_FRAME_SIZE(%sp), %r3              ! \
+       bv,n    %r0(%rp)                                ! \
+       .previous
+
+MD_SECTION_EPILOGUE(.init)
+MD_SECTION_EPILOGUE(.fini)



Home | Main Index | Thread Index | Old Index