Skip to content

Commit 0978d64

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/acpi: Use %rip-relative addressing in wakeup_64.S
This is a "nice-to-have" change with minor code generation benefits: - Instruction with %rip-relative address operand is one byte shorter than its absolute address counterpart, - it is also compatible with position independent executable (-fpie) builds, - it is also consistent with what the compiler emits by default when a symbol is accessed. No functional changes intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20231103104900.409470-1-ubizjak@gmail.com
1 parent 2adeed9 commit 0978d64

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

arch/x86/kernel/acpi/wakeup_64.S

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Hooray, we are in Long 64-bit mode (but still running in low memory)
1818
*/
1919
SYM_FUNC_START(wakeup_long64)
20-
movq saved_magic, %rax
20+
movq saved_magic(%rip), %rax
2121
movq $0x123456789abcdef0, %rdx
2222
cmpq %rdx, %rax
2323
je 2f
@@ -33,14 +33,14 @@ SYM_FUNC_START(wakeup_long64)
3333
movw %ax, %es
3434
movw %ax, %fs
3535
movw %ax, %gs
36-
movq saved_rsp, %rsp
36+
movq saved_rsp(%rip), %rsp
3737

38-
movq saved_rbx, %rbx
39-
movq saved_rdi, %rdi
40-
movq saved_rsi, %rsi
41-
movq saved_rbp, %rbp
38+
movq saved_rbx(%rip), %rbx
39+
movq saved_rdi(%rip), %rdi
40+
movq saved_rsi(%rip), %rsi
41+
movq saved_rbp(%rip), %rbp
4242

43-
movq saved_rip, %rax
43+
movq saved_rip(%rip), %rax
4444
ANNOTATE_RETPOLINE_SAFE
4545
jmp *%rax
4646
SYM_FUNC_END(wakeup_long64)
@@ -72,11 +72,11 @@ SYM_FUNC_START(do_suspend_lowlevel)
7272

7373
movq $.Lresume_point, saved_rip(%rip)
7474

75-
movq %rsp, saved_rsp
76-
movq %rbp, saved_rbp
77-
movq %rbx, saved_rbx
78-
movq %rdi, saved_rdi
79-
movq %rsi, saved_rsi
75+
movq %rsp, saved_rsp(%rip)
76+
movq %rbp, saved_rbp(%rip)
77+
movq %rbx, saved_rbx(%rip)
78+
movq %rdi, saved_rdi(%rip)
79+
movq %rsi, saved_rsi(%rip)
8080

8181
addq $8, %rsp
8282
movl $3, %edi

0 commit comments

Comments
 (0)