re: sun4v trap table
matthew green <[email protected]> Mon, 06 Oct 2025 17:34:42 +1100
| Newsgroups | gmane.os.netbsd.ports.sparc64 |
|---|---|
| Message-ID | <[email protected]> |
> For sparc64 in locore.s below is the fragment from the sun4v trap table for TL (Trap Level) 0: > > SPILL64(uspill8_sun4vt0,ASI_AIUS) ! 0x080 spill_0_normal -- used to save user windows in user mode > SPILL32(uspill4_sun4vt0,ASI_AIUS) ! 0x084 spill_1_normal > SPILLBOTH(uspill8_sun4vt0,uspill4_sun4vt0,ASI_AIUS) ! 0x088 spill_2_normal > sun4v_trap_entry_spill_fill_fail 1 ! 0x08c spill_3_normal > SPILL64(kspill8_sun4vt0,ASI_N) ! 0x090 spill_4_normal -- used to save supervisor windows > SPILL32(kspill4_sun4vt0,ASI_N) ! 0x094 spill_5_normal > SPILLBOTH(kspill8_sun4vt0,kspill4_sun4vt0,ASI_N) ! 0x098 spill_6_normal > sun4v_trap_entry_spill_fill_fail 1 ! 0x09c spill_7_normal > > Does anyone know how the TT (Trap Type) maps to the table entries? For > example, when TT=0x080 why does the kernel think it needs to use SPILL64() > and for example, not SPILL32(). Where is this defined? > > The architecture manual does not seem to specify the details, so I assume > it is left up to the OS kernel to decide? Is this correct? i thought it was more obvious but it's been almost 30 years since i wrote some code related to this that eeh implemented as well in a far more complete form, that also worked :) the traptype is composed of 9 bits: 8:6 are 010 for spill and 011 for fill. 5 is if OTHERWIN is not 0. 4:2 are either WSTATE.OTHER or WSTATE.NORMAL. (1:0 is always 0 because these are 4-trap long traps.) in the (original) v9 manual this is in 7.5.2.1 "Trap Type for Spill/Fill Traps". so the control is on platform setting %WSTATE -- which is 3 bits for "other" and "normal". we only use two values for this so, really only two of the above should be used? it's been a while, and i'm still a little confused by: include/psl.h:264:#define WSTATE_USER 022 include/psl.h:263:#define WSTATE_KERN 026 since they both seem to set OTHER bits, which means that 4:2 in the trap type will always be 2? so always uses SPILLBOTH()? i think i am still missing something here... (none of the above is sun4v specific but sparc v9 generic.) .mrg.