summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/spalign.c
blob: 0b776e17ccae968126a96c1e13a7f0cc69ec998f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "Rts.h"

#ifdef darwin_HOST_OS
#define STG_GLOBAL ".globl "
#else
#define STG_GLOBAL ".global "
#endif

#ifdef LEADING_UNDERSCORE
#define GETESP "_getesp"
#else
#define GETESP "getesp"
#endif

void __dummy__(void)
{
        __asm__ volatile (
        STG_GLOBAL GETESP "\n"
        GETESP ":\n\t"

#if defined(i386_HOST_ARCH)
        "movl %%esp, %%eax\n\t"
#elif defined(x86_64_HOST_ARCH)
        "movq %%rsp, %%rax\n\t"
#else
#error splign.c: not implemented for this architecture
#endif
        "ret"
        : : );
}