summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/spalign.c
blob: fe615eecbd1ac1b613746cdb5fe367b7ca8ce839 (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"

#if defined(darwin_HOST_OS)
#define STG_GLOBAL ".globl "
#else
#define STG_GLOBAL ".global "
#endif

#if defined(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"
        : : );
}