struct __uintr_frame
{
- /* The position of the most significant bit set in user-interrupt
- request register. */
- unsigned long long uirrv;
/* RIP of the interrupted user process. */
unsigned long long rip;
/* RFLAGS of the interrupted user process. */
--- /dev/null
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
+/* { dg-options "-g -muintr -mgeneral-regs-only" } */
+
+#include <x86gprintrin.h>
+
+extern void exit (int);
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define UIRRV 0x12345670
+#define RIP 0x12345671
+#define RFLAGS 0x12345672
+#define RSP 0x12345673
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+void
+__attribute__((interrupt, used))
+fn (struct __uintr_frame *frame, uword_t uirrv)
+{
+ if (UIRRV != uirrv) /* BREAK */
+ __builtin_abort ();
+ if (RIP != frame->rip)
+ __builtin_abort ();
+ if (RFLAGS != frame->rflags)
+ __builtin_abort ();
+ if (RSP != frame->rsp)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (RSP) "; \
+ push $" STRING (RFLAGS) "; \
+ push $" STRING (RIP) "; \
+ push $" STRING (UIRRV) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
+
+/* { dg-final { gdb-test 22 "uirrv" "0x12345670" } } */
+/* { dg-final { gdb-test 22 "frame->rip" "0x12345671" } } */
+/* { dg-final { gdb-test 22 "frame->rflags" "0x12345672" } } */
+/* { dg-final { gdb-test 22 "frame->rsp" "0x12345673" } } */
--- /dev/null
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
+/* { dg-options "-g -muintr -mgeneral-regs-only" } */
+
+#include <x86gprintrin.h>
+
+extern void exit (int);
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+typedef int aligned __attribute__((aligned(64)));
+
+#define UIRRV 0x12345670
+#define RIP 0x12345671
+#define RFLAGS 0x12345672
+#define RSP 0x12345673
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ __builtin_abort ();
+ return *i;
+}
+
+void
+__attribute__((interrupt, used))
+fn (struct __uintr_frame *frame, uword_t uirrv)
+{
+ aligned i;
+ if (check_int (&i, __alignof__(i)) != i)
+ __builtin_abort ();
+
+ if (UIRRV != uirrv) /* BREAK */
+ __builtin_abort ();
+ if (RIP != frame->rip)
+ __builtin_abort ();
+ if (RFLAGS != frame->rflags)
+ __builtin_abort ();
+ if (RSP != frame->rsp)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (RSP) "; \
+ push $" STRING (RFLAGS) "; \
+ push $" STRING (RIP) "; \
+ push $" STRING (UIRRV) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
+
+/* { dg-final { gdb-test 34 "uirrv" "0x12345670" } } */
+/* { dg-final { gdb-test 34 "frame->rip" "0x12345671" } } */
+/* { dg-final { gdb-test 34 "frame->rflags" "0x12345672" } } */
+/* { dg-final { gdb-test 34 "frame->rsp" "0x12345673" } } */
--- /dev/null
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
+/* { dg-skip-if "PR81210 sp not aligned to 16 bytes" { *-*-darwin* } } */
+/* { dg-options "-muintr -mgeneral-regs-only" } */
+
+#include <x86gprintrin.h>
+
+extern void exit (int);
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
+#define UIRRV 0x12345670
+#define RIP 0x12345671
+#define RFLAGS 0x12345672
+#define RSP 0x12345673
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+void
+__attribute__((interrupt, used))
+fn (struct __uintr_frame *frame, uword_t uirrv)
+{
+ if (UIRRV != uirrv)
+ __builtin_abort ();
+ if (RIP != frame->rip)
+ __builtin_abort ();
+ if (RFLAGS != frame->rflags)
+ __builtin_abort ();
+ if (RSP != frame->rsp)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (RSP) "; \
+ push $" STRING (RFLAGS) "; \
+ push $" STRING (RIP) "; \
+ push $" STRING (UIRRV) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
--- /dev/null
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */
+/* { dg-skip-if "PR81210 sp not aligned to 16 bytes" { *-*-darwin* } } */
+/* { dg-options "-muintr -mgeneral-regs-only" } */
+
+#include <x86gprintrin.h>
+
+extern void exit (int);
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+typedef int aligned __attribute__((aligned(64)));
+
+#define UIRRV 0x12345670
+#define RIP 0x12345671
+#define RFLAGS 0x12345672
+#define RSP 0x12345673
+
+#define STRING(x) XSTRING(x)
+#define XSTRING(x) #x
+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+#define ASMNAME2(prefix, cname) XSTRING (prefix) cname
+
+int
+check_int (int *i, int align)
+{
+ *i = 20;
+ if ((((ptrdiff_t) i) & (align - 1)) != 0)
+ __builtin_abort ();
+ return *i;
+}
+
+void
+__attribute__((interrupt, used))
+fn (struct __uintr_frame *frame, uword_t uirrv)
+{
+ aligned i;
+ if (check_int (&i, __alignof__(i)) != i)
+ __builtin_abort ();
+
+ if (UIRRV != uirrv)
+ __builtin_abort ();
+ if (RIP != frame->rip)
+ __builtin_abort ();
+ if (RFLAGS != frame->rflags)
+ __builtin_abort ();
+ if (RSP != frame->rsp)
+ __builtin_abort ();
+
+ exit (0);
+}
+
+int
+main ()
+{
+ asm ("push $" STRING (RSP) "; \
+ push $" STRING (RFLAGS) "; \
+ push $" STRING (RIP) "; \
+ push $" STRING (UIRRV) "; \
+ jmp " ASMNAME ("fn"));
+ return 0;
+}
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -muintr -mgeneral-regs-only" } */
/* { dg-final { scan-assembler-times "uiret" "2" } } */
+/* { dg-final { scan-assembler-times "add\[lq]\[ \t]\+\\\$8, %\[er\]sp" "2" } } */
#include <x86gprintrin.h>
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
void
__attribute__((interrupt))
-foo (void *frame)
+foo (void *frame, uword_t uirrv)
{
}
void
__attribute__((interrupt))
-UINTR_hanlder (struct __uintr_frame *frame)
+UINTR_hanlder (struct __uintr_frame *frame, uword_t uirrv)
{
}
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -muintr" } */
/* { dg-final { scan-assembler "uiret" } } */
+/* { dg-final { scan-assembler "add\[lq]\[ \t]\+\\\$8, %\[er\]sp" } } */
+
#include <x86gprintrin.h>
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
void __attribute__ ((target("general-regs-only"), interrupt))
-UINTR_handler (struct __uintr_frame *p)
+UINTR_handler (struct __uintr_frame *p, uword_t uirrv)
{
}
#include <x86gprintrin.h>
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
void __attribute__ ((interrupt))
-UINTR_handler (struct __uintr_frame *p)
-{ /* { dg-message "SSE instructions aren't allowed in an interrupt service routine" } */
+UINTR_handler (struct __uintr_frame *p, uword_t uirrv)
+{ /* { dg-message "SSE instructions aren't allowed in an exception service routine" } */
}
#include <x86gprintrin.h>
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+
void
-UINTR_hanlder (struct __uintr_frame *frame)
+UINTR_hanlder (struct __uintr_frame *frame, uword_t uirrv)
{
}