Module Name: src Committed By: skrll Date: Sat Jul 13 18:52:35 UTC 2013
Added Files: src/lib/csu/arch/hppa: Makefile.inc crt0.S crtbegin.h crtend.S crti.S crtn.S Log Message: Add crtstuff for hppa. Lightly tested. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/hppa/Makefile.inc \ src/lib/csu/arch/hppa/crt0.S src/lib/csu/arch/hppa/crtbegin.h \ src/lib/csu/arch/hppa/crtend.S src/lib/csu/arch/hppa/crti.S \ src/lib/csu/arch/hppa/crtn.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Added files: Index: src/lib/csu/arch/hppa/Makefile.inc diff -u /dev/null src/lib/csu/arch/hppa/Makefile.inc:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/Makefile.inc Sat Jul 13 18:52:35 2013 @@ -0,0 +1,3 @@ +# $NetBSD: Makefile.inc,v 1.1 2013/07/13 18:52:35 skrll Exp $ + +CPPFLAGS+= -DELFSIZE=32 -I${ARCHDIR} Index: src/lib/csu/arch/hppa/crt0.S diff -u /dev/null src/lib/csu/arch/hppa/crt0.S:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/crt0.S Sat Jul 13 18:52:35 2013 @@ -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) Index: src/lib/csu/arch/hppa/crtbegin.h diff -u /dev/null src/lib/csu/arch/hppa/crtbegin.h:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/crtbegin.h Sat Jul 13 18:52:35 2013 @@ -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"); + Index: src/lib/csu/arch/hppa/crtend.S diff -u /dev/null src/lib/csu/arch/hppa/crtend.S:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/crtend.S Sat Jul 13 18:52:35 2013 @@ -0,0 +1,56 @@ +/* $NetBSD: crtend.S,v 1.1 2013/07/13 18:52:35 skrll Exp $ */ + +/*- + * Copyright (c) 2010 Joerg Sonnenberger <jo...@netbsd.org> + * 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 Index: src/lib/csu/arch/hppa/crti.S diff -u /dev/null src/lib/csu/arch/hppa/crti.S:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/crti.S Sat Jul 13 18:52:35 2013 @@ -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) Index: src/lib/csu/arch/hppa/crtn.S diff -u /dev/null src/lib/csu/arch/hppa/crtn.S:1.1 --- /dev/null Sat Jul 13 18:52:35 2013 +++ src/lib/csu/arch/hppa/crtn.S Sat Jul 13 18:52:35 2013 @@ -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)