Library mcertikos.devdrivers.HandlerAsmGenSpec


This file provide the contextual refinement proof between MBoot layer and MALInit layer
Require Import Coqlib.
Require Import Errors.
Require Import AST.
Require Import Integers.
Require Import Floats.
Require Import Op.
Require Import Asm.
Require Import Events.
Require Import Globalenvs.
Require Import Smallstep.
Require Import Values.
Require Import Memory.
Require Import Maps.
Require Import AuxLemma.
Require Import FlatMemory.
Require Import AuxStateDataType.
Require Import Constant.
Require Import GlobIdent.
Require Import RealParams.
Require Import AsmImplLemma.
Require Import GenSem.
Require Import PrimSemantics.

Require Import liblayers.logic.PTreeModules.
Require Import liblayers.logic.LayerLogicImpl.
Require Import liblayers.compcertx.Stencil.
Require Import liblayers.compcertx.MakeProgram.
Require Import liblayers.compat.CompatLayers.
Require Import liblayers.compat.CompatGenSem.
Require Import compcert.cfrontend.Ctypes.
Require Import Conventions.
Require Import AbstractDataType.
Require Import DHandlerSw.

Local Open Scope string_scope.
Local Open Scope error_monad_scope.
Local Open Scope Z_scope.

Definition of the low level specification

Section SPECIFICATION.

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

  Notation LDATA := RData.

  Notation LDATAOps := (cdata LDATA).

  Inductive serial_intr_handler_asm_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
    sprimcall_sem (mem := mwd LDATAOps):=
  | serial_intr_handler_asm_spec_low_intro s m0 mtmp m1 labd labd´ rs rs´ b :
      rs PC = Vptr b Int.zero
      find_symbol s set_tf = Some
      Mem.store Mint32 m0 0 (rs EDX) = Some mtmp
      Mem.load Mint32 mtmp 0 = Some (rs EDX) →
      Mem.store Mint32 mtmp 0 (Vint Int.zero) = Some m1
      find_symbol s serial_intr_handler_asm = Some b
      serial_intr_handler_asm_spec rs labd = Some (labd´, rs´)
      asm_invariant (mem := mwd LDATAOps) s rs (m0, labd)
      high_level_invariant labd
      low_level_invariant (Mem.nextblock m0) labd
      serial_intr_handler_asm_spec_low_step s rs (m0, labd)
                                 ((undef_regs (CR ZF :: CR CF :: CR PF :: CR SF :: CR OF :: nil) rs´) #PC <- (rs#RA) #RA <- Vundef) (m1, labd´).

  Section WITHMEM.

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

    Definition serial_intr_handler_asm_spec_low: compatsem LDATAOps :=
      asmsem serial_intr_handler_asm serial_intr_handler_asm_spec_low_step.

  End WITHMEM.

End SPECIFICATION.