Subversion Repositories HelenOS

Rev

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

Rev 4055 Rev 4296
Line 476... Line 476...
476
	/*
476
	/*
477
	 * ASSERT(%tl == 1)
477
	 * ASSERT(%tl == 1)
478
	 */
478
	 */
479
	rdpr %tl, %g3
479
	rdpr %tl, %g3
480
	cmp %g3, 1
480
	cmp %g3, 1
481
	be 1f
481
	be %xcc, 1f
482
	nop
482
	nop
483
0:	ba 0b					! this is for debugging, if we ever get here
483
0:	ba 0b					! this is for debugging, if we ever get here
484
	nop					! it will be easy to find
484
	nop					! it will be easy to find
485
 
485
 
486
1:
486
1:
Line 497... Line 497...
497
	 */ 
497
	 */ 
498
	and %g3, TSTATE_CWP_MASK, %g4
498
	and %g3, TSTATE_CWP_MASK, %g4
499
	wrpr %g4, 0, %cwp			! resynchronize CWP
499
	wrpr %g4, 0, %cwp			! resynchronize CWP
500
 
500
 
501
	andcc %g3, TSTATE_PRIV_BIT, %g0		! if this trap came from the privileged mode...
501
	andcc %g3, TSTATE_PRIV_BIT, %g0		! if this trap came from the privileged mode...
502
	bnz 0f					! ...skip setting of kernel stack and primary context
502
	bnz %xcc, 0f				! ...skip setting of kernel stack and primary context
503
	nop
503
	nop
504
	
504
	
505
.endif
505
.endif
506
	/*
506
	/*
507
	 * Normal window spills will go to the userspace window buffer.
507
	 * Normal window spills will go to the userspace window buffer.
Line 670... Line 670...
670
	and %g1, TSTATE_CWP_MASK, %l0
670
	and %g1, TSTATE_CWP_MASK, %l0
671
	inc %l0
671
	inc %l0
672
	and %l0, NWINDOWS - 1, %l0	! %l0 mod NWINDOWS
672
	and %l0, NWINDOWS - 1, %l0	! %l0 mod NWINDOWS
673
	rdpr %cwp, %l1
673
	rdpr %cwp, %l1
674
	cmp %l0, %l1
674
	cmp %l0, %l1
675
	bz 0f				! CWP is ok
675
	bz %xcc, 0f			! CWP is ok
676
	nop
676
	nop
677
 
677
 
678
	/*
678
	/*
679
	 * Fix CWP.
679
	 * Fix CWP.
680
	 * In order to recapitulate, the input registers in the current
680
	 * In order to recapitulate, the input registers in the current
Line 710... Line 710...
710
	 */
710
	 */
711
0:
711
0:
712
.if NOT(\is_syscall)
712
.if NOT(\is_syscall)
713
	rdpr %tstate, %g1
713
	rdpr %tstate, %g1
714
	andcc %g1, TSTATE_PRIV_BIT, %g0		! if we are not returning to userspace...,
714
	andcc %g1, TSTATE_PRIV_BIT, %g0		! if we are not returning to userspace...,
715
	bnz 1f					! ...skip restoring userspace windows
715
	bnz %xcc, 1f				! ...skip restoring userspace windows
716
	nop
716
	nop
717
.endif
717
.endif
718
 
718
 
719
	/*
719
	/*
720
	 * Spills and fills will be processed by the {spill,fill}_1_normal
720
	 * Spills and fills will be processed by the {spill,fill}_1_normal
Line 747... Line 747...
747
	 * CWP is now in the window last saved in the userspace window buffer.
747
	 * CWP is now in the window last saved in the userspace window buffer.
748
	 * Fill all windows stored in the buffer.
748
	 * Fill all windows stored in the buffer.
749
	 */
749
	 */
750
	clr %g4
750
	clr %g4
751
0:	andcc %g7, UWB_ALIGNMENT - 1, %g0	! alignment check
751
0:	andcc %g7, UWB_ALIGNMENT - 1, %g0	! alignment check
752
	bz 0f					! %g7 is UWB_ALIGNMENT-aligned, no more windows to refill
752
	bz %xcc, 0f				! %g7 is UWB_ALIGNMENT-aligned, no more windows to refill
753
	nop
753
	nop
754
 
754
 
755
	add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7
755
	add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7
756
	ldx [%g7 + L0_OFFSET], %l0
756
	ldx [%g7 + L0_OFFSET], %l0
757
	ldx [%g7 + L1_OFFSET], %l1
757
	ldx [%g7 + L1_OFFSET], %l1
Line 783... Line 783...
783
	 * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN.
783
	 * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN.
784
	 */
784
	 */
785
	wrpr %g1, 0, %cwp
785
	wrpr %g1, 0, %cwp
786
	add %g4, %g2, %g2
786
	add %g4, %g2, %g2
787
	cmp %g2, NWINDOWS - 2
787
	cmp %g2, NWINDOWS - 2
788
	bg 2f					! fix the CANRESTORE=NWINDOWS-1 anomaly
788
	bg %xcc, 2f				! fix the CANRESTORE=NWINDOWS-1 anomaly
789
	mov NWINDOWS - 2, %g1			! use dealy slot for both cases
789
	mov NWINDOWS - 2, %g1			! use dealy slot for both cases
790
	sub %g1, %g2, %g1
790
	sub %g1, %g2, %g1
791
	
791
	
792
	wrpr %g0, 0, %otherwin
792
	wrpr %g0, 0, %otherwin
793
	wrpr %g1, 0, %cansave			! NWINDOWS - 2 - CANRESTORE
793
	wrpr %g1, 0, %cansave			! NWINDOWS - 2 - CANRESTORE