| 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 |
|
| 9 |
#define UIRRV 0x12345670 |
| 10 |
#define RIP 0x12345671 |
| 11 |
#define RFLAGS 0x12345672 |
| 12 |
#define RSP 0x12345673 |
| 13 |
|
| 14 |
#define STRING(x) XSTRING(x) |
| 15 |
#define XSTRING(x) #x |
| 16 |
#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) |
| 17 |
#define ASMNAME2(prefix, cname) XSTRING (prefix) cname |
| 18 |
|
| 19 |
void |
| 20 |
__attribute__((interrupt, used)) |
| 21 |
fn (struct __uintr_frame *frame, uword_t uirrv) |
| 22 |
{ |
| 23 |
if (UIRRV != uirrv) /* BREAK */ |
| 24 |
__builtin_abort (); |
| 25 |
if (RIP != frame->rip) |
| 26 |
__builtin_abort (); |
| 27 |
if (RFLAGS != frame->rflags) |
| 28 |
__builtin_abort (); |
| 29 |
if (RSP != frame->rsp) |
| 30 |
__builtin_abort (); |
| 31 |
|
| 32 |
exit (0); |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
main () |
| 37 |
{ |
| 38 |
asm ("push $" STRING (RSP) "; \ |
| 39 |
push $" STRING (RFLAGS) "; \ |
| 40 |
push $" STRING (RIP) "; \ |
| 41 |
push $" STRING (UIRRV) "; \ |
| 42 |
jmp " ASMNAME ("fn")); |
| 43 |
return 0; |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-final { gdb-test 22 "uirrv" "0x12345670" } } */ |
| 47 |
/* { dg-final { gdb-test 22 "frame->rip" "0x12345671" } } */ |
| 48 |
/* { dg-final { gdb-test 22 "frame->rflags" "0x12345672" } } */ |
| 49 |
/* { dg-final { gdb-test 22 "frame->rsp" "0x12345673" } } */ |