2 /* $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ */
5 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
8 * Author: Chris G. Demetriou
10 * Permission to use, copy, modify and distribute this software and
11 * its documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
20 * Carnegie Mellon requests users of this software to return to
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
31 #include <machine/asm.h>
34 /**************************************************************************/
38 * System arithmetic trap entry point.
41 PALVECT(XentArith) /* setup frame, save registers */
43 /* a0, a1, & a2 already set up */
44 ldiq a3, ALPHA_KENTRY_ARITH
45 mov sp, a4 ; .loc 1 __LINE__
48 jmp zero, exception_return
51 /**************************************************************************/
55 * System instruction fault trap entry point.
58 PALVECT(XentIF) /* setup frame, save registers */
60 /* a0, a1, & a2 already set up */
61 ldiq a3, ALPHA_KENTRY_IF
62 mov sp, a4 ; .loc 1 __LINE__
64 jmp zero, exception_return
67 /**************************************************************************/
71 * System interrupt entry point.
74 PALVECT(XentInt) /* setup frame, save registers */
76 /* a0, a1, & a2 already set up */
77 mov sp, a3 ; .loc 1 __LINE__
79 jmp zero, exception_return
82 /**************************************************************************/
86 * System memory management fault entry point.
89 PALVECT(XentMM) /* setup frame, save registers */
91 /* a0, a1, & a2 already set up */
92 ldiq a3, ALPHA_KENTRY_MM
93 mov sp, a4 ; .loc 1 __LINE__
96 jmp zero, exception_return
99 /**************************************************************************/
103 * System call entry point.
106 ESETUP(XentSys) ; .loc 1 __LINE__
108 stq v0,(FRAME_V0*8)(sp) /* in case we need to restart */
109 stq s0,(FRAME_S0*8)(sp)
110 stq s1,(FRAME_S1*8)(sp)
111 stq s2,(FRAME_S2*8)(sp)
112 stq s3,(FRAME_S3*8)(sp)
113 stq s4,(FRAME_S4*8)(sp)
114 stq s5,(FRAME_S5*8)(sp)
115 stq s6,(FRAME_S6*8)(sp)
116 stq a0,(FRAME_A0*8)(sp)
117 stq a1,(FRAME_A1*8)(sp)
118 stq a2,(FRAME_A2*8)(sp)
119 stq a3,(FRAME_A3*8)(sp)
120 stq a4,(FRAME_A4*8)(sp)
121 stq a5,(FRAME_A5*8)(sp)
122 stq ra,(FRAME_RA*8)(sp)
124 /* syscall number, passed in v0, is first arg, frame pointer second */
126 mov sp,a1 ; .loc 1 __LINE__
129 jmp zero, exception_return
132 /**************************************************************************/
136 * System unaligned access entry point.
139 LEAF(XentUna, 3) /* XXX should be NESTED */
141 lda sp,-(FRAME_SW_SIZE*8)(sp)
142 stq at_reg,(FRAME_AT*8)(sp)
144 stq ra,(FRAME_RA*8)(sp)
145 bsr ra, exception_save_regs /* jmp/CALL trashes pv/t12 */
147 /* a0, a1, & a2 already set up */
148 ldiq a3, ALPHA_KENTRY_UNA
149 mov sp, a4 ; .loc 1 __LINE__
152 jmp zero, exception_return
156 /**************************************************************************/
159 * console 'restart' routine to be placed in HWRPB.
161 LEAF(XentRestart, 1) /* XXX should be NESTED */
163 lda sp,-(FRAME_SIZE*8)(sp)
164 stq at_reg,(FRAME_AT*8)(sp)
166 stq v0,(FRAME_V0*8)(sp)
167 stq a3,(FRAME_A3*8)(sp)
168 stq a4,(FRAME_A4*8)(sp)
169 stq a5,(FRAME_A5*8)(sp)
170 stq s0,(FRAME_S0*8)(sp)
171 stq s1,(FRAME_S1*8)(sp)
172 stq s2,(FRAME_S2*8)(sp)
173 stq s3,(FRAME_S3*8)(sp)
174 stq s4,(FRAME_S4*8)(sp)
175 stq s5,(FRAME_S5*8)(sp)
176 stq s6,(FRAME_S6*8)(sp)
177 stq t0,(FRAME_T0*8)(sp)
178 stq t1,(FRAME_T1*8)(sp)
179 stq t2,(FRAME_T2*8)(sp)
180 stq t3,(FRAME_T3*8)(sp)
181 stq t4,(FRAME_T4*8)(sp)
182 stq t5,(FRAME_T5*8)(sp)
183 stq t6,(FRAME_T6*8)(sp)
184 stq t7,(FRAME_T7*8)(sp)
185 stq t8,(FRAME_T8*8)(sp)
186 stq t9,(FRAME_T9*8)(sp)
187 stq t10,(FRAME_T10*8)(sp)
188 stq t11,(FRAME_T11*8)(sp)
189 stq t12,(FRAME_T12*8)(sp)
190 stq ra,(FRAME_RA*8)(sp)
192 br pv,LXconsole_restart1
193 LXconsole_restart1: LDGP(pv)
195 ldq a0,(FRAME_RA*8)(sp) /* a0 = ra */
196 ldq a1,(FRAME_T11*8)(sp) /* a1 = ai */
197 ldq a2,(FRAME_T12*8)(sp) /* a2 = pv */
198 CALL(console_restart)