[PATCH] D12498: X86: add an interrupt calling convention

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 07:46:45 PST 2015


aaboud added a subscriber: aaboud.
aaboud added a comment.

According to the final proposal by H.J.

> #ifdef __x86_64__

>  typedef unsigned long long int uword_t;

>  #else

>  typedef unsigned int uword_t;

>  #endif

> 

> struct interrupt_frame

>  {

> 

>   uword_t ip;

>   uword_t cs;

>   uword_t flags;

>   uword_t sp;

>   uword_t ss;

> 

> };

> 

> __attribute__ ((interrupt))

> void

>  f (struct interrupt_frame *frame)

>  {

>  ...

>  }


the frame parameter is passed in C as a pointer argument.
However, in the assembly it should be passed by value on the stack rather than a pointer on the stack.
Do we assume that this will be handled by the clang-FE ?


================
Comment at: lib/Target/X86/X86CallingConv.td:711
@@ -710,1 +710,3 @@
 
+def CC_X86_Intr : CallingConv<[
+  // Error codes aren't necessarily 32 bits wide, but fill a 32-bit slot.
----------------
I think we need to define argument convention for x86-32 and another for x86-64.
X86-32: the arguments need to have size 4 and alignment 4
X86-64: the arguments need to have size 8 and alignment 8

Also, why do we need to promote types to i32? Do we expect to have smaller types? Should not that be considered as illegal interrupt?


Repository:
  rL LLVM

http://reviews.llvm.org/D12498





More information about the llvm-commits mailing list