Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_NOPS_H
0003 #define _ASM_X86_NOPS_H
0004 
0005 #include <asm/asm.h>
0006 
0007 /*
0008  * Define nops for use with alternative() and for tracing.
0009  */
0010 
0011 #ifndef CONFIG_64BIT
0012 
0013 /*
0014  * Generic 32bit nops from GAS:
0015  *
0016  * 1: nop
0017  * 2: movl %esi,%esi
0018  * 3: leal 0x0(%esi),%esi
0019  * 4: leal 0x0(%esi,%eiz,1),%esi
0020  * 5: leal %ds:0x0(%esi,%eiz,1),%esi
0021  * 6: leal 0x0(%esi),%esi
0022  * 7: leal 0x0(%esi,%eiz,1),%esi
0023  * 8: leal %ds:0x0(%esi,%eiz,1),%esi
0024  *
0025  * Except 5 and 8, which are DS prefixed 4 and 7 resp, where GAS would emit 2
0026  * nop instructions.
0027  */
0028 #define BYTES_NOP1  0x90
0029 #define BYTES_NOP2  0x89,0xf6
0030 #define BYTES_NOP3  0x8d,0x76,0x00
0031 #define BYTES_NOP4  0x8d,0x74,0x26,0x00
0032 #define BYTES_NOP5  0x3e,BYTES_NOP4
0033 #define BYTES_NOP6  0x8d,0xb6,0x00,0x00,0x00,0x00
0034 #define BYTES_NOP7  0x8d,0xb4,0x26,0x00,0x00,0x00,0x00
0035 #define BYTES_NOP8  0x3e,BYTES_NOP7
0036 
0037 #else
0038 
0039 /*
0040  * Generic 64bit nops from GAS:
0041  *
0042  * 1: nop
0043  * 2: osp nop
0044  * 3: nopl (%eax)
0045  * 4: nopl 0x00(%eax)
0046  * 5: nopl 0x00(%eax,%eax,1)
0047  * 6: osp nopl 0x00(%eax,%eax,1)
0048  * 7: nopl 0x00000000(%eax)
0049  * 8: nopl 0x00000000(%eax,%eax,1)
0050  */
0051 #define BYTES_NOP1  0x90
0052 #define BYTES_NOP2  0x66,BYTES_NOP1
0053 #define BYTES_NOP3  0x0f,0x1f,0x00
0054 #define BYTES_NOP4  0x0f,0x1f,0x40,0x00
0055 #define BYTES_NOP5  0x0f,0x1f,0x44,0x00,0x00
0056 #define BYTES_NOP6  0x66,BYTES_NOP5
0057 #define BYTES_NOP7  0x0f,0x1f,0x80,0x00,0x00,0x00,0x00
0058 #define BYTES_NOP8  0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00
0059 
0060 #endif /* CONFIG_64BIT */
0061 
0062 #define ASM_NOP1 _ASM_BYTES(BYTES_NOP1)
0063 #define ASM_NOP2 _ASM_BYTES(BYTES_NOP2)
0064 #define ASM_NOP3 _ASM_BYTES(BYTES_NOP3)
0065 #define ASM_NOP4 _ASM_BYTES(BYTES_NOP4)
0066 #define ASM_NOP5 _ASM_BYTES(BYTES_NOP5)
0067 #define ASM_NOP6 _ASM_BYTES(BYTES_NOP6)
0068 #define ASM_NOP7 _ASM_BYTES(BYTES_NOP7)
0069 #define ASM_NOP8 _ASM_BYTES(BYTES_NOP8)
0070 
0071 #define ASM_NOP_MAX 8
0072 
0073 #ifndef __ASSEMBLY__
0074 extern const unsigned char * const x86_nops[];
0075 #endif
0076 
0077 #endif /* _ASM_X86_NOPS_H */