comparison packages/hal/mn10300/arch/current/src/context.S @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents 3111d98ba7b3
children 641b639be825
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
20 # 20 #
21 # The Original Code is eCos - Embedded Cygnus Operating System, released 21 # The Original Code is eCos - Embedded Cygnus Operating System, released
22 # September 30, 1998. 22 # September 30, 1998.
23 # 23 #
24 # The Initial Developer of the Original Code is Cygnus. Portions created 24 # The Initial Developer of the Original Code is Cygnus. Portions created
25 # by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. 25 # by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
26 # ------------------------------------------- 26 # -------------------------------------------
27 # 27 #
28 #####COPYRIGHTEND#### 28 #####COPYRIGHTEND####
29 ##============================================================================= 29 ##=============================================================================
30 #######DESCRIPTIONBEGIN#### 30 #######DESCRIPTIONBEGIN####
92 92
93 ##----------------------------------------------------------------------------- 93 ##-----------------------------------------------------------------------------
94 ## HAL longjmp(), setjmp() implementations 94 ## HAL longjmp(), setjmp() implementations
95 ## These implementations omit the usual movm [d2,d3,a2,a3],(sp) 95 ## These implementations omit the usual movm [d2,d3,a2,a3],(sp)
96 ## Which is the first instruction of all C compiled functions. 96 ## Which is the first instruction of all C compiled functions.
97 ## Note: These definitions are repeated in hal_arch.h. If changes are required
98 ## remember to update both sets.
97 99
100 #define CYGARC_JMP_BUF_SP 0
101 #define CYGARC_JMP_BUF_D2 1
102 #define CYGARC_JMP_BUF_D3 2
103 #define CYGARC_JMP_BUF_A2 3
104 #define CYGARC_JMP_BUF_A3 4
105 #define CYGARC_JMP_BUF_LR 5
106
107 #define CYGARC_JMP_BUF_SIZE 6
108
109
98 # This just preserves the callee save registers 110 # This just preserves the callee save registers
99 # namely a2,a3,d2,d3 111 # namely a2,a3,d2,d3
100 # setjmp cannot use movm to do this as we need to keep 112 # setjmp cannot use movm to do this as we need to keep
101 # the sp underneath all live data at all times. 113 # the sp underneath all live data at all times.
102 .globl _hal_setjmp 114 .globl _hal_setjmp
103 _hal_setjmp: # d0=env 115 _hal_setjmp: # d0=env
104 mov d0,a0 # env 116 mov d0,a0 # env
105 mov d2,(4,a0) 117 mov d2,(CYGARC_JMP_BUF_D2*4,a0)
106 mov d3,(8,a0) 118 mov d3,(CYGARC_JMP_BUF_D3*4,a0)
107 mov a2,(12,a0) 119 mov a2,(CYGARC_JMP_BUF_A2*4,a0)
108 mov a3,(16,a0) 120 mov a3,(CYGARC_JMP_BUF_A3*4,a0)
109 mov mdr,d1 # link saved by call (also in (0,sp)) 121 mov mdr,d1 # link saved by call (also in (0,sp))
110 mov d1,(20,a0) 122 mov d1,(CYGARC_JMP_BUF_LR*4,a0)
111 mov sp,a1 123 mov sp,a1
112 mov a1,(0,a0) # a1==(caller''s sp) 124 mov a1,(CYGARC_JMP_BUF_SP*4,a0) # a1==(caller''s sp)
113 clr d0 # return 0 125 clr d0 # return 0
114 ret [],0 126 ret [],0
115 127
116 # longjmp returns to caller of setjmp 128 # longjmp returns to caller of setjmp
117 # after restoring callee save registers 129 # after restoring callee save registers
118 .globl _hal_longjmp 130 .globl _hal_longjmp
119 _hal_longjmp: 131 _hal_longjmp:
120 mov d0,a0 132 mov d0,a0
121 mov (4,a0),d2 133 mov (CYGARC_JMP_BUF_D2*4,a0),d2
122 mov (8,a0),d3 134 mov (CYGARC_JMP_BUF_D3*4,a0),d3
123 mov (12,a0),a2 135 mov (CYGARC_JMP_BUF_A2*4,a0),a2
124 mov (16,a0),a3 136 mov (CYGARC_JMP_BUF_A3*4,a0),a3
125 mov (20,a0),d0 137 mov (CYGARC_JMP_BUF_LR*4,a0),d0
126 ## mov d0,mdr 138 ## mov d0,mdr
127 mov (0,a0),a1 # stashed (caller''s sp) 139 mov (CYGARC_JMP_BUF_SP*4,a0),a1 # stashed (caller''s sp)
128 mov a1,sp 140 mov a1,sp
129 mov d0,(0,sp) # put link on stack 141 mov d0,(0,sp) # put link on stack
130 mov d1,d0 # return arg1 142 mov d1,d0 # return arg1
131 ret [],0 # this ignores (0,sp) and does pc=mdr 143 ret [],0 # this ignores (0,sp) and does pc=mdr
132 144