summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/cpu/sparc/rtems.S
blob: ac7c66c7296c27f92d9825442974f7b633d56bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*  rtems.s
 *
 *  This file contains the single entry point code for
 *  the SPARC port of RTEMS.
 *
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */

#include <asm.h>

/*
 *  RTEMS
 *
 *  This routine jumps to the directive indicated in the
 *  CPU defined register.  This routine is used when RTEMS is
 *  linked by itself and placed in ROM.  This routine is the
 *  first address in the ROM space for RTEMS.  The user "calls"
 *  this address with the directive arguments in the normal place.
 *  This routine then jumps indirectly to the correct directive
 *  preserving the arguments.  The directive should not realize
 *  it has been "wrapped" in this way.  The table "_Entry_points"
 *  is used to look up the directive.
 *  
 *  void RTEMS()
 */

        .align 4
        PUBLIC(RTEMS)
SYM(RTEMS):
        /*
         *  g2 was chosen because gcc uses it as a scratch register in 
         *  similar code scenarios and the other locals, ins, and outs
         *  are off limits to this routine unless it does a "save" and
         *  copies its in registers to the outs which only works up until
         *  6 parameters.  Best to take the simple approach in this case.
         */
        sethi     SYM(_Entry_points), %g2
        or        %g2, %lo(SYM(_Entry_points)), %g2
        sll       %g1, 2,  %g1
        add       %g1, %g2, %g2
        jmp       %g2
        nop