Andi Kleen | bd61643 | 2008-01-30 13:32:38 +0100 | [diff] [blame] | 1 | #ifndef _ASM_NOPS_H |
| 2 | #define _ASM_NOPS_H 1 |
| 3 | |
| 4 | /* Define nops for use with alternative() */ |
| 5 | |
| 6 | /* generic versions from gas */ |
| 7 | #define GENERIC_NOP1 ".byte 0x90\n" |
| 8 | #define GENERIC_NOP2 ".byte 0x89,0xf6\n" |
| 9 | #define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n" |
| 10 | #define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n" |
| 11 | #define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4 |
| 12 | #define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n" |
| 13 | #define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n" |
| 14 | #define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7 |
| 15 | |
| 16 | /* Opteron 64bit nops */ |
| 17 | #define K8_NOP1 GENERIC_NOP1 |
| 18 | #define K8_NOP2 ".byte 0x66,0x90\n" |
| 19 | #define K8_NOP3 ".byte 0x66,0x66,0x90\n" |
| 20 | #define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n" |
| 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 | /* K7 nops */ |
| 27 | /* uses eax dependencies (arbitary choice) */ |
| 28 | #define K7_NOP1 GENERIC_NOP1 |
| 29 | #define K7_NOP2 ".byte 0x8b,0xc0\n" |
| 30 | #define K7_NOP3 ".byte 0x8d,0x04,0x20\n" |
| 31 | #define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n" |
| 32 | #define K7_NOP5 K7_NOP4 ASM_NOP1 |
| 33 | #define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n" |
| 34 | #define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" |
| 35 | #define K7_NOP8 K7_NOP7 ASM_NOP1 |
| 36 | |
| 37 | /* P6 nops */ |
| 38 | /* uses eax dependencies (Intel-recommended choice) */ |
| 39 | #define P6_NOP1 GENERIC_NOP1 |
| 40 | #define P6_NOP2 ".byte 0x66,0x90\n" |
| 41 | #define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" |
| 42 | #define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" |
| 43 | #define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" |
| 44 | #define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" |
| 45 | #define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" |
| 46 | #define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" |
| 47 | |
| 48 | #if defined(CONFIG_MK8) |
| 49 | #define ASM_NOP1 K8_NOP1 |
| 50 | #define ASM_NOP2 K8_NOP2 |
| 51 | #define ASM_NOP3 K8_NOP3 |
| 52 | #define ASM_NOP4 K8_NOP4 |
| 53 | #define ASM_NOP5 K8_NOP5 |
| 54 | #define ASM_NOP6 K8_NOP6 |
| 55 | #define ASM_NOP7 K8_NOP7 |
| 56 | #define ASM_NOP8 K8_NOP8 |
| 57 | #elif defined(CONFIG_MK7) |
| 58 | #define ASM_NOP1 K7_NOP1 |
| 59 | #define ASM_NOP2 K7_NOP2 |
| 60 | #define ASM_NOP3 K7_NOP3 |
| 61 | #define ASM_NOP4 K7_NOP4 |
| 62 | #define ASM_NOP5 K7_NOP5 |
| 63 | #define ASM_NOP6 K7_NOP6 |
| 64 | #define ASM_NOP7 K7_NOP7 |
| 65 | #define ASM_NOP8 K7_NOP8 |
| 66 | #elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ |
| 67 | defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ |
| 68 | defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) |
| 69 | #define ASM_NOP1 P6_NOP1 |
| 70 | #define ASM_NOP2 P6_NOP2 |
| 71 | #define ASM_NOP3 P6_NOP3 |
| 72 | #define ASM_NOP4 P6_NOP4 |
| 73 | #define ASM_NOP5 P6_NOP5 |
| 74 | #define ASM_NOP6 P6_NOP6 |
| 75 | #define ASM_NOP7 P6_NOP7 |
| 76 | #define ASM_NOP8 P6_NOP8 |
| 77 | #else |
| 78 | #define ASM_NOP1 GENERIC_NOP1 |
| 79 | #define ASM_NOP2 GENERIC_NOP2 |
| 80 | #define ASM_NOP3 GENERIC_NOP3 |
| 81 | #define ASM_NOP4 GENERIC_NOP4 |
| 82 | #define ASM_NOP5 GENERIC_NOP5 |
| 83 | #define ASM_NOP6 GENERIC_NOP6 |
| 84 | #define ASM_NOP7 GENERIC_NOP7 |
| 85 | #define ASM_NOP8 GENERIC_NOP8 |
| 86 | #endif |
| 87 | |
| 88 | #define ASM_NOP_MAX 8 |
| 89 | |
| 90 | #endif |