Library mcertikos.devdrivers.DConsoleBuffIntro


This file defines the abstract data and the primitives for the PIPC layer, which will introduce the primtives of thread
Require Import Coqlib.
Require Import Maps.
Require Import ASTExtra.
Require Import Integers.
Require Import Floats.
Require Import Values.
Require Import Memory.
Require Import Events.
Require Import Stacklayout.
Require Import Globalenvs.
Require Import AsmX.
Require Import Smallstep.
Require Import AuxStateDataType.
Require Import Constant.
Require Import GlobIdent.
Require Import FlatMemory.
Require Import CommonTactic.
Require Import AuxLemma.
Require Import RealParams.
Require Import PrimSemantics.
Require Import LAsm.
Require Import LoadStoreSem1.
Require Import XOmega.

Require Import liblayers.logic.PTreeModules.
Require Import liblayers.logic.LayerLogicImpl.
Require Import liblayers.compat.CompatLayers.
Require Import liblayers.compat.CompatGenSem.

Require Export MQTicketLock.
Require Export ObjConsole.
Require Import AbstractDataType.
Require Import DeviceStateDataType.

Abstract Data and Primitives at this layer

Section WITHMEM.

  Local Open Scope Z_scope.

  Context `{real_params: RealParams}.
  Context `{oracle_prop: MultiOracleProp}.


  Context `{Hstencil: Stencil}.
  Context `{Hmem: Mem.MemoryModelX}.
  Context `{Hmwd: UseMemWithData mem}.

Proofs that the primitives satisfies the invariants at this layer

  Section INV.

    Global Instance cons_buf_init_concrete_spec_inv:
      PreservesInvariants cons_buf_init_concrete_spec.
    Proof.
      preserves_invariants_simpl low_level_invariant high_level_invariant; eauto.
    Qed.

    Global Instance cons_buf_write_concrete_spec_inv:
      PreservesInvariants cons_buf_write_concrete_spec.
    Proof.
      preserves_invariants_simpl low_level_invariant high_level_invariant; eauto.
    Qed.

    Global Instance cons_buf_read_concrete_spec_inv:
      PreservesInvariants cons_buf_read_concrete_spec.
    Proof.
      preserves_invariants_simpl low_level_invariant high_level_invariant; eauto;
      inversion H0;
      try functional inversion H2; unfold rpos, wpos, s in *; subst;
      constructor;
      eauto 2.
    Qed.

    Global Instance cons_buf_wpos_concrete_spec_inv:
      PreservesInvariants cons_buf_wpos_concrete_spec.
    Proof.
      preserves_invariants_simpl low_level_invariant high_level_invariant; eauto.
    Qed.

  End INV.

  Definition exec_loadex {F V} := exec_loadex1 (F := F) (V := V).

  Definition exec_storeex {F V} := exec_storeex1 (flatmem_store:= flatmem_store´) (F := F) (V := V).

  Global Instance flatmem_store_inv: FlatmemStoreInvariant (flatmem_store:= flatmem_store´).
  Proof.
    split; inversion 1; intros.
    - functional inversion H0; constructor; auto.
    - functional inversion H1; constructor; auto.
  Qed.

  Global Instance trapinfo_set_inv: TrapinfoSetInvariant.
  Proof.
    split; inversion 1; intros; constructor; auto.
  Qed.

Layer Definition

  Definition dconsolebuffintro_fresh : compatlayer (cdata RData) :=
    cons_buf_init gensem cons_buf_init_concrete_spec
                   cons_buf_write gensem cons_buf_write_concrete_spec
                   cons_buf_read gensem cons_buf_read_concrete_spec
                   cons_buf_wpos gensem cons_buf_wpos_concrete_spec.

  Definition dconsolebuffintro_passthrough : compatlayer (cdata RData) :=
      fload gensem fload´_spec
                 fstore gensem fstore´_spec
                
                 page_copy gensem page_copy´_spec
                 page_copy_back gensem page_copy_back´_spec

                 vmxinfo_get gensem vmxinfo_get_spec
                 set_pg gensem setPG_spec
                 set_cr3 setCR3_compatsem setCR3_spec
                 get_size gensem MMSize
                 is_usable gensem is_mm_usable_spec
                 get_mms gensem get_mm_s_spec
                 get_mml gensem get_mm_l_spec
                 get_CPU_ID gensem get_CPU_ID_spec
                 get_curid gensem get_curid_spec
                 set_curid gensem set_curid_spec
                 set_curid_init gensem set_curid_init_spec
                 release_lock primcall_release_lock_compatsem release_lock release_lock_spec0
                 acquire_lock primcall_acquire_lock_compatsem acquire_lock_spec0
                 ticket_lock_init gensem ticket_lock_init0_spec
                 serial_irq_check gensem serial_irq_check_spec
                 iret gensem iret_spec
                 cli gensem cli_spec
                 sti gensem sti_spec
                 serial_irq_current gensem serial_irq_current_spec
                 ic_intr gensem ic_intr_spec
                 save_context primcall_save_context_compatsem save_context_spec
                 restore_context primcall_restore_context_compatsem restore_context_spec
                 local_irq_save gensem local_irq_save_spec
                 local_irq_restore gensem local_irq_restore_spec
                 serial_in gensem serial_in_spec
serial device
                 serial_out gensem serial_out_spec
serial device
                 serial_hw_intr gensem serial_hw_intr_spec
serial device
                 ioapic_read gensem ioapic_read_spec
ioapic device
                 ioapic_write gensem ioapic_write_spec
ioapic device
                 lapic_read gensem lapic_read_spec
lapic device
                 lapic_write gensem lapic_write_spec
lapic device
                 trap_in primcall_general_compatsem trapin_spec
                 trap_out primcall_general_compatsem trapout´_spec
                 host_in primcall_general_compatsem hostin_spec
                 host_out primcall_general_compatsem hostout´_spec
                 proc_create_postinit gensem proc_create_postinit_spec
                 trap_get primcall_trap_info_get_compatsem trap_info_get_spec
                 trap_set primcall_trap_info_ret_compatsem trap_info_ret_spec
                 accessors {| exec_load := @exec_loadex; exec_store := @exec_storeex |}.

  Definition dconsolebuffintro : compatlayer (cdata RData) := dconsolebuffintro_fresh dconsolebuffintro_passthrough.

End WITHMEM.