/* Registers to not touch at all. */
#define t_psr l0 /* Set by caller */
#define t_pc l1 /* Set by caller */
#define t_npc l2 /* Set by caller */
#define t_wim l3 /* Set by caller */
#define t_twinmask l4 /* Set at beginning of this entry routine. */
#define t_kstack l5 /* Set right before pt_regs frame is built */
#define t_retpc l6 /* If you change this, change winmacro.h header file */
#define t_systable l7 /* Never touch this, could be the syscall table ptr. */
#define curptr g6 /* Set after pt_regs frame is built */
.text
.align4
/* SEVEN WINDOW PATCH INSTRUCTIONS */
.globl tsetup_7win_patch1, tsetup_7win_patch2
.globl tsetup_7win_patch3, tsetup_7win_patch4
.globl tsetup_7win_patch5, tsetup_7win_patch6
tsetup_7win_patch1: sll %t_wim, 0x6, %t_wim
tsetup_7win_patch2: and %g2, 0x7f, %g2
tsetup_7win_patch3: and %g2, 0x7f, %g2
tsetup_7win_patch4: and %g1, 0x7f, %g1
tsetup_7win_patch5: sll %t_wim, 0x6, %t_wim
tsetup_7win_patch6: and %g2, 0x7f, %g2 /* END OF PATCH INSTRUCTIONS */
/* At trap time, interrupts and all generic traps do the *following: * *rd%psr,%l0 *bsome_handler *rd%wim,%l3 *nop * *Then'some_handler'ifitneedsatrapframe(ie.ithas *tocallc-codeandthetrapcannotbehandledin-window) *thenitdoestheSAVE_ALLmacroinentry.Swhichdoes * *sethi%hi(trap_setup),%l4 *jmpl%l4+%lo(trap_setup),%l6 *nop
*/
.globl trap_setup, tsetup_patch1, tsetup_patch2
.globl tsetup_patch3, tsetup_patch4
.globl tsetup_patch5, tsetup_patch6
trap_setup: /* Calculate mask of trap window. See if from user *orkernelandbranchconditionally.
*/
mov 1, %t_twinmask
andcc %t_psr, PSR_PS, %g0 ! fromsupv_p = (psr & PSR_PS)
be trap_setup_from_user ! nope, from user mode sll %t_twinmask, %t_psr, %t_twinmask ! t_twinmask = (1 << psr)
/* From kernel, allocate more kernel stack and *buildapt_regstrapframe.
*/ sub %fp, (STACKFRAME_SZ + TRACEREG_SZ), %t_kstack
STORE_PT_ALL(t_kstack, t_psr, t_pc, t_npc, g2)
/* See if we are in the trap window. */
andcc %t_twinmask, %t_wim, %g0
bne trap_setup_kernel_spill ! in trap window, clean up
nop
/* Trap from kernel with a window available. *Justdoit...
*/
jmpl %t_retpc + 0x8, %g0 ! return to caller
mov %t_kstack, %sp ! jump onto new stack
trap_setup_kernel_spill: ld [%curptr + TI_UWINMASK], %g1
orcc %g0, %g1, %g0
bne trap_setup_user_spill ! there are some user windows, yuck /* Spill from kernel, but only kernel windows, adjust *%wimandgo.
*/ srl %t_wim, 0x1, %g2 ! begin computation of new %wim
tsetup_patch1: sll %t_wim, 0x7, %t_wim ! patched on 7 window Sparcs
or %t_wim, %g2, %g2
tsetup_patch2:
and %g2, 0xff, %g2 ! patched on 7 window Sparcs
save %g0, %g0, %g0
/* Set new %wim value */
wr %g2, 0x0, %wim
/* Save the kernel window onto the corresponding stack. */
STORE_WINDOW(sp)
restore %g0, %g0, %g0
jmpl %t_retpc + 0x8, %g0 ! return to caller
mov %t_kstack, %sp ! and onto new kernel stack
#if 0 /* If we're sure every task_struct is THREAD_SIZE aligned,
we can speed this up. */ sethi %hi(STACK_OFFSET), %curptr
or %curptr, %lo(STACK_OFFSET), %curptr sub %t_kstack, %curptr, %curptr
#else sethi %hi(~(THREAD_SIZE - 1)), %curptr
and %t_kstack, %curptr, %curptr
#endif
/* Clear current_thread_info->w_saved */ st %g0, [%curptr + TI_W_SAVED]
/* See if we are in the trap window. */
andcc %t_twinmask, %t_wim, %g0
bne trap_setup_user_spill ! yep we are
orn %g0, %t_twinmask, %g1 ! negate trap win mask into %g1
/* Trap from user, but not into the invalid window. *Calculatenewumask.Thewaythisworksis, *anywindowfromthe%wimattraptimeuntil *thewindowrightbeforetheoneweareinnow, *isauserwindow.Adiagram: * *76543210windownumber *--------------- *ILTmnemonic * *Window'I'istheinvalidwindowinourexample, *window'L'isthewindowtheuserwasinwhen *thetrapoccurred,windowTisthetrapwindow *weareinnow.Sotherefore,windows5,4and *3areuserwindows.Thefollowingsequence *computestheuserwinmasktorepresentthis.
*/
subcc %t_wim, %t_twinmask, %g2
bneg,a 1f sub %g2, 0x1, %g2 1:
andn %g2, %t_twinmask, %g2
tsetup_patch3:
and %g2, 0xff, %g2 ! patched on 7win Sparcs st %g2, [%curptr + TI_UWINMASK] ! store new umask
jmpl %t_retpc + 0x8, %g0 ! return to caller
mov %t_kstack, %sp ! and onto kernel stack
trap_setup_user_spill: /* A spill occurred from either kernel or user mode *andthereexistsomeuserwindowstodealwith. *Amaskofthecurrentlyvaliduserwindows *isin%g1uponentrytohere.
*/
tsetup_patch4:
and %g1, 0xff, %g1 ! patched on 7win Sparcs, mask srl %t_wim, 0x1, %g2 ! compute new %wim
tsetup_patch5: sll %t_wim, 0x7, %t_wim ! patched on 7win Sparcs
or %t_wim, %g2, %g2 ! %g2 is new %wim
tsetup_patch6:
and %g2, 0xff, %g2 ! patched on 7win Sparcs
andn %g1, %g2, %g1 ! clear this bit in %g1 st %g1, [%curptr + TI_UWINMASK]
/* Architecture specific stack checking routines. When either *oftheseroutinesarecalled,theglobalsarefreetouse *astheyhavebeensafelystashedonthenewkernelstack *pointer.Thusthedefinitionbelowforsimplicity.
*/
#define glob_tmp g1
trap_setup_user_stack_is_bolixed: /* From user/kernel into invalid window w/bad user *stack.Savebaduserstack,andreturntocaller.
*/
SAVE_BOLIXED_USER_STACK(curptr, g3)
restore %g0, %g0, %g0
jmpl %t_retpc + 0x8, %g0
mov %t_kstack, %sp
1: /* Clear the fault status and turn on the no_fault bit. */
or %glob_tmp, 0x2, %glob_tmp ! or in no_fault bit
LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS) ! set it
SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS) ! set it
/* Dump the registers and cross fingers. */
STORE_WINDOW(sp)
/* Clear the no_fault bit and check the status. */
andn %glob_tmp, 0x2, %glob_tmp
LEON_PI(sta %glob_tmp, [%g0] ASI_LEON_MMUREGS)
SUN_PI_(sta %glob_tmp, [%g0] ASI_M_MMUREGS)
mov AC_M_SFSR, %glob_tmp
LEON_PI(lda [%glob_tmp] ASI_LEON_MMUREGS, %glob_tmp)! save away status of winstore
SUN_PI_(lda [%glob_tmp] ASI_M_MMUREGS, %glob_tmp) ! save away status of winstore
andcc %glob_tmp, 0x2, %g0 ! did we fault?
bne trap_setup_user_stack_is_bolixed ! failure
nop
restore %g0, %g0, %g0
jmpl %t_retpc + 0x8, %g0
mov %t_kstack, %sp
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.