| 1 |
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } */ |
| 2 |
/* { dg-options "-g -muintr -mgeneral-regs-only" } */ |
| 3 |
|
| 4 |
#include <x86gprintrin.h> |
| 5 |
|
| 6 |
extern void exit (int); |
| 7 |
typedef unsigned int uword_t __attribute__ ((mode (__word__))); |
| 8 |
typedef int aligned __attribute__((aligned(64))); |
| 9 |
|
| 10 |
#define UIRRV 0x12345670 |
| 11 |
#define RIP 0x12345671 |
| 12 |
#define RFLAGS 0x12345672 |
| 13 |
#define RSP 0x12345673 |
| 14 |
|
| 15 |
#define STRING(x) XSTRING(x) |
| 16 |
#define XSTRING(x) #x |
| 17 |
#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) |
| 18 |
#define ASMNAME2(prefix, cname) XSTRING (prefix) cname |
| 19 |
|
| 20 |
int |
| 21 |
check_int (int *i, int align) |
| 22 |
{ |
| 23 |
*i = 20; |
| 24 |
if ((((ptrdiff_t) i) & (align - 1)) != 0) |
| 25 |
__builtin_abort (); |
| 26 |
return *i; |
| 27 |
} |
| 28 |
|
| 29 |
void |
| 30 |
__attribute__((interrupt, used)) |
| 31 |
fn (struct __uintr_frame *frame, uword_t uirrv) |
| 32 |
{ |
| 33 |
aligned i; |
| 34 |
if (check_int (&i, __alignof__(i)) != i) |
| 35 |
__builtin_abort (); |
| 36 |
|
| 37 |
if (UIRRV != uirrv) /* BREAK */ |
| 38 |
__builtin_abort (); |
| 39 |
if (RIP != frame->rip) |
| 40 |
__builtin_abort (); |
| 41 |
if (RFLAGS != frame->rflags) |
| 42 |
__builtin_abort (); |
| 43 |
if (RSP != frame->rsp) |
| 44 |
__builtin_abort (); |
| 45 |
|
| 46 |
exit (0); |
| 47 |
} |
| 48 |
|
| 49 |
int |
| 50 |
main () |
| 51 |
{ |
| 52 |
asm ("push $" STRING (RSP) "; \ |
| 53 |
push $" STRING (RFLAGS) "; \ |
| 54 |
push $" STRING (RIP) "; \ |
| 55 |
push $" STRING (UIRRV) "; \ |
| 56 |
jmp " ASMNAME ("fn")); |
| 57 |
return 0; |
| 58 |
} |
| 59 |
|
| 60 |
/* { dg-final { gdb-test 34 "uirrv" "0x12345670" } } */ |
| 61 |
/* { dg-final { gdb-test 34 "frame->rip" "0x12345671" } } */ |
| 62 |
/* { dg-final { gdb-test 34 "frame->rflags" "0x12345672" } } */ |
| 63 |
/* { dg-final { gdb-test 34 "frame->rsp" "0x12345673" } } */ |