lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434288190-24993-3-git-send-email-dvlasenk@redhat.com>
Date:	Sun, 14 Jun 2015 15:23:10 +0200
From:	Denys Vlasenko <dvlasenk@...hat.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Denys Vlasenko <dvlasenk@...hat.com>, Pavel Machek <pavel@....cz>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Borislav Petkov <bp@...en8.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Oleg Nesterov <oleg@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Will Drewry <wad@...omium.org>,
	Kees Cook <keescook@...omium.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] x86, acpi: Fold {save,restore}_registers into their single callers

This change simply block-moves bodies of "save_registers"
and "restore_registers" routines into their callers.

Well, almost. In save_registers, we were saving %esp+4
to saved_context_esp, because we were in a subroutine,
there was one additional word (return address) on stack.
Now it is gone, and we are saving %esp to saved_context_esp.

(The patch looks more confusing than the change really is.)

Run-tested.

Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
CC: Pavel Machek <pavel@....cz>
CC: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Steven Rostedt <rostedt@...dmis.org>
CC: Ingo Molnar <mingo@...nel.org>
CC: Borislav Petkov <bp@...en8.de>
CC: "H. Peter Anvin" <hpa@...or.com>
CC: Andy Lutomirski <luto@...capital.net>
CC: Oleg Nesterov <oleg@...hat.com>
CC: Frederic Weisbecker <fweisbec@...il.com>
CC: Alexei Starovoitov <ast@...mgrid.com>
CC: Will Drewry <wad@...omium.org>
CC: Kees Cook <keescook@...omium.org>
CC: x86@...nel.org
CC: linux-kernel@...r.kernel.org
---
 arch/x86/kernel/acpi/wakeup_32.S | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 5fec9b0..b8ab4d3 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -36,13 +36,13 @@ bogus_magic:
 	jmp	bogus_magic
 
 
-save_registers:
+ENTRY(do_suspend_lowlevel)
+	call	save_processor_state
+
 	sidt	saved_idt
 	sldt	saved_ldt
 	str	saved_tss
-
-	leal	4(%esp), %eax
-	movl	%eax, saved_context_esp
+	movl	%esp, saved_context_esp
 	movl	%ebx, saved_context_ebx
 	movl	%ebp, saved_context_ebp
 	movl	%esi, saved_context_esi
@@ -50,28 +50,19 @@ save_registers:
 	pushfl
 	popl	saved_context_eflags
 
-	ret
-
+	pushl	$3
+	call	x86_acpi_enter_sleep_state
+	addl	$4, %esp
+# If S3 fails, we simply fall through to S3 wakeup code:
 
-restore_registers:
+ret_point:
 	movl	saved_context_ebp, %ebp
 	movl	saved_context_ebx, %ebx
 	movl	saved_context_esi, %esi
 	movl	saved_context_edi, %edi
 	pushl	saved_context_eflags
 	popfl
-	ret
-
-ENTRY(do_suspend_lowlevel)
-	call	save_processor_state
-	call	save_registers
-	pushl	$3
-	call	x86_acpi_enter_sleep_state
-	addl	$4, %esp
-# If S3 fails, we simply fall through to S3 wakeup code:
 
-ret_point:
-	call	restore_registers
 	call	restore_processor_state
 	ret
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