Skip to content

Commit 0e2e160

Browse files
H. Peter AnvinIngo Molnar
authored andcommitted
x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
i386 and x86-64 uses different registers for arguments; make them available so we don't have to #ifdef in the actual code. Native size and specified size (q, l, w, b) versions are provided. Signed-off-by: H. Peter Anvin <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> Reviewed-by: Sedat Dilek <[email protected]> Acked-by: Juergen Gross <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent d03db2b commit 0e2e160

File tree

1 file changed

+59
-0
lines changed
  • arch/x86/include/asm

1 file changed

+59
-0
lines changed

arch/x86/include/asm/asm.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,65 @@
4646
#define _ASM_SI __ASM_REG(si)
4747
#define _ASM_DI __ASM_REG(di)
4848

49+
#ifndef __x86_64__
50+
/* 32 bit */
51+
52+
#define _ASM_ARG1 _ASM_AX
53+
#define _ASM_ARG2 _ASM_DX
54+
#define _ASM_ARG3 _ASM_CX
55+
56+
#define _ASM_ARG1L eax
57+
#define _ASM_ARG2L edx
58+
#define _ASM_ARG3L ecx
59+
60+
#define _ASM_ARG1W ax
61+
#define _ASM_ARG2W dx
62+
#define _ASM_ARG3W cx
63+
64+
#define _ASM_ARG1B al
65+
#define _ASM_ARG2B dl
66+
#define _ASM_ARG3B cl
67+
68+
#else
69+
/* 64 bit */
70+
71+
#define _ASM_ARG1 _ASM_DI
72+
#define _ASM_ARG2 _ASM_SI
73+
#define _ASM_ARG3 _ASM_DX
74+
#define _ASM_ARG4 _ASM_CX
75+
#define _ASM_ARG5 r8
76+
#define _ASM_ARG6 r9
77+
78+
#define _ASM_ARG1Q rdi
79+
#define _ASM_ARG2Q rsi
80+
#define _ASM_ARG3Q rdx
81+
#define _ASM_ARG4Q rcx
82+
#define _ASM_ARG5Q r8
83+
#define _ASM_ARG6Q r9
84+
85+
#define _ASM_ARG1L edi
86+
#define _ASM_ARG2L esi
87+
#define _ASM_ARG3L edx
88+
#define _ASM_ARG4L ecx
89+
#define _ASM_ARG5L r8d
90+
#define _ASM_ARG6L r9d
91+
92+
#define _ASM_ARG1W di
93+
#define _ASM_ARG2W si
94+
#define _ASM_ARG3W dx
95+
#define _ASM_ARG4W cx
96+
#define _ASM_ARG5W r8w
97+
#define _ASM_ARG6W r9w
98+
99+
#define _ASM_ARG1B dil
100+
#define _ASM_ARG2B sil
101+
#define _ASM_ARG3B dl
102+
#define _ASM_ARG4B cl
103+
#define _ASM_ARG5B r8b
104+
#define _ASM_ARG6B r9b
105+
106+
#endif
107+
49108
/*
50109
* Macros to generate condition code outputs from inline assembly,
51110
* The output operand must be type "bool".

0 commit comments

Comments
 (0)