Library mcertikos.proc.VMXInitGenLink

Require Import LinkTemplate.
Require Import VVMXInit.
Require Import VMXInitGen.
Require Import VMXInitGenLinkSource.
Require Import VVMXIntro.
Require Import VVMXIntroCSource.
Require Import VVMXIntroCode.
Require Import VMXInitGenAsm.

Section WITHCOMPCERTIKOS.
  Context `{compcertikos_prf: CompCertiKOS} `{real_params_prf: RealParams}.
  Context `{multi_oracle_prop: MultiOracleProp}.
  Context `{multi_oracle_link: !MultiOracleLink}.

  Lemma init_correct:
    init_correct_type VVMXInit_module vmxintro vmxinit.
  Proof.
    init_correct.
    - repeat intro.
      rewrite <- H1, <- H2.
      rewrite ZMap.gi.
      econstructor; eauto.
      intro; rewrite ZMap.gi; eauto.
    - repeat intro.
      rewrite <- H1, <- H2.
      rewrite ZMap.gi.
      econstructor; eauto.
      intro; rewrite ZMap.gi; eauto.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type VVMXInit_module vmxintro vmxinit.
  Proof.
    link_correct_aux.
    - link_cfunction
        vmx_get_reg_spec_ref
        VVMXINTROCODE.vmx_get_reg_code_correct.
    - link_cfunction
        vmx_set_reg_spec_ref
        VVMXINTROCODE.vmx_set_reg_code_correct.
    - link_cfunction
        vmx_get_next_eip_spec_ref
        VVMXINTROCODE.vmx_get_next_eip_code_correct.
    - link_cfunction
        vmx_get_io_width_spec_ref
        VVMXINTROCODE.vmx_get_io_width_code_correct.
    - link_cfunction
        vmx_get_io_write_spec_ref
        VVMXINTROCODE.vmx_get_io_write_code_correct.
    - link_cfunction
        vmx_get_exit_qualification_spec_ref
        VVMXINTROCODE.vmx_get_exit_qualification_code_correct.
    - link_cfunction
        vmx_get_exit_io_rep_spec_ref
        VVMXINTROCODE.vmx_get_exit_io_rep_code_correct.
    - link_cfunction
        vmx_get_exit_io_str_spec_ref
        VVMXINTROCODE.vmx_get_exit_io_str_code_correct.
    - link_cfunction
        vmx_get_exit_io_port_spec_ref
        VVMXINTROCODE.vmx_get_exit_io_port_code_correct.
    - link_cfunction
        vmx_set_mmap_spec_ref
        VVMXINTROCODE.vmx_set_mmap_code_correct.
    - link_cfunction
        vmx_init_spec_ref
        VVMXINTROCODE.vmx_init_code_correct.
    - link_asmfunction
        vmx_run_vm_spec_ref
        vmx_run_vm_code_correct.
    - link_asmfunction
        vmx_return_from_guest_spec_ref
        vmx_return_from_guest_code_correct.
    - apply passthrough_correct.
  Qed.

  Theorem cl_backward_simulation:
    cl_backward_simulation_type VVMXInit_module vmxintro vmxinit.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type VVMXInit_module vmxintro vmxinit.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.