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

2015-09-23 Thread H.J. Lu
On Tue, Sep 22, 2015 at 11:13 AM, Richard Henderson wrote: > > HJ, I think Hal is right. Providing the data via arguments is vastly superior > to providing it via builtins. I had actually been thinking the same thing > myself. > > It should be easy to check that the function has the correct sig

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

2015-09-22 Thread H. Peter Anvin
On 09/22/15 04:52, David Chisnall wrote: > On 22 Sep 2015, at 12:47, H.J. Lu wrote: >> >> since __builtin_exception_error () is the same as >> __builtin_return_address (0) and __builtin_interrupt_data () is >> address of __builtin_exception_error () + size of register. > > Except that they’re *no

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

2015-09-22 Thread H. Peter Anvin
On 09/22/15 04:44, David Chisnall wrote: > On 22 Sep 2015, at 12:39, H.J. Lu via cfe-dev 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. > > Implement

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

2015-09-22 Thread H. Peter Anvin
On 09/22/15 01:41, David Chisnall wrote: > On 21 Sep 2015, at 21:45, H.J. Lu via cfe-dev wrote: >> >> The main purpose of x86 interrupt attribute is to allow programmers >> to write x86 interrupt/exception handlers in C WITHOUT assembly >> stubs to avoid extra branch from assembly stubs to C funct

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

