Library mcertikos.proc.SleeperGenSpec
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 AbstractDataType.
Require Import PKContextNew.
Require Export Conventions.
Local Open Scope string_scope.
Local Open Scope error_monad_scope.
Local Open Scope Z_scope.
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 AbstractDataType.
Require Import PKContextNew.
Require Export Conventions.
Local Open Scope string_scope.
Local Open Scope error_monad_scope.
Local Open Scope Z_scope.
Section Refinement.
Context `{real_params: RealParams}.
Context `{multi_oracle_prop: MultiOracleProp}.
Notation LDATA := RData.
Notation LDATAOps := (cdata LDATA).
Inductive sleeper_zzz_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_zzz_spec_low_intro s (WB: _ → Prop) (m´0: mem) d b0 to (res: int) cpu:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint to) →
res = match Int.eq to Int.zero with
| true ⇒ Int.one
| _ ⇒ Int.zero
end →
kernel_mode d →
sleeper_zzz_spec_low_step s WB nil (m´0, d) (Vint res) (m´0, d).
Inductive sleeper_inc_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_inc_spec_low_intro s (WB: _ → Prop) (m´0 m0: mem) d b0 cpu sl:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint sl) →
Mem.store Mint32 m´0 b0 (cpu × 4) (Vint (Int.repr (Int.unsigned sl + 1))) = Some m0 →
0 < Int.unsigned sl + 1 < num_proc →
kernel_mode d →
sleeper_inc_spec_low_step s WB nil (m´0, d) Vundef (m0, d).
Inductive sleeper_dec_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_dec_spec_low_intro s (WB: _ → Prop) (m´0 m0: mem) d b0 cpu sl:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint sl) →
Mem.store Mint32 m´0 b0 (cpu × 4) (Vint (Int.repr (Int.unsigned sl - 1))) = Some m0 →
0 ≤ Int.unsigned sl - 1 < num_proc - 1 →
kernel_mode d →
sleeper_dec_spec_low_step s WB nil (m´0, d) Vundef (m0, d).
Section WITHMEM.
Context `{Hstencil: Stencil}.
Context `{Hmem: Mem.MemoryModelX}.
Context `{Hmwd: UseMemWithData mem}.
Definition sleeper_zzz_spec_low: compatsem LDATAOps :=
csem sleeper_zzz_spec_low_step Tnil Tint32.
Definition sleeper_inc_spec_low: compatsem LDATAOps :=
csem sleeper_inc_spec_low_step Tnil Tvoid.
Definition sleeper_dec_spec_low: compatsem LDATAOps :=
csem sleeper_dec_spec_low_step Tnil Tvoid.
End WITHMEM.
End Refinement.
Context `{real_params: RealParams}.
Context `{multi_oracle_prop: MultiOracleProp}.
Notation LDATA := RData.
Notation LDATAOps := (cdata LDATA).
Inductive sleeper_zzz_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_zzz_spec_low_intro s (WB: _ → Prop) (m´0: mem) d b0 to (res: int) cpu:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint to) →
res = match Int.eq to Int.zero with
| true ⇒ Int.one
| _ ⇒ Int.zero
end →
kernel_mode d →
sleeper_zzz_spec_low_step s WB nil (m´0, d) (Vint res) (m´0, d).
Inductive sleeper_inc_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_inc_spec_low_intro s (WB: _ → Prop) (m´0 m0: mem) d b0 cpu sl:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint sl) →
Mem.store Mint32 m´0 b0 (cpu × 4) (Vint (Int.repr (Int.unsigned sl + 1))) = Some m0 →
0 < Int.unsigned sl + 1 < num_proc →
kernel_mode d →
sleeper_inc_spec_low_step s WB nil (m´0, d) Vundef (m0, d).
Inductive sleeper_dec_spec_low_step `{StencilOps} `{Mem.MemoryModelOps} `{UseMemWithData mem}:
sextcall_sem (mem := mwd LDATAOps) :=
sleeper_dec_spec_low_intro s (WB: _ → Prop) (m´0 m0: mem) d b0 cpu sl:
find_symbol s SLEEPER_LOC = Some b0 →
cpu = CPU_ID d →
Mem.load Mint32 m´0 b0 (cpu × 4) = Some (Vint sl) →
Mem.store Mint32 m´0 b0 (cpu × 4) (Vint (Int.repr (Int.unsigned sl - 1))) = Some m0 →
0 ≤ Int.unsigned sl - 1 < num_proc - 1 →
kernel_mode d →
sleeper_dec_spec_low_step s WB nil (m´0, d) Vundef (m0, d).
Section WITHMEM.
Context `{Hstencil: Stencil}.
Context `{Hmem: Mem.MemoryModelX}.
Context `{Hmwd: UseMemWithData mem}.
Definition sleeper_zzz_spec_low: compatsem LDATAOps :=
csem sleeper_zzz_spec_low_step Tnil Tint32.
Definition sleeper_inc_spec_low: compatsem LDATAOps :=
csem sleeper_inc_spec_low_step Tnil Tvoid.
Definition sleeper_dec_spec_low: compatsem LDATAOps :=
csem sleeper_dec_spec_low_step Tnil Tvoid.
End WITHMEM.
End Refinement.