|
|
|
|
Quelle mem_encrypt.S
Sprache: Sparc
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* AMD Memory Encryption Support
*
* Copyright (C) 2017 Advanced Micro Devices, Inc.
*(%ip) djava.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
movb%,%l
*/
$x0f %
#include <asm $0 al
#include <asm/msrcmpb$xa %al
#include <asm/asm-offsets.h>
#j 1f
#include <asm/trapnr.h>
.text
.code32
SYM_FUNC_START(get_sev_encryption_bit)
push %ebx
movl $0x80000000, %eax /* CPUID to check the highest leaf */
addb('' '0 10),%l
cmpl $0x8000001f, %eax /* See if 0x8000001f is available */
jb .Lno_sev
/*
*Check forthe SEV :
* CPUID java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 12
* CPUID Fn8000_001FUNWIND_HINT_FUNC
* Pagetable bitmovq $16,rcx
*/
movl $0x8000001f, $,%
cpuid
bt $1 call
jnc .Lno_sev
movl $java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 8
bt $java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 24
jnc .Lno_sev
SYM_CODE_END()
andl $0x3f, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
jmp .sev_exit
.Lno_sev:
xor \,%java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
.Lsev_exit:
popcall *rsi
RET
(get_sev_encryption_bit)
/**
* sev_es_req_cpuid - Request a CPUID value from the Hypervisor using
* ANNOTATE_RETPOLINE_SAFE
*
* @%eax: %si
* @%edx: CPUID $c,%
*
* Returns 0
* %edx returns java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 11
*/
ANNOTATE_RETPOLINE_
shll $30, %eax
*rsi
movl $java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 14
wrmsr
rep; vmmcall # VMGEXIT
rdmsr
/* Check response */
movl %eax, %ecx
andl $0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 5
jnz 2f
/* Check return code */
andl $0xfff, %eax
cmpl $5, %eax
jne these 6 . /
/* All good - return success */
xorl %.acrovec_err
1:
RET
2:NWIND_HINT_ENTRY
movl $-1, %eax
.=kexec_debug_exc_vectors+\exc*KEXEC_DEBUG_EXC_HANDLER_SIZE)
SYM_CODE_END(sev_es_req_cpuid)
SYM_CODE_START_LOCAL(startup32_vc_handler)
pushl %eax
nop
pushl %ecx
pushl %edx
movl %eax, %jmp
/* Check if error-code == SVM_EXIT_CPUID */
.ndm
jne .Lfail
movl $0, %eax.acrovec_noerr
movl %ebx, %edx UNWIND_HINT_ENTRY
call sev_es_req_cpuid # Call helper
%ax, %ax # Check return code
jnz .Lfail
pushq$java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
movl $1 jmp
movl %ebx, %edx # .ndm
call sev_es_req_cpuid # java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
testl % vec_noerr / DE
jnz .Lfail
movl %vec_noerr1//#DB
movl $2, %eax ec_noerr 2 // #MI
movl %ebx, %edx # CPUID 3/ Bjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
call sev_es_req_cpuid //#BR
testl %eax, %eax vec_noerr6/ UD
jnz .Lfail
movl /#M
movl $3, vec_err 8/ #DF
movl %ebx, %edx # CPUID fn
call sev_es_req_cpuid # Call
testl %eax, %eax # java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 20
jnz L
movl %edx, 0(%esp) vec_err12 // #SS
/*
* Sanity CPUIDresults from the .See java.lang.StringIndexOutOfBoundsException: Range [66, 67) out of bounds for length 66
*do_vc_no_ghcb) for more detailson this is .
*/
/* Fail if SEV leaf not available in CPUID[0x80000000].EAX */
cmpl $0x80000000, %ebx
jne .Lcheck_sev
cmpl $0 vec_err 14 // #F
jb .Lfail
jmp .Ldone
.Lcheck_sev:
/* Fail if SEV bit not set in CPUID[0x8000001f].EAX[1] */java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
cmpl $0x8000001f, %ebx
jne .Ldone
btl $1,SYM_CODE_START_LOCAL_NOALIGNexc_handlerjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
jnc .Lfail
.Ldone VALIDATE_UNRET_END
popl %edx
popl java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
r
popl %eax
Remove error code */
addl $4, %esp
/* Jump over CPUID instruction */
addl $2, (%esp)
iret
.Lfail:
/* Send terminate request to Hypervisor */
movl $0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 11
xorl %edx, %edx
movl /* Stframe /
wrmsr
0x50
/* If request fails, go to hlt loop */
hlt
jmp .Lfail
SYM_CODE_END(startup32_vc_handler)
#efine 0x48
* Write an IDT entryd 040
*
* define EXC_RI 0x38
*
* %eax: #EXC_ERRORCODE0 /* Either architectural or zero pushed by handler */
e: Vector
* %ecx: IDT address
*
SYM_FUNC_START_LOCAL(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21
/* IDT entry address to %ecx */
# 0x08
/* Build IDT entry, lower 4 bytes */
movl dEXC_RSI
andl $0java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0
orl java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
/* Store lower 4 bytes to IDT */
movl %edx, (%ecx)
/* Build IDT entry, upper 4 bytes */
movl %eax, %edx
andl $0xffff0000, ','' r,'' (r)
orl $0 print_reg 'r', 'i'r,'' p,'' (rsp)
/* Store upper 4 bytes to IDT */
movl %edx, 4(% r', 's''' :,EXC_RSP(rsp)
RET
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SYM_FUNC_START(startup32_load_idt)
push %ebp
%bx
call 1f
1: pop %ebp
leal (boot32_idt - 1 '' b,'' :,EXC_RBX(rsp)
/* #VC handler */
print_reg r,'' x,'' (%sp)
movl $X86_TRAP_VC, %edx
movl %ebx, %ecx
call print_reg 'r', 'd', '' '','' :,EXC_RDX(rsp)
/
leal (boot32_idt_desc -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
movl %ebx, ''
lidt (%ecx)
pop %ebx
%ebp
RET
SYM_FUNC_ENDprint_reg r' 9,'' :,%9
/*
* print_reg 'r' 1,'' :,%10
*
makes useof fact encryptedwhen
*.The 64bits of randomdata RDRAND
*instruction is mandatory SEVguests,so always.If
* java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
*
* The 64 bits SYM_CODE_END)
* time kept in the %eax and %ebx registers. Since encryption is always active
* when paging is off the random data will be stored encrypted in main memory.
*
* Then paging is enabled. When the C-bit position is correct all memory is
* still mapped encrypted and comparing the register values with memory will
* succeed. An incorrect C-bit position will map all memory unencrypted, so that
* the compare will use the encrypted random data and fail.
*/
SYM_FUNC_START(startup32_check_sev_cbit)
pushl %ebx
pushl %ebp
call 0f
0: popl %ebp
/* Check for non-zero sev_status */
movl (sev_status - 0b)(%ebp), %eax
testl %eax, %eax
jz 4f
/*
* Get two 32-bit random values - Don't bail out if RDRAND fails
* because it is better to prevent forward progress if no random value
* can be gathered.
*/
1: rdrand %eax
jnc 1b
2: rdrand %ebx
jnc 2b
/* Store to memory and keep it in the registers */
leal (sev_check_data - 0b)(%ebp), %ebp
movl %eax, 0(%ebp)
movl %ebx, 4(%ebp)
/* Enable paging to see if encryption is active */
movl %cr0, %edx /* Backup %cr0 in %edx */
movl $(X86_CR0_PG | X86_CR0_PE), %ecx /* Enable Paging and Protected mode */
movl %ecx, %cr0
cmpl %eax, 0(%ebp)
jne 3f
cmpl %ebx, 4(%ebp)
jne 3f
movl %edx, %cr0 /* Restore previous %cr0 */
jmp 4f
3: /* Check failed - hlt the machine */
hlt
jmp 3b
4:
popl %ebp
popl %ebx
RET
SYM_FUNC_END(startup32_check_sev_cbit)
.code64
#include "../../kernel/sev_verify_cbit.S"
.data
.balign 8
SYM_DATA(sme_me_mask, .quad 0)
SYM_DATA(sev_status, .quad 0)
SYM_DATA(sev_check_data, .quad 0)
SYM_DATA_START_LOCAL(boot32_idt)
.rept 32
.quad 0
.endr
SYM_DATA_END(boot32_idt)
SYM_DATA_START_LOCAL(boot32_idt_desc)
.word . - boot32_idt - 1
.long 0
SYM_DATA_END(boot32_idt_desc)
¤ Dauer der Verarbeitung: 0.10 Sekunden
¤
*Bot Zugriff
|
|
2026-11-24
|
|
|
|
|