This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cfe-dev] RFC: Support x86 interrupt and exception handlers


On Tue, Sep 22, 2015 at 4:44 AM, David Chisnall
<David.Chisnall@cl.cam.ac.uk> wrote:
> On 22 Sep 2015, at 12:39, H.J. Lu via cfe-dev <cfe-dev@lists.llvm.org> wrote:
>>
>> The center piece of my proposal is not to change how parameters
>> are passed in compiler.  As for user experience, the feedbacks on
>> my proposal from our users are very positive.
>
> Implementing the intrinsics for getting the current interrupt requires a lot of support code for it to actually be useful.  For it to be useful, you are requiring all of the C code to be run with interrupts disabled (and even that doesnât work if you get a NMI in the middle).  Most implementations use a small amount of assembly to capture the interrupt cause and the register state on entry to the handler, then reenable interrupts while the C code runs.  This means that any interrupts (e.g. page faults, illegal instruction traps, whatever) that happen while the C code is running do not mask the values.  Accessing these values from *existing* C code is simply a matter of loading a field from a structure.

The above applies to with and without intrinsics.

> Iâm really unconvinced by something that something with such a narrow use case (and one that encourages writing bad code) belongs in the compiler.
>
> David



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]