Library mcertikos.trap.TrapGenLink

Require Import LinkTemplate.
Require Import TTrap.
Require Import TrapGen.
Require Import TrapGenLinkSource.
Require Import TTrapArg.
Require Import TTrapArgCSource.
Require Import TTrapArgCode.
Require Import TTrapArgCode2.

Section WITHCOMPCERTIKOS.
  Context `{compcertikos_prf: CompCertiKOS} `{real_params_prf: RealParams}.

  Lemma init_correct:
    init_correct_type TTrap_module ttraparg ttrap.
  Proof.
    init_correct.
  Qed.

  Lemma link_correct_aux:
    link_correct_aux_type TTrap_module ttraparg ttrap.
  Proof.
    link_correct_aux.
    - link_cfunction
        ptf_resv_spec_ref
        TTRAPARGCODE2.ptfault_resv_code_correct.
    - link_cfunction
        trap_proc_create_spec_ref
        TTRAPARGCODE2.sys_proc_create_code_correct.
    - link_cfunction
        trap_get_quota_spec_ref
        TTRAPARGCODE.sys_get_quota_code_correct.

    - link_cfunction
        trap_receivechan_spec_ref
        TTRAPARGCODE.sys_receive_chan_code_correct.

    - link_cfunction
        trap_offer_shared_mem_spec_ref
        TTRAPARGCODE.sys_offer_shared_mem_code_correct.

    - link_cfunction
        print_spec_ref
        TTRAPARGCODE.print_code_correct.

    - apply passthrough_correct.
  Qed.

  Theorem cl_simulation:
    cl_simulation_type TTrap_module ttraparg ttrap.
  Proof.
    cl_simulation init_correct link_correct_aux.
  Qed.

  Theorem cl_forward_simulation:
    cl_forward_simulation_type TTrap_module ttraparg ttrap.
  Proof.
    cl_forward_simulation init_correct link_correct_aux.
  Qed.

  Theorem cl_backward_simulation:
    cl_backward_simulation_type TTrap_module ttraparg ttrap.
  Proof.
    cl_backward_simulation init_correct link_correct_aux.
  Qed.

  Theorem make_program_exists:
    make_program_exist_type TTrap_module ttraparg ttrap.
  Proof.
    make_program_exists link_correct_aux.
  Qed.

End WITHCOMPCERTIKOS.