Skip to content

Commit 30c9ca1

Browse files
ardbiesheuvelsuryasaimadhu
authored andcommitted
x86/boot/compressed: Adhere to calling convention in get_sev_encryption_bit()
Make get_sev_encryption_bit() follow the ordinary i386 calling convention, and only call it if CONFIG_AMD_MEM_ENCRYPT is actually enabled. This clarifies the calling code, and makes it more maintainable. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9d7eaae commit 30c9ca1

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

arch/x86/boot/compressed/head_64.S

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,13 @@ SYM_FUNC_START(startup_32)
180180
*/
181181
/*
182182
* If SEV is active then set the encryption mask in the page tables.
183-
* This will insure that when the kernel is copied and decompressed
183+
* This will ensure that when the kernel is copied and decompressed
184184
* it will be done so encrypted.
185185
*/
186-
call get_sev_encryption_bit
187186
xorl %edx, %edx
188187
#ifdef CONFIG_AMD_MEM_ENCRYPT
188+
call get_sev_encryption_bit
189+
xorl %edx, %edx
189190
testl %eax, %eax
190191
jz 1f
191192
subl $32, %eax /* Encryption bit is always above bit 31 */

arch/x86/boot/compressed/mem_encrypt.S

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
.text
1919
.code32
2020
SYM_FUNC_START(get_sev_encryption_bit)
21-
xor %eax, %eax
22-
23-
#ifdef CONFIG_AMD_MEM_ENCRYPT
2421
push %ebx
25-
push %ecx
26-
push %edx
2722

2823
movl $0x80000000, %eax /* CPUID to check the highest leaf */
2924
cpuid
@@ -54,12 +49,7 @@ SYM_FUNC_START(get_sev_encryption_bit)
5449
xor %eax, %eax
5550

5651
.Lsev_exit:
57-
pop %edx
58-
pop %ecx
5952
pop %ebx
60-
61-
#endif /* CONFIG_AMD_MEM_ENCRYPT */
62-
6353
RET
6454
SYM_FUNC_END(get_sev_encryption_bit)
6555

0 commit comments

Comments
 (0)