linux/arch/x86/include/asm/asm.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_ASM_H
#define _ASM_X86_ASM_H

#ifdef __ASSEMBLY__
#define __ASM_FORM(x, ...)
#define __ASM_FORM_RAW(x, ...)
#define __ASM_FORM_COMMA(x, ...)
#define __ASM_REGPFX
#else
#include <linux/stringify.h>
#define __ASM_FORM
#define __ASM_FORM_RAW
#define __ASM_FORM_COMMA
#define __ASM_REGPFX
#endif

#define _ASM_BYTES(x, ...)

#ifndef __x86_64__
/* 32 bit */
#define __ASM_SEL
#define __ASM_SEL_RAW
#else
/* 64 bit */
#define __ASM_SEL(a,b)
#define __ASM_SEL_RAW(a,b)
#endif

#define __ASM_SIZE(inst, ...)
#define __ASM_REG(reg)

#define _ASM_PTR
#define _ASM_ALIGN

#define _ASM_MOV
#define _ASM_INC
#define _ASM_DEC
#define _ASM_ADD
#define _ASM_SUB
#define _ASM_XADD
#define _ASM_MUL

#define _ASM_AX
#define _ASM_BX
#define _ASM_CX
#define _ASM_DX
#define _ASM_SP
#define _ASM_BP
#define _ASM_SI
#define _ASM_DI

/* Adds a (%rip) suffix on 64 bits only; for immediate memory references */
#define _ASM_RIP(x)

#ifndef __x86_64__
/* 32 bit */

#define _ASM_ARG1
#define _ASM_ARG2
#define _ASM_ARG3

#define _ASM_ARG1L
#define _ASM_ARG2L
#define _ASM_ARG3L

#define _ASM_ARG1W
#define _ASM_ARG2W
#define _ASM_ARG3W

#define _ASM_ARG1B
#define _ASM_ARG2B
#define _ASM_ARG3B

#else
/* 64 bit */

#define _ASM_ARG1
#define _ASM_ARG2
#define _ASM_ARG3
#define _ASM_ARG4
#define _ASM_ARG5
#define _ASM_ARG6

#define _ASM_ARG1Q
#define _ASM_ARG2Q
#define _ASM_ARG3Q
#define _ASM_ARG4Q
#define _ASM_ARG5Q
#define _ASM_ARG6Q

#define _ASM_ARG1L
#define _ASM_ARG2L
#define _ASM_ARG3L
#define _ASM_ARG4L
#define _ASM_ARG5L
#define _ASM_ARG6L

#define _ASM_ARG1W
#define _ASM_ARG2W
#define _ASM_ARG3W
#define _ASM_ARG4W
#define _ASM_ARG5W
#define _ASM_ARG6W

#define _ASM_ARG1B
#define _ASM_ARG2B
#define _ASM_ARG3B
#define _ASM_ARG4B
#define _ASM_ARG5B
#define _ASM_ARG6B

#endif

#ifndef __ASSEMBLY__
#ifndef __pic__
static __always_inline __pure void *rip_rel_ptr(void *p)
{
	asm("leaq %c1(%%rip), %0" : "=r"(p) : "i"(p));

	return p;
}
#define RIP_REL_REF
#else
#define RIP_REL_REF
#endif
#endif

/*
 * Macros to generate condition code outputs from inline assembly,
 * The output operand must be type "bool".
 */
#ifdef __GCC_ASM_FLAG_OUTPUTS__
#define CC_SET(c)
#define CC_OUT(c)
#else
#define CC_SET
#define CC_OUT
#endif

#ifdef __KERNEL__

# include <asm/extable_fixup_types.h>

/* Exception table entry */
#ifdef __ASSEMBLY__

#define _ASM_EXTABLE_TYPE(from, to, type)

# ifdef CONFIG_KPROBES
#define _ASM_NOKPROBE(entry)
# else
#define _ASM_NOKPROBE
# endif

#else /* ! __ASSEMBLY__ */

#define DEFINE_EXTABLE_TYPE_REG

#define UNDEFINE_EXTABLE_TYPE_REG

#define _ASM_EXTABLE_TYPE

#define _ASM_EXTABLE_TYPE_REG

/* For C file, we already have NOKPROBE_SYMBOL macro */

/*
 * This output constraint should be used for any inline asm which has a "call"
 * instruction.  Otherwise the asm may be inserted before the frame pointer
 * gets set up by the containing function.  If you forget to do this, objtool
 * may print a "call without frame pointer save/setup" warning.
 */
register unsigned long current_stack_pointer asm(_ASM_SP);
#define ASM_CALL_CONSTRAINT
#endif /* __ASSEMBLY__ */

#define _ASM_EXTABLE(from, to)

#define _ASM_EXTABLE_UA(from, to)

#define _ASM_EXTABLE_FAULT(from, to)

#endif /* __KERNEL__ */
#endif /* _ASM_X86_ASM_H */