Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD sun4v trap levels



On Sun, 25 Oct 2026 20:38:48 +0000 (UTC)
Palle Lyckegaard <palle%netbsd.org@localhost> wrote:

> The SPILL handlers branches to specific functions.
> This is the way OpenBSD does and it seems to work ok.

Seems to work OK may be a reasonable approach, except I like to
understand why something is done and for what purpose.

> Only TL=0 and TL=1 a valid for sun4v - TL=2 and above is or sun4u only

According to the architecture manual:

"In an UltraSPARC Architecture 2007 implementation, MAXPTL = 2 and MAXTL
= 6"

Where MAXPTL is defined as - the number of supported trap levels beyond
level 0 and supporting 2 levels of saved trap state visible to
privileged software.

and also:

"The maximum trap level at which privileged software may execute is
MAXPTL (which, on an UltraSPARC Architecture 2007 virtual processor, is
2). Therefore, if TL ≥ MAXPTL and a trap occurs that would normally be
delivered in privileged mode, it is instead delivered in
hyperprivileged mode; the trap table offset for watchdog_reset (4016)
is used"

If I understand this correctly, kernel can trap to TL=1 and TL=2 before
another nested trap causes watchdog reset.

Solaris spill/fill trap handlers for TL>0 do not branch to any
functions and instead use simple inline assembly instructions:
illumos-gate-master/usr/src/uts/sun4v/ml/trap_table.S

Anyway, replacing NetBSD sun4v spill/fill trap handlers for TL>0 with
the same handlers as sun4u, fixes the %fp register corruption in my
test program and it completes its execution successfully. This is not a
complete fix as running other shell scripts locks up the kernel hard.


Home | Main Index | Thread Index | Old Index