diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-03-21 22:26:48 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-03-21 22:37:27 +0000 |
| commit | 1ba29614c4ce5e261ade0bd7def94079b7b9647a (patch) | |
| tree | 653c21967c0fc32a696dcc1a2fec029269f0be92 | |
| parent | 1d18872c2519d7ca726ddc49735180ab1d8916e0 (diff) | |
amd64: revert back struct trapframe to the pre-FRED definition
Trying to use the grown struct trapframe for IDT case broke in cases
where code supposed that hardware consumed sizeof(struct trapframe) of
the stack space when delivering interrupt or exception. In particular,
this was broken for #NM/#DB/#MC. Naive attempt of using IDT-trapframe
size for stack consumption caused later problems with larger C type.
Instead of pretending that IDT event delivery pushed two never-accessed
doubleword to the stack, keep it honest and provide separate type for
the FRED interrupt frame, i.e. struct trapframe_fred.
Convert between trapframe_fred and trapframe can be done by trivial pointer
arithmetic.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
| -rw-r--r-- | sys/x86/include/frame.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/x86/include/frame.h b/sys/x86/include/frame.h index a6444d55cfaf..b8e090ff95d0 100644 --- a/sys/x86/include/frame.h +++ b/sys/x86/include/frame.h @@ -152,6 +152,10 @@ struct trapframe { uint16_t tf_ss; uint16_t tf_fred_evinfo1; uint32_t tf_fred_evinfo2; +}; + +struct trapframe_fred { + struct trapframe tf_idt; /* two long words added by FRED */ uint64_t tf_fred_evdata; uint64_t tf_fred_zero1; |
