Subversion Repositories HelenOS

Rev

Rev 1856 | Rev 1864 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1856 Rev 1860
Line 26... Line 26...
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
#include <arch/stack.h>
29
#include <arch/stack.h>
30
#include <arch/regdef.h>
30
#include <arch/regdef.h>
-
 
31
#include <arch/mm/mmu.h>
31
 
32
 
32
.text
33
.text
33
 
34
 
34
.global memcpy
35
.global memcpy
35
.global memcpy_from_uspace
36
.global memcpy_from_uspace
Line 141... Line 142...
141
	WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT
142
	WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT
142
 
143
 
143
.global read_from_ag_g7
144
.global read_from_ag_g7
144
read_from_ag_g7:
145
read_from_ag_g7:
145
	READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT
146
	READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT
-
 
147
 
-
 
148
 
-
 
149
/** Switch to userspace.
-
 
150
 *
-
 
151
 * %o0	Userspace entry address.
-
 
152
 * %o1	Userspace stack pointer address.
-
 
153
 */
-
 
154
.global switch_to_userspace
-
 
155
switch_to_userspace:
-
 
156
	flushw
-
 
157
	wrpr %g0, 0, %cleanwin		! avoid information leak
-
 
158
	save %o1, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
-
 
159
 
-
 
160
	clr %i2
-
 
161
	clr %i3
-
 
162
	clr %i4
-
 
163
	clr %i5
-
 
164
	clr %i6
-
 
165
 
-
 
166
	wrpr %g0, 1, %tl		! enforce mapping via nucleus
-
 
167
 
-
 
168
	rdpr %cwp, %g1
-
 
169
	wrpr %g1, TSTATE_IE_BIT, %tstate
-
 
170
	wrpr %i0, 0, %tnpc
-
 
171
	
-
 
172
	/*
-
 
173
	 * Set primary context according to secondary context.
-
 
174
	 * Secondary context has been already installed by
-
 
175
	 * higher-level functions.
-
 
176
	 */
-
 
177
	wr %g0, ASI_DMMU, %asi
-
 
178
	ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
-
 
179
	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
-
 
180
	flush %i7
-
 
181
	
-
 
182
	done				! jump to userspace