1 #ifndef __X86_ASM_NOPS_H__ 2 #define __X86_ASM_NOPS_H__ 3 4 /* 5 * Define nops for use with alternative(). 6 */ 7 8 #define NOP_DS_PREFIX 0x3e 9 10 /* 11 * Opteron 64bit nops 12 * 1: nop 13 * 2: osp nop 14 * 3: osp osp nop 15 * 4: osp osp osp nop 16 */ 17 #define K8_NOP1 0x90 18 #define K8_NOP2 0x66,K8_NOP1 19 #define K8_NOP3 0x66,K8_NOP2 20 #define K8_NOP4 0x66,K8_NOP3 21 #define K8_NOP5 K8_NOP3,K8_NOP2 22 #define K8_NOP6 K8_NOP3,K8_NOP3 23 #define K8_NOP7 K8_NOP4,K8_NOP3 24 #define K8_NOP8 K8_NOP4,K8_NOP4 25 26 /* 27 * P6 nops 28 * uses eax dependencies (Intel-recommended choice) 29 * 1: nop 30 * 2: osp nop 31 * 3: nopl (%eax) 32 * 4: nopl 0x00(%eax) 33 * 5: nopl 0x00(%eax,%eax,1) 34 * 6: osp nopl 0x00(%eax,%eax,1) 35 * 7: nopl 0x00000000(%eax) 36 * 8: nopl 0x00000000(%eax,%eax,1) 37 * Note: All the above are assumed to be a single instruction. 38 * There is kernel code that depends on this. 39 */ 40 #define P6_NOP1 0x90 41 #define P6_NOP2 0x66,0x90 42 #define P6_NOP3 0x0f,0x1f,0x00 43 #define P6_NOP4 0x0f,0x1f,0x40,0 44 #define P6_NOP5 0x0f,0x1f,0x44,0x00,0 45 #define P6_NOP6 0x66,0x0f,0x1f,0x44,0x00,0 46 #define P6_NOP7 0x0f,0x1f,0x80,0,0,0,0 47 #define P6_NOP8 0x0f,0x1f,0x84,0x00,0,0,0,0 48 49 #ifdef __ASSEMBLY__ 50 #define _ASM_MK_NOP(x) .byte x 51 #else 52 #define _ASM_MK_NOP(x) ".byte " __stringify(x) "\n" 53 #endif 54 55 #define ASM_NOP1 _ASM_MK_NOP(K8_NOP1) 56 #define ASM_NOP2 _ASM_MK_NOP(K8_NOP2) 57 #define ASM_NOP3 _ASM_MK_NOP(K8_NOP3) 58 #define ASM_NOP4 _ASM_MK_NOP(K8_NOP4) 59 #define ASM_NOP5 _ASM_MK_NOP(K8_NOP5) 60 #define ASM_NOP6 _ASM_MK_NOP(K8_NOP6) 61 #define ASM_NOP7 _ASM_MK_NOP(K8_NOP7) 62 #define ASM_NOP8 _ASM_MK_NOP(K8_NOP8) 63 64 #define ASM_NOP_MAX 8 65 66 #endif /* __X86_ASM_NOPS_H__ */ 67