Re: swsusp: Remove arch-specific references from generic code

From: Rafael J. Wysocki
Date: Sat Mar 19 2005 - 05:58:23 EST


Hi,

On Wednesday, 16 of March 2005 01:12, Pavel Machek wrote:
> Hi!
>
> This is fix for "swsusp_restore crap"-: we had some i386-specific code
> referenced from generic code. This fixes it by inlining tlb_flush_all
> into assembly.
>
> Please apply,

Unfortunately, this patch requires the following fix. Without it, swsusp will
leak lots of memory on every resume. Sorry for this bug, it was really dumb.

Rafael


Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>

diff -Nrup linux-2.6.12-rc1-a/arch/i386/power/swsusp.S linux-2.6.12-rc1-b/arch/i386/power/swsusp.S
--- linux-2.6.12-rc1-a/arch/i386/power/swsusp.S 2005-03-19 11:51:02.000000000 +0100
+++ linux-2.6.12-rc1-b/arch/i386/power/swsusp.S 2005-03-19 11:52:37.000000000 +0100
@@ -68,4 +68,6 @@ done:

pushl saved_context_eflags ; popfl

+ xorl %eax, %eax
+
ret
diff -Nrup linux-2.6.12-rc1-a/arch/x86_64/kernel/suspend_asm.S linux-2.6.12-rc1-b/arch/x86_64/kernel/suspend_asm.S
--- linux-2.6.12-rc1-a/arch/x86_64/kernel/suspend_asm.S 2005-03-19 11:51:02.000000000 +0100
+++ linux-2.6.12-rc1-b/arch/x86_64/kernel/suspend_asm.S 2005-03-19 11:52:10.000000000 +0100
@@ -83,7 +83,7 @@ done:

movq saved_context_esp(%rip), %rsp
movq saved_context_ebp(%rip), %rbp
- movq saved_context_eax(%rip), %rax
+ /* Don't restore %rax, it must be 0 */
movq saved_context_ebx(%rip), %rbx
movq saved_context_ecx(%rip), %rcx
movq saved_context_edx(%rip), %rdx
@@ -99,4 +99,6 @@ done:
movq saved_context_r15(%rip), %r15
pushq saved_context_eflags(%rip) ; popfq

+ xorq %rax, %rax
+
ret

--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/