Lines Matching +full:vm +full:- +full:pointer
10 payload program running inside the VM. The cooperation of these two components
14 … https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines[Test Writing Guidelines],
15 https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial[C Test Case Tutorial],
16 https://github.com/linux-test-project/ltp/wiki/C-Test-API[C Test API].
19 ---------------------------
25 The result is a single self-contained binary that'll execute the embedded
39 -------------------------------------------------------------------------------
62 -------------------------------------------------------------------------------
73 be the VM entry point of the test.
76 -------------------
85 -------------------------------------------------------------------------------
93 -------------------------------------------------------------------------------
98 - `int vm_fd` is the main VM file descriptor created by `ioctl(KVM_CREATE_VM)`
99 - `int vcpu_fd` is the virtual CPU filedescriptor created by
101 - `struct kvm_run *vcpu_info` is the VCPU state structure created by
103 - `size_t vcpu_info_size` is the size of `vcpu_info` buffer
104 - `struct kvm_userspace_memory_region ram[MAX_KVM_MEMSLOTS]` is the list
105 of memory slots defined in this VM. Unused memory slots have zero
107 - `struct tst_kvm_result *result` is a buffer for passing test result data
108 from the VM to the controller program, mainly `tst_res()`/`tst_brk()` flags
112 -------------------------------------------------------------------------------
119 -------------------------------------------------------------------------------
123 to pass `tst_res()` and `tst_brk()` messages from the VM, but special values
126 - `int32_t result` is the message type, either one of the `TPASS`, `TFAIL`,
129 - `int32_t lineno` is the line number for `tst_res()`/`tst_brk()` messages.
130 - `uint64_t file_addr` is the VM address of the filename string for
132 - `char message[0]` is the buffer for arbitrary message data, most often used
140 to customize the VM configuration. You can either assign these functions
144 - `void tst_kvm_setup(void)`
145 - `void tst_kvm_run(void)`
146 - `void tst_kvm_cleanup(void)`
151 - `void tst_kvm_validate_result(int value)` – Validate whether the value
156 - `uint64_t tst_kvm_get_phys_address(const struct tst_kvm_instance *inst,
157 uint64_t addr)` – Converts pointer value (virtual address) from KVM virtual
160 mapping is not enabled in the VM or not available on the arch at all, this
163 - `int tst_kvm_find_phys_memslot(const struct tst_kvm_instance *inst,
166 backed by a memory buffer, returns -1.
168 - `int tst_kvm_find_memslot(const struct tst_kvm_instance *inst,
172 returns -1.
174 - `void *tst_kvm_get_memptr(const struct tst_kvm_instance *inst,
175 uint64_t addr)` – Converts pointer value (virtual address) from KVM virtual
176 machine `inst` to host-side pointer.
178 - `void *tst_kvm_alloc_memory(struct tst_kvm_instance *inst, unsigned int slot,
184 `flags`. Returns pointer to page-aligned beginning of the allocated buffer.
188 - `struct kvm_cpuid2 *tst_kvm_get_cpuid(int sysfd)` – Get a list of supported
192 - `void tst_kvm_create_instance(struct tst_kvm_instance *inst,
194 with at least `ram_size` bytes of memory. The VM instance info will be
197 - `int tst_kvm_run_instance(struct tst_kvm_instance *inst, int exp_errno)` –
199 messages returned by the VM will be automatically printed to controller
200 program output. Returns zero. If `exp_errno` is non-zero, the VM execution
202 `tst_kvm_run_instance()` will return -1 instead of terminating the test.
204 - `void tst_kvm_destroy_instance(struct tst_kvm_instance *inst)` – Deletes
206 to the VM by `tst_kvm_create_instance()` or `tst_kvm_alloc_memory()` will
209 The KVM host library does not provide any way to reset a VM instance back
211 the old VM instance and creating a new one. Otherwise the VM will exit
216 --------------------
229 - `void *memset(void *dest, int val, size_t size)`
230 - `void *memzero(void *dest, size_t size)`
231 - `void *memcpy(void *dest, const void *src, size_t size)`
232 - `char *strcpy(char *dest, const char *src)`
233 - `char *strcat(char *dest, const char *src)`
234 - `size_t strlen(const char *str)`
243 with the same rules as usual. However, the printf-like formatting is not
246 - `void tst_res(int result, const char *message)`
247 - `void tst_brk(int result, const char *message) __attribute__((noreturn))`
251 - `TST_TEST_TCONF(message)` – Generates a test program that will simply print
255 - `ARRAY_SIZE(arr)` – Returns the number of items in statically allocated
258 - `LTP_ALIGN(x, a)` – Aligns integer `x` to be a multiple of `a`, which
267 buffer for memory allocation. There are no checks whether the VM can allocate
270 - `void *tst_heap_alloc(size_t size)` – Allocates a block of memory on the heap.
272 - `void *tst_heap_alloc_aligned(size_t size, size_t align)` – Allocates
282 - `struct kvm_interrupt_frame` – Opaque arch-dependent structure which holds
285 - `uintptr_t kvm_get_interrupt_ip(const struct kvm_interrupt_frame *ifrm)` –
286 Get instruction pointer value from interrupt frame structure. This may be
290 - `int (*tst_interrupt_callback)(void *userdata,
293 will be passed the `userdata` pointer that was given
298 handled and test execution should resume. Non-zero return value means that
301 - `void tst_set_interrupt_callback(unsigned int vector,
304 argument is an arbitrary pointer that will be passed to `func()` every time
310 -------------------------------------------------------------------------------
339 -------------------------------------------------------------------------------
342 64bit paging modes. See Intel(R) 64 and IA-32 Architectures Software
345 - `uintptr_t kvm_get_page_address_pae(const struct page_table_entry_pae *entry)`
348 the physical address may not be a valid pointer. The caller must determine
350 the known position in page table hierarchy and `entry->page_type`. Returns
353 - `void kvm_set_segment_descriptor(struct segment_descriptor *dst, uint64_t baseaddr, uint32_t limi…
357 - `void kvm_parse_segment_descriptor(struct segment_descriptor *src, uint64_t *baseaddr, uint32_t *…
362 - `int kvm_find_free_descriptor(const struct segment_descriptor *table, size_t size)` -
364 the `SEGFLAG_PRESENT` bit set. The function handles double-size descriptors
365 correctly. Returns index of the first available descriptor or -1 if all
368 - `unsigned int kvm_create_stack_descriptor(struct segment_descriptor *table, size_t tabsize, void …
371 The `stack_base` pointer must point to the bottom of the stack.
373 - `void kvm_get_cpuid(unsigned int eax, unsigned int ecx,
377 - `void kvm_read_cregs(struct kvm_cregs *buf)` – Copies the current values
380 - `void kvm_read_sregs(struct kvm_sregs *buf)` - Copies the current values
383 - `uint64_t kvm_rdmsr(unsigned int msr)` – Returns the current value
384 of model-specific register `msr`.
386 - `void kvm_wrmsr(unsigned int msr, uint64_t value)` – Stores `value`
387 into model-specific register `msr`.
389 - `void kvm_exit(void) __attribute__((noreturn))` – Terminate the test.
393 See Intel(R) 64 and IA-32 Architectures Software Developer's Manual
394 for documentation of standard and model-specific x86 registers.
406 .Example code to execute nested VM
408 -------------------------------------------------------------------------------
417 struct kvm_svm_vcpu *vm;
420 vm = kvm_create_svm_vcpu(guest_main, 1);
421 kvm_svm_vmrun(vm);
423 -------------------------------------------------------------------------------
425 - `int kvm_is_svm_supported(void)` - Returns non-zero value if the CPU
428 - `int kvm_get_svm_state(void)` - Returns non-zero value if SVM is currently
431 - `void kvm_set_svm_state(int enabled)` - Enable or disable SVM according
435 - `void kvm_init_svm(void)` - Enable and fully initialize SVM, including
439 - `struct kvm_vmcb *kvm_alloc_vmcb(void)` - Allocate new VMCB structure
442 - `void kvm_vmcb_set_intercept(struct kvm_vmcb *vmcb, unsigned int id, unsigned int state)` -
445 - `void kvm_init_guest_vmcb(struct kvm_vmcb *vmcb, uint32_t asid, uint16_t ss, void *rsp, int (*gue…
448 pointer values, respectively. The `guest_main` parameter sets the code entry
453 - `struct kvm_svm_vcpu *kvm_create_svm_vcpu(int (*guest_main)(void), int alloc_stack)` -
459 the stack segment register and stack pointer manually.
461 - `void kvm_svm_vmrun(struct kvm_svm_vcpu *cpu)` - Start or continue execution
470 ------------------------
475 - Activate the appropriate CPU execution mode (IA-32 protected mode
476 on 32-bit x86 or the 64-bit mode on x86_64).
477 - Create indentity mapping (virtual address = physical address) of the lower
481 - Initialize 8KB stack.
482 - Install default interrupt handlers for standard CPU exception vectors.