Page MenuHomeFreeBSD

x86 FRED: add hardware definitions for the trap frames fields
ClosedPublic

Authored by kib on Thu, Mar 12, 4:15 PM.
Tags
None
Referenced Files
F149576184: D55831.id174047.diff
Wed, Mar 25, 8:49 AM
F149542363: D55831.id173621.diff
Wed, Mar 25, 3:50 AM
Unknown Object (File)
Fri, Mar 20, 10:34 PM
Unknown Object (File)
Fri, Mar 20, 7:43 AM
Unknown Object (File)
Fri, Mar 20, 2:15 AM
Unknown Object (File)
Thu, Mar 19, 8:51 PM
Unknown Object (File)
Thu, Mar 19, 6:34 AM
Unknown Object (File)
Thu, Mar 19, 5:33 AM
Subscribers

Details

Summary
as provided by the Intel document 346446-009 AKA FRED 8.0 and SDM v90,
February 2026.

Note that the layout of the struct trapframe does not change with
FRED. The differences are in addition of two fields at the end of the
structure. Other members are carved from existing tf_cs and tf_ss by
limiting hw-written segments to 16 bits officially, and reusing rest
from the doubleword for the new data.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Thu, Mar 12, 4:15 PM
sys/amd64/amd64/trap.c
944

No need anymore for the mask of tf_cs.

sys/x86/include/frame.h
148

The field prefix should be tf_.

152–157

Should we apply some explicit masking in places where tf_ss is assigned by software? e.g. in set_mcontext(), we have tp->tf_ss = mcp->mc_ss, so there is implicit truncation.

154

The numbering of the evinfo fields is a bit weird. I see why you did it this way, it follows the order that the fields are described in the FRED documentation. Probably not worth changing.

kib marked 4 inline comments as done.Sat, Mar 14, 10:55 AM
kib added inline comments.
sys/x86/include/frame.h
152–157

I do not object, but I do not see a purpose for explicit cast or masking.
OTOH we indeed might consider adding checks that ss cs from the mcontext fits into 16 bits, i.e. the reserved bits are not passed by userspace.

kib marked an inline comment as done.

Fix typo in the name of the reserved field.
Remove cs masking.

markj added inline comments.
sys/x86/include/frame.h
152–157

Some checks would be good. I'm not sure if there is any chance that they would break compatibility somehow.

This revision is now accepted and ready to land.Sun, Mar 15, 1:47 AM

FYI, kgdb will have to know about the change in layout to trapframe I think, so bump __FreeBSD_version when you land this just to be on the safe side please?

kib marked an inline comment as done.Thu, Mar 19, 3:28 PM
In D55831#1279681, @jhb wrote:

FYI, kgdb will have to know about the change in layout to trapframe I think, so bump __FreeBSD_version when you land this just to be on the safe side please?

The trapframe layout does not change with FRED. The differences are in addition of two fields at the end of the structure. Other members are carved from existing tf_cs and tf_ss by limiting hw-written segments to 16 bits officially, and reusing rest from the doubleword for the new data.

sys/x86/include/frame.h
152–157

I can't recall if kgdb has to know the size of struct trapframe is my only concern. I think we already only use the 16 bits for cs/ss today.

kib marked an inline comment as done.Thu, Mar 19, 4:02 PM
In D55831#1279764, @jhb wrote:

I can't recall if kgdb has to know the size of struct trapframe is my only concern. I think we already only use the 16 bits for cs/ss today.

Ok, I will bump the version.

Is there the same concern for struct pcb? I need to add FRED MSRs to it.