xref: /minix3/lib/csu/arch/sh3/crti.S (revision f14fb602092e015ff630df58e17c2a9cd57d29b3)
1*f14fb602SLionel Sambuc/* $NetBSD: crti.S,v 1.3 2012/01/31 20:12:47 uwe Exp $ */
2e83f7ba2SBen Gras
3e83f7ba2SBen Gras/*-
4e83f7ba2SBen Gras * Copyright (c) 2001 Ross Harvey
5e83f7ba2SBen Gras * All rights reserved.
6e83f7ba2SBen Gras *
7e83f7ba2SBen Gras * Redistribution and use in source and binary forms, with or without
8e83f7ba2SBen Gras * modification, are permitted provided that the following conditions
9e83f7ba2SBen Gras * are met:
10e83f7ba2SBen Gras * 1. Redistributions of source code must retain the above copyright
11e83f7ba2SBen Gras *    notice, this list of conditions and the following disclaimer.
12e83f7ba2SBen Gras * 2. Redistributions in binary form must reproduce the above copyright
13e83f7ba2SBen Gras *    notice, this list of conditions and the following disclaimer in the
14e83f7ba2SBen Gras *    documentation and/or other materials provided with the distribution.
15e83f7ba2SBen Gras * 3. All advertising materials mentioning features or use of this software
16e83f7ba2SBen Gras *    must display the following acknowledgement:
17e83f7ba2SBen Gras *	This product includes software developed by the NetBSD
18e83f7ba2SBen Gras *	Foundation, Inc. and its contributors.
19e83f7ba2SBen Gras * 4. Neither the name of The NetBSD Foundation nor the names of its
20e83f7ba2SBen Gras *    contributors may be used to endorse or promote products derived
21e83f7ba2SBen Gras *    from this software without specific prior written permission.
22e83f7ba2SBen Gras *
23e83f7ba2SBen Gras * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24e83f7ba2SBen Gras * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25e83f7ba2SBen Gras * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26e83f7ba2SBen Gras * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27e83f7ba2SBen Gras * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28e83f7ba2SBen Gras * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29e83f7ba2SBen Gras * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30e83f7ba2SBen Gras * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31e83f7ba2SBen Gras * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32e83f7ba2SBen Gras * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33e83f7ba2SBen Gras * POSSIBILITY OF SUCH DAMAGE.
34e83f7ba2SBen Gras */
35e83f7ba2SBen Gras
36e83f7ba2SBen Gras#include <machine/asm.h>
37e83f7ba2SBen Gras
38*f14fb602SLionel SambucRCSID("$NetBSD: crti.S,v 1.3 2012/01/31 20:12:47 uwe Exp $")
39e83f7ba2SBen Gras
40e83f7ba2SBen Gras#include "sysident.S"
41e83f7ba2SBen Gras
42*f14fb602SLionel Sambuc
43*f14fb602SLionel Sambuc/*
44*f14fb602SLionel Sambuc * Provide function prologues for the code in .init and .fini sections.
45*f14fb602SLionel Sambuc * Corresponding epilogues are in crtn.S
46*f14fb602SLionel Sambuc */
47*f14fb602SLionel Sambuc
48e83f7ba2SBen Gras	.section ".init", "ax", @progbits
49*f14fb602SLionel Sambuc	.p2align 2
50e83f7ba2SBen Gras	.globl _init
51e83f7ba2SBen Gras_init:
52e83f7ba2SBen Gras	mov.l	r14, @-sp
53e83f7ba2SBen Gras	sts.l	pr, @-sp
54e83f7ba2SBen Gras	mov	sp, r14
55e83f7ba2SBen Gras
56e83f7ba2SBen Gras	.section ".fini", "ax", @progbits
57*f14fb602SLionel Sambuc	.p2align 2
58e83f7ba2SBen Gras	.globl _fini
59e83f7ba2SBen Gras_fini:
60e83f7ba2SBen Gras	mov.l	r14, @-sp
61e83f7ba2SBen Gras	sts.l	pr, @-sp
62e83f7ba2SBen Gras	mov	sp, r14
63