-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue for the x86-interrupt calling convention #40180
Copy link
Copy link
Open
Labels
A-hardware-interruptsArea: Code for handling the "interrupt ABI" of various processorsArea: Code for handling the "interrupt ABI" of various processorsB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-abi_x86_interruptS-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-hardware-interruptsArea: Code for handling the "interrupt ABI" of various processorsArea: Code for handling the "interrupt ABI" of various processorsB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-abi_x86_interruptS-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Overview
Tracking issue for the
x86-interruptcalling convention, which was added in PR #39832. The feature gate name isabi_x86_interrupt. This feature will not be considered for stabilization without an RFC.The
x86-interruptcalling convention can be used for defining interrupt handlers on 32-bit and 64-bit x86 targets. The compiler then usesiretinstead ofretfor returning and ensures that all registers are restored to their original values.Usage
for interrupts and exceptions without error code and
for exceptions that push an error code (e.g., page faults or general protection faults). The programmer must ensure that the correct version is used for each interrupt.
For more details see the LLVM PR, and the corresponding proposal.
Known issues
ExceptionStackFrameis passed by reference (instead of by value). This used to work on older LLVM version, but no longer works on LLVM 12. See Tracking issue for thex86-interruptcalling convention #40180 (comment) for more details.used byval ABI for unsized layout#124806Tried to make Ignore indirect#126418"x86-interrupt" fnshould be invalid #132834extern "x86-interrupt" fnallows absurd signatures #132835()or!as return types #13284164-bit
The x86_64 automatically aligns the stack on a 16-byte boundary when an interrupts occurs in 64-bit mode. However, the CPU pushes an 8-byte error code for some exceptions, which destroys the 16-byte alignment. At the moment, LLVM doesn't handle this case correctly and always assumes a 16-byte alignment. This leads to alignment issues on targets with SSE support, since LLVM uses misaligned
movapsinstructions for saving thexmmregisters. This issue is tracked as bug 26413.A fix for this problem was submitted in D30049 and merged in rL299383.
LLVM always tries to backup the
xmmregisters on 64-bit platforms even if the target doesn't support SSE. This leads to invalid opcode exceptions whenever an interrupt handler is invoked.The fix was merged to LLVM trunk in rL295347. Backported in x86 interrupt calling convention: only save xmm registers if the target supports SSE llvm#63.
__attribute__((interrupt)) Handlers Dangerously Out of Spec on x86-64 llvm/llvm-project#41189
32-bit
and esp, 16). However, LLVM doesn't do that at the moment, which might lead to alignment errors, especially for targets with SSE support. This issue is tracked in interrupt handler calls functions with misaligned stack llvm/llvm-project#26851.