diff options
author | Bradley Smith <bradjsmith@btinternet.com> | 2008-02-07 03:16:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:33 -0500 |
commit | fe04f22fd2bc84dfcc0ef1c7acb863bd98b9ac93 (patch) | |
tree | 8e0af562cd03fd5bfef643c9bdd98c23a72f5e7b /drivers/char/i8k.c | |
parent | 9a7744f9823b9ddf14c47c475e81c1326b1a2787 (diff) |
I8K: allow i8k driver to be built on x86_64 systems
Adds #if clause and additional inline assembly so that the driver
builds on x86_64 systems.
Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>
Cc: Frank Sorenson <frank@tuxrocks.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/i8k.c')
-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 | ||