Re: [RFC PATCH v2 06/69] KVM: TDX: add a helper function for kvm to call seamcall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/07/21 00:04, isaku.yamahata@xxxxxxxxx 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




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux