tools/testing/selftests/kvm/x86/nested_vmsave_vmload_test.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/x86/nested_vmsave_vmload_test.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/kvm/x86/nested_vmsave_vmload_test.c
Extension
.c
Size
5580 bytes
Lines
198
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (get_ucall(vcpu, &uc)) {
		case UCALL_ABORT:
			REPORT_GUEST_ASSERT(uc);
		case UCALL_SYNC:
			i = uc.args[1];
			TEST_ASSERT(i == 0 || i == 1, "Unexpected VMCB idx: %d", i);

			/*
			 * Check that only the expected VMCB has KERNEL_GS_BASE
			 * set to 0xaaaa, and update it to 0xbbbb.
			 */
			TEST_ASSERT_EQ(test_vmcb[i]->save.kernel_gs_base, 0xaaaa);
			TEST_ASSERT_EQ(test_vmcb[1-i]->save.kernel_gs_base, 0);
			test_vmcb[i]->save.kernel_gs_base = 0xbbbb;
			break;
		case UCALL_DONE:
			goto done;
		default:
			TEST_FAIL("Unknown ucall %lu", uc.cmd);
		}
	}

done:
	kvm_vm_free(vm);
	return 0;
}

Annotation

Implementation Notes