First round at ia64 csu
This commit is contained in:
parent
b96fedac26
commit
b8ee9baf67
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.1 2006/07/02 17:15:22 cherry Exp $
|
||||
|
||||
#Uncomment the next line to enable the new .init fallthru
|
||||
CPPFLAGS+= -I- -I${.CURDIR}
|
||||
|
||||
.include "${.CURDIR}/../common_elf/Makefile.inc"
|
|
@ -0,0 +1,98 @@
|
|||
/* $NetBSD: crt0.c,v 1.1 2006/07/02 17:15:22 cherry Exp $ */
|
||||
|
||||
/*
|
||||
* 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 "common.h"
|
||||
|
||||
void __start __P((char **, void (*cleanup) __P((void)), const Obj_Entry *,
|
||||
struct ps_strings *));
|
||||
|
||||
void
|
||||
__start(sp, cleanup, obj, ps_strings)
|
||||
char **sp;
|
||||
void (*cleanup) __P((void)); /* from shared loader */
|
||||
const Obj_Entry *obj; /* from shared loader */
|
||||
struct ps_strings *ps_strings;
|
||||
{
|
||||
long argc;
|
||||
char **argv, *namep;
|
||||
|
||||
__asm __volatile__ ("1: \
|
||||
{ .mii \
|
||||
mov r15=@gprel(1b) \n \
|
||||
mov r16=ip ;; \n \
|
||||
sub gp=r16,r15 \n \
|
||||
;; \
|
||||
} ");
|
||||
|
||||
argc = *(long *)sp;
|
||||
argv = sp + 1;
|
||||
environ = sp + 2 + argc; /* 2: argc + NULL ending argv */
|
||||
|
||||
if ((namep = argv[0]) != NULL) { /* NULL ptr if argc = 0 */
|
||||
if ((__progname = _strrchr(namep, '/')) == NULL)
|
||||
__progname = namep;
|
||||
else
|
||||
__progname++;
|
||||
}
|
||||
|
||||
if (ps_strings != (struct ps_strings *)0 &&
|
||||
ps_strings != (struct ps_strings *)0xbabefacedeadbeef) /* XXX: Debug: see machdep.c:setregs() */
|
||||
__ps_strings = ps_strings;
|
||||
|
||||
#ifdef DYNAMIC
|
||||
if (&_DYNAMIC != NULL)
|
||||
_rtld_setup(cleanup, obj);
|
||||
#endif
|
||||
|
||||
#ifdef MCRT0
|
||||
atexit(_mcleanup);
|
||||
monstartup((u_long)&_eprol, (u_long)&_etext);
|
||||
#endif
|
||||
|
||||
atexit(_fini);
|
||||
_init();
|
||||
|
||||
exit(main(argc, argv, environ)); /* XXX: ia64 ABI says 4 parameters. */
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
|
||||
*/
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: crt0.c,v 1.1 2006/07/02 17:15:22 cherry Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "common.c"
|
|
@ -0,0 +1,81 @@
|
|||
/* $NetBSD: dot_init.h,v 1.1 2006/07/02 17:15:22 cherry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Ross Harvey
|
||||
* 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 by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 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 <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
#include <machine/asm.h>
|
||||
|
||||
|
||||
#define INIT_FALLTHRU_DECL void init_fallthru(void)
|
||||
#define FINI_FALLTHRU_DECL void fini_fallthru(void)
|
||||
|
||||
#define INIT_FALLTHRU() init_fallthru()
|
||||
#define FINI_FALLTHRU() fini_fallthru()
|
||||
|
||||
/*-
|
||||
* $FreeBSD: src/lib/csu/ia64/crti.S,v 1.3 2001/11/03 06:31:27 peter Exp $
|
||||
*/
|
||||
|
||||
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
|
||||
__asm ( \
|
||||
".section "#sect",\"ax\",@progbits \n" \
|
||||
".proc "#entry_pt" \n" \
|
||||
#entry_pt": \n" \
|
||||
".regstk 0,2,0,0 \n" \
|
||||
".prologue 12,loc0 \n" \
|
||||
".save ar.pfs,loc1 \n" \
|
||||
"alloc loc1=ar.pfs,0,2,0,0 \n" \
|
||||
"mov loc0=b0 /* Save return addr */ \n" \
|
||||
".previous")
|
||||
|
||||
/*-
|
||||
* $FreeBSD: src/lib/csu/ia64/crtn.S,v 1.2 2001/10/29 10:18:58 peter Exp $
|
||||
*/
|
||||
|
||||
#define MD_SECTION_EPILOGUE(sect) \
|
||||
__asm ( \
|
||||
".section "#sect",\"ax\",@progbits \n" \
|
||||
".regstk 0,2,0,0 \n" \
|
||||
"mov b0=loc0 /*Recover return addr*/ \n" \
|
||||
"mov ar.pfs=loc1 \n" \
|
||||
"br.ret.sptk.many b0 \n" \
|
||||
".previous")
|
||||
|
||||
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
|
||||
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
|
||||
|
||||
#define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
|
||||
#define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
|
||||
|
||||
#define MD_DO_NOT_NEED_FALLTHRU
|
Loading…
Reference in New Issue