summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/cpu/powerpc/rtems.s
blob: 87d0f093a76b451253144c22b4ffd134a77aaeaf (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*  rtems.s
 *
 *  This file contains the single entry point code for
 *  the PowerPC implementation of RTEMS.
 *
 *  Author:	Andrew Bray <andy@i-cubed.demon.co.uk>
 *
 *  COPYRIGHT (c) 1995 by i-cubed ltd.
 *
 *  To anyone who acknowledges that this file is provided "AS IS"
 *  without any express or implied warranty:
 *      permission to use, copy, modify, and distribute this file
 *      for any purpose is hereby granted without fee, provided that
 *      the above copyright notice and this notice appears in all
 *      copies, and that the name of i-cubed limited not be used in
 *      advertising or publicity pertaining to distribution of the
 *      software without specific, written prior permission.
 *      i-cubed limited makes no representations about the suitability
 *      of this software for any purpose.
 *
 *  Derived from c/src/exec/cpu/no_cpu/rtems.c:
 *
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
 *  On-Line Applications Research Corporation (OAR).
 *  All rights assigned to U.S. Government, 1994.
 *
 *  This material may be reproduced by or for the U.S. Government pursuant
 *  to the copyright license under the clause at DFARS 252.227-7013.  This
 *  notice must appear in all copies of this file and its derivatives.
 *
 */

#include "asm.h"

	BEGIN_CODE
/*
 *  RTEMS
 *
 *  This routine jumps to the directive indicated in r11.
 *  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.
 */

	ALIGN (4, 2)
	PUBLIC_PROC (RTEMS)
PROC (RTEMS):
#if (PPC_ABI == PPC_ABI_POWEROPEN)
	mflr	r0
	stw	r0, 8(r1)
	stwu	r1, -64(r1)

	/* Establish addressing */
	bl	base
base:
	mflr	r12
	addi	r12, r12, tabaddr - base

	lwz	r12, Entry_points-abase(r12)
	slwi	r11, r11, 2
	lwzx	r12, r12, r11

	stw	r2, 56(r1)
	lwz	r0, 0(r12)
	mtlr	r0
	lwz	r2, 4(r12)
	lwz	r11, 8(r12)
	blrl
	lwz	r2, 56(r1)
	addi	r1, r1, 64
	lwz	r0, 8(r1)
	mtlr	r0
#else
	mflr	r0
	stw	r0, 4(r1)
	stwu	r1, -16(r1)

	/* Establish addressing */
	bl	base
base:
	mflr	r12
	addi	r12, r12, tabaddr - base

	lwz	r12, Entry_points-abase(r12)
	slwi	r11, r11, 2
	lwzx	r11, r12, r11

	stw	r2, 8(r1)
#if (PPC_ABI != PPC_ABI_GCC27)
	stw	r13, 12(r1)
#endif
	mtlr	r11
	lwz	r11, irqinfo-abase(r12)
	lwz	r2, 0(r11)
#if (PPC_ABI != PPC_ABI_GCC27)
	lwz	r13, 4(r11)
#endif
	blrl
	lwz	r2, 8(r1)
#if (PPC_ABI != PPC_ABI_GCC27)
	lwz	r13, 12(r1)
#endif
	addi	r1, r1, 16
	lwz	r0, 4(r1)
	mtlr	r0
#endif
	blr


	/* Addressability stuff */
tabaddr:
abase:
	EXTERN_VAR (_Entry_points)
Entry_points:
	EXT_SYM_REF (_Entry_points)
#if (PPC_ABI != PPC_ABI_POWEROPEN)
	EXTERN_VAR (_CPU_IRQ_info)
irqinfo:
	EXT_SYM_REF (_CPU_IRQ_info)
#endif

#if (PPC_ABI == PPC_ABI_POWEROPEN)
	DESCRIPTOR (RTEMS)
#endif