Changes in kernel/arch/sparc64/src/asm.S [18baf9c0:44539b4c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/asm.S
r18baf9c0 r44539b4c 29 29 #include <arch/arch.h> 30 30 #include <arch/stack.h> 31 #include <arch/regdef.h> 32 #include <arch/mm/mmu.h> 31 33 32 34 .text … … 232 234 nop 233 235 236 237 .macro WRITE_ALTERNATE_REGISTER reg, bit 238 rdpr %pstate, %g1 ! save PSTATE.PEF 239 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 240 mov %o0, \reg 241 wrpr %g0, PSTATE_PRIV_BIT, %pstate 242 retl 243 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 244 .endm 245 246 .macro READ_ALTERNATE_REGISTER reg, bit 247 rdpr %pstate, %g1 ! save PSTATE.PEF 248 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 249 mov \reg, %o0 250 wrpr %g0, PSTATE_PRIV_BIT, %pstate 251 retl 252 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 253 .endm 254 255 .global write_to_ag_g6 256 write_to_ag_g6: 257 WRITE_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT 258 259 .global write_to_ag_g7 260 write_to_ag_g7: 261 WRITE_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT 262 263 .global write_to_ig_g6 264 write_to_ig_g6: 265 WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT 266 267 .global read_from_ag_g7 268 read_from_ag_g7: 269 READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT 270 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_userspace 279 switch_to_userspace: 280 save %o1, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp 281 flushw 282 wrpr %g0, 0, %cleanwin ! avoid information leak 283 284 mov %i2, %o0 ! uarg 285 xor %o1, %o1, %o1 ! %o1 is defined to hold pcb_ptr 286 ! set it to 0 287 288 clr %i2 289 clr %i3 290 clr %i4 291 clr %i5 292 clr %i6 293 294 wrpr %g0, 1, %tl ! enforce mapping via nucleus 295 296 rdpr %cwp, %g1 297 wrpr %g1, TSTATE_IE_BIT, %tstate 298 wrpr %i0, 0, %tnpc 299 300 /* 301 * Set primary context according to secondary context. 302 * Secondary context has been already installed by 303 * higher-level functions. 304 */ 305 wr %g0, ASI_DMMU, %asi 306 ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1 307 stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi 308 flush %i7 309 310 /* 311 * Spills and fills will be handled by the userspace handlers. 312 */ 313 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate 314 315 done ! jump to userspace 316
Note:
See TracChangeset
for help on using the changeset viewer.