Changeset 18baf9c0 in mainline for kernel/arch/sparc64/src/asm.S
- Timestamp:
- 2009-11-20T17:14:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3da11f37
- Parents:
- 5a4fef9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/asm.S
r5a4fef9 r18baf9c0 29 29 #include <arch/arch.h> 30 30 #include <arch/stack.h> 31 #include <arch/regdef.h>32 #include <arch/mm/mmu.h>33 31 34 32 .text … … 234 232 nop 235 233 236 237 .macro WRITE_ALTERNATE_REGISTER reg, bit238 rdpr %pstate, %g1 ! save PSTATE.PEF239 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate240 mov %o0, \reg241 wrpr %g0, PSTATE_PRIV_BIT, %pstate242 retl243 wrpr %g1, 0, %pstate ! restore PSTATE.PEF244 .endm245 246 .macro READ_ALTERNATE_REGISTER reg, bit247 rdpr %pstate, %g1 ! save PSTATE.PEF248 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate249 mov \reg, %o0250 wrpr %g0, PSTATE_PRIV_BIT, %pstate251 retl252 wrpr %g1, 0, %pstate ! restore PSTATE.PEF253 .endm254 255 .global write_to_ag_g6256 write_to_ag_g6:257 WRITE_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT258 259 .global write_to_ag_g7260 write_to_ag_g7:261 WRITE_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT262 263 .global write_to_ig_g6264 write_to_ig_g6:265 WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT266 267 .global read_from_ag_g7268 read_from_ag_g7:269 READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT270 271 272 /** Switch to userspace.273 *274 * %o0 Userspace entry address.275 * %o1 Userspace stack pointer address.276 * %o2 Userspace address of uarg structure.277 */278 .global switch_to_userspace279 switch_to_userspace:280 save %o1, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp281 flushw282 wrpr %g0, 0, %cleanwin ! avoid information leak283 284 mov %i2, %o0 ! uarg285 xor %o1, %o1, %o1 ! %o1 is defined to hold pcb_ptr286 ! set it to 0287 288 clr %i2289 clr %i3290 clr %i4291 clr %i5292 clr %i6293 294 wrpr %g0, 1, %tl ! enforce mapping via nucleus295 296 rdpr %cwp, %g1297 wrpr %g1, TSTATE_IE_BIT, %tstate298 wrpr %i0, 0, %tnpc299 300 /*301 * Set primary context according to secondary context.302 * Secondary context has been already installed by303 * higher-level functions.304 */305 wr %g0, ASI_DMMU, %asi306 ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1307 stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi308 flush %i7309 310 /*311 * Spills and fills will be handled by the userspace handlers.312 */313 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate314 315 done ! jump to userspace316
Note:
See TracChangeset
for help on using the changeset viewer.