diff options
| -rw-r--r-- | drivers/char/i8k.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 179223a17414..3d181021a862 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
| @@ -113,6 +113,33 @@ static int i8k_smm(struct smm_regs *regs) | |||
| 113 | int rc; | 113 | int rc; |
| 114 | int eax = regs->eax; | 114 | int eax = regs->eax; |
| 115 | 115 | ||
| 116 | #if defined(CONFIG_X86_64) | ||
| 117 | asm("pushq %%rax\n\t" | ||
| 118 | "movl 0(%%rax),%%edx\n\t" | ||
| 119 | "pushq %%rdx\n\t" | ||
| 120 | "movl 4(%%rax),%%ebx\n\t" | ||
| 121 | "movl 8(%%rax),%%ecx\n\t" | ||
| 122 | "movl 12(%%rax),%%edx\n\t" | ||
| 123 | "movl 16(%%rax),%%esi\n\t" | ||
| 124 | "movl 20(%%rax),%%edi\n\t" | ||
| 125 | "popq %%rax\n\t" | ||
| 126 | "out %%al,$0xb2\n\t" | ||
| 127 | "out %%al,$0x84\n\t" | ||
| 128 | "xchgq %%rax,(%%rsp)\n\t" | ||
| 129 | "movl %%ebx,4(%%rax)\n\t" | ||
| 130 | "movl %%ecx,8(%%rax)\n\t" | ||
| 131 | "movl %%edx,12(%%rax)\n\t" | ||
| 132 | "movl %%esi,16(%%rax)\n\t" | ||
| 133 | "movl %%edi,20(%%rax)\n\t" | ||
| 134 | "popq %%rdx\n\t" | ||
| 135 | "movl %%edx,0(%%rax)\n\t" | ||
| 136 | "lahf\n\t" | ||
| 137 | "shrl $8,%%eax\n\t" | ||
| 138 | "andl $1,%%eax\n" | ||
| 139 | :"=a"(rc) | ||
| 140 | : "a"(regs) | ||
| 141 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | ||
| 142 | #else | ||
| 116 | asm("pushl %%eax\n\t" | 143 | asm("pushl %%eax\n\t" |
| 117 | "movl 0(%%eax),%%edx\n\t" | 144 | "movl 0(%%eax),%%edx\n\t" |
| 118 | "push %%edx\n\t" | 145 | "push %%edx\n\t" |
| @@ -137,7 +164,7 @@ static int i8k_smm(struct smm_regs *regs) | |||
| 137 | "andl $1,%%eax\n":"=a"(rc) | 164 | "andl $1,%%eax\n":"=a"(rc) |
| 138 | : "a"(regs) | 165 | : "a"(regs) |
| 139 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | 166 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); |
| 140 | 167 | #endif | |
| 141 | if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax) | 168 | if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax) |
| 142 | return -EINVAL; | 169 | return -EINVAL; |
| 143 | 170 | ||
