Library mcertikos.virt.intel.VMXIntroGenLink
*********************************************************************** * * * The CertiKOS Certified Kit Operating System * * * * The FLINT Group, Yale University * * * * Copyright The FLINT Group, Yale University. All rights reserved. * * This file is distributed under the terms of the Yale University * * Non-Commercial License Agreement. * * * ***********************************************************************
Require Import LinkTemplate.
Require Import VVMXIntro.
Require Import VMXIntroGen.
Require Import VMXIntroGenLinkSource.
Require Import VVMCSInit.
Require Import VVMCSInitCSource.
Require Import VVMCSInitCode.
Require Import VMXIntroGenAsm.
Section WITHCOMPCERTIKOS.
Context `{compcertikos_prf: CompCertiKOS} `{real_params_prf: RealParams}.
Lemma make_program_find_symbol (CTXT md : module)(m : mem) s :
(p <- make_program s (CTXT ⊕ (md ⊕ VMX_LOC ↦ v_VMX_LOC) ⊕ ∅) (vmcsinit ⊕ L64);
ret (Genv.init_mem p) = OK (Some m))
→ ∃ b, find_symbol s VMX_LOC = Some b ∧
∀ i : Z, 0 ≤ i < 36 →
Mem.valid_access m Mint32 b (i × 4) Writable.
Proof.
intros mkprog; inv_monad´ mkprog.
assert (mkgenv := make_program_make_globalenv _ _ _ _ mkprog0).
pose proof mkgenv as mkgenv´.
eapply make_globalenv_stencil_matches in mkgenv´.
inv_make_globalenv mkgenv. subst.
rewrite (stencil_matches_symbols _ _ mkgenv´) in ×. inv mkgenv´.
eexists; split; try eassumption.
specialize (Genv.init_mem_characterization _ _ Hbvi H0); eauto.
unfold Genv.perm_globvar; simpl; intros [ Hperm _ ].
change (Z.max 144 0) with 144 in Hperm.
intros; split.
- unfold Mem.range_perm; intros; apply Hperm.
simpl in H1.
omega.
- eexists; reflexivity.
Qed.
Lemma init_correct:
init_correct_type VVMXIntro_module vmcsinit vmxintro.
Proof.
init_correct.
exploit make_program_find_symbol; eauto.
intros (b & find_symbol_VMX_LOC & access).
econstructor; try eassumption; intros.
rewrite ZMap.gi.
assert (readable : Mem.valid_access m2 Mint32 b (i × 4) Readable).
{ eapply Mem.valid_access_implies; eauto; constructor. }
exploit Mem.valid_access_load; eauto.
intros [ v load ].
∃ v; split; [| split ]; eauto.
Qed.
Lemma link_correct_aux:
link_correct_aux_type VVMXIntro_module vmcsinit vmxintro.
Proof.
link_correct_aux.
- link_cfunction
vmx_readz_spec_ref
VVMCSInitCode.VMX_readz_code_correct.
- link_cfunction
vmx_writez_spec_ref
VVMCSInitCode.VMX_writez_code_correct.
- link_cfunction
vmx_enter_pre_spec_ref
VVMCSInitCode.VMX_enter_pre_code_correct.
- link_cfunction
vmx_exit_post_spec_ref
VVMCSInitCode.VMX_exit_post_code_correct.
- link_asmfunction vmx_enter_spec_ref vmx_enter_code_correct.
- link_asmfunction vmx_exit_spec_ref vmx_exit_code_correct.
- apply passthrough_correct.
Qed.
Theorem cl_backward_simulation:
cl_backward_simulation_type VVMXIntro_module vmcsinit vmxintro.
Proof.
cl_backward_simulation init_correct link_correct_aux.
Qed.
Theorem make_program_exists:
make_program_exist_type VVMXIntro_module vmcsinit vmxintro.
Proof.
make_program_exists link_correct_aux.
Qed.
End WITHCOMPCERTIKOS.