2020-03-29 13:49:57 +00:00
|
|
|
#ifndef __ARCH_COMMON_COMMON_DEFS_H
|
|
|
|
#define __ARCH_COMMON_COMMON_DEFS_H
|
|
|
|
|
|
|
|
#ifndef SETUP_FRAME
|
|
|
|
# define SETUP_FRAME(__proc)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PUSH_FRAME
|
|
|
|
# define PUSH_FRAME(__proc)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef POP_FRAME
|
|
|
|
# define POP_FRAME(__proc)
|
|
|
|
#endif
|
|
|
|
|
2020-03-29 14:03:18 +00:00
|
|
|
#ifndef ENT
|
|
|
|
# define ENT(__proc)
|
|
|
|
#endif
|
|
|
|
|
2020-03-30 05:02:49 +00:00
|
|
|
#ifndef TYPE
|
2021-01-03 02:34:13 +00:00
|
|
|
# ifdef __clang__
|
|
|
|
# define TYPE(__proc) // .type not supported
|
|
|
|
# else
|
|
|
|
# define TYPE(__proc) .type __proc, @function;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PROC_NAME
|
|
|
|
# ifdef __MACH__
|
|
|
|
# define PROC_NAME(__proc) _ ## __proc
|
|
|
|
# else
|
|
|
|
# define PROC_NAME(__proc) __proc
|
|
|
|
# endif
|
2020-03-30 05:02:49 +00:00
|
|
|
#endif
|
|
|
|
|
2020-03-29 13:49:57 +00:00
|
|
|
#define FUNC(__proc) \
|
2021-01-03 02:34:13 +00:00
|
|
|
.global PROC_NAME(__proc); \
|
2020-03-29 13:49:57 +00:00
|
|
|
.align 2; \
|
2020-03-30 05:02:49 +00:00
|
|
|
TYPE(__proc) \
|
2020-03-29 14:03:18 +00:00
|
|
|
ENT(__proc) \
|
2021-01-03 02:34:13 +00:00
|
|
|
PROC_NAME(__proc): \
|
2020-03-29 13:49:57 +00:00
|
|
|
SETUP_FRAME(__proc)
|
2020-04-10 18:23:39 +00:00
|
|
|
#ifdef __clang__
|
|
|
|
#define END(__proc)
|
|
|
|
#else
|
2020-03-29 13:49:57 +00:00
|
|
|
#define END(__proc) \
|
|
|
|
.end __proc; \
|
|
|
|
.size __proc,.-__proc;
|
2020-04-10 18:23:39 +00:00
|
|
|
#endif
|
2020-03-29 13:49:57 +00:00
|
|
|
|
2020-12-06 08:54:01 +00:00
|
|
|
#ifdef EXPORT_UNPREFIXED
|
2020-03-29 14:12:23 +00:00
|
|
|
#define ALIAS(__alias, __real) \
|
|
|
|
.weak __alias; \
|
|
|
|
__alias = __real;
|
2020-12-06 08:54:01 +00:00
|
|
|
#else
|
|
|
|
#define ALIAS(...)
|
|
|
|
#endif
|
2020-03-29 14:12:23 +00:00
|
|
|
|
2020-03-29 14:50:38 +00:00
|
|
|
#define REG_OFFSET(__reg) (MCONTEXT_GREGS + ((__reg) * REG_SZ))
|
2020-03-29 14:27:19 +00:00
|
|
|
|
2020-03-29 13:49:57 +00:00
|
|
|
#endif
|