2015-09-22 Thread Richard Henderson
On 09/21/2015 04:03 PM, Hal Finkel wrote: > - Original Message - >> From: "H.J. Lu" >> To: "Hal Finkel" >> Cc: "GCC Development" , cfe-...@lists.llvm.org >> Sent: Monday, September 21, 2015 5:57:36 PM >> Subject: Re: [cfe-

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

2015-09-22 Thread David Chisnall
On 22 Sep 2015, at 12:47, H.J. Lu wrote: > > since __builtin_exception_error () is the same as > __builtin_return_address (0) and __builtin_interrupt_data () is > address of __builtin_exception_error () + size of register. Except that they’re *not*. __builtin_return_address(0) is guaranteed to

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

2015-09-22 Thread H.J. Lu
On Tue, Sep 22, 2015 at 4:44 AM, David Chisnall wrote: > On 22 Sep 2015, at 12:39, H.J. Lu via cfe-dev 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.

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

2015-09-22 Thread H.J. Lu
On Tue, Sep 22, 2015 at 1:41 AM, David Chisnall wrote: > On 21 Sep 2015, at 21:45, H.J. Lu via cfe-dev wrote: >> >> The main purpose of x86 interrupt attribute is to allow programmers >> to write x86 interrupt/exception handlers in C WITHOUT assembly >> stubs to avoid extra branch from assembly s

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

2015-09-22 Thread David Chisnall
On 22 Sep 2015, at 12:39, H.J. Lu via cfe-dev 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 interru

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

2015-09-22 Thread H.J. Lu
On Tue, Sep 22, 2015 at 1:11 AM, Hal Finkel wrote: > - Original Message - >> From: "H.J. Lu" >> To: "Hal Finkel" >> Cc: "GCC Development" , cfe-...@lists.llvm.org >> Sent: Monday, September 21, 2015 7:17:20 PM >> Subject:

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

2015-09-22 Thread David Chisnall
On 21 Sep 2015, at 21:45, H.J. Lu via cfe-dev wrote: > > The main purpose of x86 interrupt attribute is to allow programmers > to write x86 interrupt/exception handlers in C WITHOUT assembly > stubs to avoid extra branch from assembly stubs to C functions. I > want to keep the number of new intr

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

2015-09-22 Thread Hal Finkel
- Original Message - > From: "H.J. Lu" > To: "Hal Finkel" > Cc: "GCC Development" , cfe-...@lists.llvm.org > Sent: Monday, September 21, 2015 7:17:20 PM > Subject: Re: [cfe-dev] RFC: Support x86 interrupt and exception handlers > >

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

2015-09-21 Thread H.J. Lu
On Mon, Sep 21, 2015 at 4:03 PM, Hal Finkel wrote: > - Original Message - >> From: "H.J. Lu" >> To: "Hal Finkel" >> Cc: "GCC Development" , cfe-...@lists.llvm.org >> Sent: Monday, September 21, 2015 5:57:36 PM >> Subject:

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

2015-09-21 Thread Hal Finkel
- Original Message - > From: "H.J. Lu" > To: "Hal Finkel" > Cc: "GCC Development" , cfe-...@lists.llvm.org > Sent: Monday, September 21, 2015 5:57:36 PM > Subject: Re: [cfe-dev] RFC: Support x86 interrupt and exception handlers > >

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

2015-09-21 Thread H.J. Lu
On Mon, Sep 21, 2015 at 3:40 PM, Hal Finkel wrote: > - Original Message - >> From: "H.J. Lu via cfe-dev" >> To: "GCC Development" , cfe-...@lists.llvm.org >> Sent: Monday, September 21, 2015 11:27:18 AM >> Subject: Re: [cfe-dev] RFC: Suppor

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

2015-09-21 Thread Hal Finkel
- Original Message - > From: "H.J. Lu via cfe-dev" > To: "GCC Development" , cfe-...@lists.llvm.org > Sent: Monday, September 21, 2015 11:27:18 AM > Subject: Re: [cfe-dev] RFC: Support x86 interrupt and exception handlers > > On Thu, Sep 17, 2015 at

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

2015-09-21 Thread H.J. Lu
On Mon, Sep 21, 2015 at 2:23 PM, John Criswell wrote: > On 9/21/15 4:45 PM, H.J. Lu wrote: >> >> On Mon, Sep 21, 2015 at 11:52 AM, John Criswell >> wrote: >>> >>> On 9/21/15 12:27 PM, H.J. Lu via cfe-dev wrote: On Thu, Sep 17, 2015 at 12:26 PM, H.J. Lu wrote: > > On Tue, Sep 15

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

2015-09-21 Thread John Criswell
On 9/21/15 4:45 PM, H.J. Lu wrote: On Mon, Sep 21, 2015 at 11:52 AM, John Criswell wrote: On 9/21/15 12:27 PM, H.J. Lu via cfe-dev wrote: On Thu, Sep 17, 2015 at 12:26 PM, H.J. Lu wrote: On Tue, Sep 15, 2015 at 1:11 PM, H.J. Lu wrote: To implement interrupt and exception handlers for x86 p

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

2015-09-21 Thread H.J. Lu
On Mon, Sep 21, 2015 at 11:52 AM, John Criswell wrote: > On 9/21/15 12:27 PM, H.J. Lu via cfe-dev wrote: >> >> On Thu, Sep 17, 2015 at 12:26 PM, H.J. Lu wrote: >>> >>> On Tue, Sep 15, 2015 at 1:11 PM, H.J. Lu wrote: > > To implement interrupt and exception handlers for x86 processors, a

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

2015-09-21 Thread John Criswell
On 9/21/15 12:27 PM, H.J. Lu via cfe-dev wrote: On Thu, Sep 17, 2015 at 12:26 PM, H.J. Lu wrote: On Tue, Sep 15, 2015 at 1:11 PM, H.J. Lu wrote: To implement interrupt and exception handlers for x86 processors, a compiler should support: 1. void * __builtin_ia32_interrupt_data (void) I got

Re: RFC: Support x86 interrupt and exception handlers

2015-09-21 Thread H.J. Lu
On Thu, Sep 17, 2015 at 12:26 PM, H.J. Lu wrote: > On Tue, Sep 15, 2015 at 1:11 PM, H.J. Lu wrote: >>> To implement interrupt and exception handlers for x86 processors, a >>> compiler should support: >>> >>> 1. void * __builtin_ia32_interrupt_data (void) >> >> I got a feedback on the name of this

Re: RFC: Support x86 interrupt and exception handlers

2015-09-17 Thread H.J. Lu
On Tue, Sep 15, 2015 at 1:11 PM, H.J. Lu wrote: >> To implement interrupt and exception handlers for x86 processors, a >> compiler should support: >> >> 1. void * __builtin_ia32_interrupt_data (void) > > I got a feedback on the name of this builtin function. Since > it also works for 64-bit, we

Re: RFC: Support x86 interrupt and exception handlers

2015-09-16 Thread H.J. Lu
On Wed, Sep 16, 2015 at 12:07 AM, Matthew Fortune wrote: > H.J. Lu writes: >> On Tue, Sep 15, 2015 at 2:45 PM, Matthew Fortune >> wrote: >> > H.J. Lu writes: >> >> On Thu, Sep 3, 2015 at 10:37 AM, H.J. Lu wrote: >> >> > The interrupt and exception handlers are called by x86 processors. X86 >>

RE: RFC: Support x86 interrupt and exception handlers

2015-09-16 Thread Matthew Fortune
H.J. Lu writes: > On Tue, Sep 15, 2015 at 2:45 PM, Matthew Fortune > wrote: > > H.J. Lu writes: > >> On Thu, Sep 3, 2015 at 10:37 AM, H.J. Lu wrote: > >> > The interrupt and exception handlers are called by x86 processors. X86 > >> > hardware puts information on stack and calls the handler. T

Re: RFC: Support x86 interrupt and exception handlers

2015-09-15 Thread H.J. Lu
On Tue, Sep 15, 2015 at 2:45 PM, Matthew Fortune wrote: > H.J. Lu writes: >> On Thu, Sep 3, 2015 at 10:37 AM, H.J. Lu wrote: >> > The interrupt and exception handlers are called by x86 processors. X86 >> > hardware puts information on stack and calls the handler. The >> > requirements are >> >

RE: RFC: Support x86 interrupt and exception handlers

2015-09-15 Thread Matthew Fortune
H.J. Lu writes: > On Thu, Sep 3, 2015 at 10:37 AM, H.J. Lu wrote: > > The interrupt and exception handlers are called by x86 processors. X86 > > hardware puts information on stack and calls the handler. The > > requirements are > > > > 1. Both interrupt and exception handlers must use the 'IRET

Re: RFC: Support x86 interrupt and exception handlers

2015-09-15 Thread H.J. Lu
On Thu, Sep 3, 2015 at 10:37 AM, H.J. Lu wrote: > The interrupt and exception handlers are called by x86 processors. X86 > hardware puts information on stack and calls the handler. The > requirements are > > 1. Both interrupt and exception handlers must use the 'IRET' instruction, > instead of t

RFC: Support x86 interrupt and exception handlers

2015-09-03 Thread H.J. Lu
The interrupt and exception handlers are called by x86 processors. X86 hardware puts information on stack and calls the handler. The requirements are 1. Both interrupt and exception handlers must use the 'IRET' instruction, instead of the 'RET' instruction, to return from the handlers. 2. All re