public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
@ 2007-10-28 17:25 Bradley Smith
  2007-10-28 17:37 ` Adrian Bunk
  2007-10-28 17:59 ` Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Bradley Smith @ 2007-10-28 17:25 UTC (permalink / raw)
  To: linux-kernel, dz

From: Bradley Smith <bradjsmith@btinternet.com>

Adds #if clause and additional inline assembly so that the driver
builds on x86_64 systems.

Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>

---

--- linux-2.6/drivers/char/i8k.c.orig	2007-10-28 12:27:34.000000000 +0000
+++ linux-2.6/drivers/char/i8k.c	2007-10-28 14:27:56.000000000 +0000
@@ -113,6 +113,33 @@ static int i8k_smm(struct smm_regs *regs
 	int rc;
 	int eax = regs->eax;
 
+#if defined(__x86_64__)
+	asm("pushq %%rax\n\t"
+		"movl 0(%%rax),%%edx\n\t"
+		"pushq %%rdx\n\t"
+		"movl 4(%%rax),%%ebx\n\t"
+		"movl 8(%%rax),%%ecx\n\t"
+		"movl 12(%%rax),%%edx\n\t"
+		"movl 16(%%rax),%%esi\n\t"
+		"movl 20(%%rax),%%edi\n\t"
+		"popq %%rax\n\t"
+		"out %%al,$0xb2\n\t"
+		"out %%al,$0x84\n\t"
+		"xchgq %%rax,(%%rsp)\n\t"
+		"movl %%ebx,4(%%rax)\n\t"
+		"movl %%ecx,8(%%rax)\n\t"
+		"movl %%edx,12(%%rax)\n\t"
+		"movl %%esi,16(%%rax)\n\t"
+		"movl %%edi,20(%%rax)\n\t"
+		"popq %%rdx\n\t"
+		"movl %%edx,0(%%rax)\n\t"
+		"lahf\n\t"
+		"shrl $8,%%eax\n\t"
+		"andl $1,%%eax\n"
+		:"=a"(rc)
+		:    "a"(regs)
+		:    "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
+#else
 	asm("pushl %%eax\n\t"
 	    "movl 0(%%eax),%%edx\n\t"
 	    "push %%edx\n\t"
@@ -137,7 +164,7 @@ static int i8k_smm(struct smm_regs *regs
 	    "andl $1,%%eax\n":"=a"(rc)
 	    :    "a"(regs)
 	    :    "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
-
+#endif
 	if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
 		return -EINVAL;
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-29  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-28 17:25 [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems Bradley Smith
2007-10-28 17:37 ` Adrian Bunk
2007-10-28 23:19   ` Bradley Smith
2007-10-28 17:59 ` Jeff Garzik
2007-10-28 18:03   ` Bradley Smith
2007-10-29  6:12   ` Frank Sorenson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox