lkml.org 
[lkml]   [2021]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH v2 06/69] KVM: TDX: add a helper function for kvm to call seamcall
Date
On 03/07/21 00:04, isaku.yamahata@intel.com wrote:
> +
> +.Lseamcall:
> + seamcall
> + jmp .Lseamcall_ret
> +.Lspurious_fault:
> + call kvm_spurious_fault
> +.Lseamcall_ret:
> +
> + movq (FRAME_OFFSET + 8)(%rsp), %rdi
> + testq %rdi, %rdi
> + jz 1f
> +
> + /* If ex is non-NULL, store extra return values into it. */
> + movq %rcx, TDX_SEAM_rcx(%rdi)
> + movq %rdx, TDX_SEAM_rdx(%rdi)
> + movq %r8, TDX_SEAM_r8(%rdi)
> + movq %r9, TDX_SEAM_r9(%rdi)
> + movq %r10, TDX_SEAM_r10(%rdi)
> + movq %r11, TDX_SEAM_r11(%rdi)
> +
> +1:
> + FRAME_END
> + ret
> +
> + _ASM_EXTABLE(.Lseamcall, .Lspurious_fault)

Please use local labels and avoid unnecessary jmp, for example

1:
seamcall
movq (FRAME_OFFSET + 8)(%rsp), %rdi
testq %rdi, %rdi
jz 2f

/* If ex is non-NULL, store extra return values into it. */
movq %rcx, TDX_SEAM_rcx(%rdi)
movq %rdx, TDX_SEAM_rdx(%rdi)
movq %r8, TDX_SEAM_r8(%rdi)
movq %r9, TDX_SEAM_r9(%rdi)
movq %r10, TDX_SEAM_r10(%rdi)
movq %r11, TDX_SEAM_r11(%rdi)
2:
FRAME_END
ret
3:
/* Probably it helps to write an error code in %rax? */
movq $0x4000000500000000, %rax
cmpb $0, kvm_rebooting
jne 2b
ud2
_ASM_EXTABLE(1b, 3b)

Paolo

\
 
 \ /
  Last update: 2021-07-06 14:58    [W:0.826 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site