MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_snapshot_vm

Function vm_snapshot_vm

freebsd/amd64/vmm/vmm.c:2793–2827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2791}
2792
2793static int
2794vm_snapshot_vm(struct vm *vm, struct vm_snapshot_meta *meta)
2795{
2796 int ret;
2797 int i;
2798 uint64_t now;
2799
2800 ret = 0;
2801 now = rdtsc();
2802
2803 if (meta->op == VM_SNAPSHOT_SAVE) {
2804 /* XXX make tsc_offset take the value TSC proper as seen by the
2805 * guest
2806 */
2807 for (i = 0; i < VM_MAXCPU; i++)
2808 vm->vcpu[i].tsc_offset += now;
2809 }
2810
2811 ret = vm_snapshot_vcpus(vm, meta);
2812 if (ret != 0) {
2813 printf("%s: failed to copy vm data to user buffer", __func__);
2814 goto done;
2815 }
2816
2817 if (meta->op == VM_SNAPSHOT_SAVE) {
2818 /* XXX turn tsc_offset back into an offset; actual value is only
2819 * required for restore; using it otherwise would be wrong
2820 */
2821 for (i = 0; i < VM_MAXCPU; i++)
2822 vm->vcpu[i].tsc_offset -= now;
2823 }
2824
2825done:
2826 return (ret);
2827}
2828
2829static int
2830vm_snapshot_vmcx(struct vm *vm, struct vm_snapshot_meta *meta)

Callers 1

vm_snapshot_reqFunction · 0.85

Calls 3

vm_snapshot_vcpusFunction · 0.85
rdtscFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected