(** * Instantiating the dry and bare machine for X86*)
Set Bullet Behavior "None".
Set Bullet Behavior "Strict Subproofs".
Module X86Context.
Section X86Context.
Context {the_program: Asm.program}.
Definition the_ge := Globalenvs.Genv.globalenv the_program.
Context {Hsafe : safe_genv the_ge}.
Instance X86Sem: Semantics:=
{ semG:= Asm.genv;
semC:= Asm.state;
semSem:= Asm_EvSem the_ge Hsafe;
the_ge := the_ge
}.
(*Import the Asm Hybrid Machine*)
(** *Coarse Asm Machine*)
Definition AsmHybridMachine    := @dryCoarseMach X86Sem.
Definition AsmConcurSem    := HybridMachineSig.HybridMachineSig.ConcurMachineSemantics
(HybridMachine:= AsmHybridMachine).
(** *Fine Asm Machine*)
Definition AsmFineHybridMachine    := @dryFineMach X86Sem.
Definition AsmFineConcurSem    := HybridMachineSig.HybridMachineSig.ConcurMachineSemantics
(HybridMachine:= AsmFineHybridMachine).
(** The initial state There are three, but all should be equivalent. *)
Definition Asm_initial_state := tpc_init(asmSem:=X86Sem).
Definition Asm_initial_state_fine := tpf_init(asmSem:=X86Sem).
Definition Asm_initial_state_bare := bare_init(asmSem:=X86Sem).
End X86Context.
End X86Context.
Module X86SEMAxioms.
X86Context Memory.
Section X86Context.
Context {initU: seq.seq nat}
{the_program: Asm.program}.
Notation the_ge := (@the_ge the_program).
Context {Hsafe : safe_genv the_ge}.
Instance X86Sem: Semantics := @X86Sem the_program Hsafe.

(* Specifications: *)
Lemma corestep_det: corestep_fun semSem.
Lemma mem_step_decay:
forall m m',
mem_step m m' ->
decay m m'.
Lemma exec_load_same_mem:
forall ch m a rs rd rs' m',
exec_load the_ge ch m a rs rd = Next rs' m' ->
m=m'.
Lemma exec_store_obeys_cur_write:
forall ch m a rs rs0 d rs' m',
exec_store the_ge ch m a rs rs0 d = Next rs' m' ->
forall b ofs,
Memory.Mem.valid_block m b ->
~ Memory.Mem.perm m b ofs Memtype.Cur Memtype.Writable ->
ZMap.get ofs (PMap.get b (Memory.Mem.mem_contents m)) =
ZMap.get ofs (PMap.get b (Memory.Mem.mem_contents m')).
Lemma mem_step_obeys_cur_write:
forall m b ofs m',
Memory.Mem.valid_block m b ->
~ Memory.Mem.perm m b ofs Memtype.Cur Memtype.Writable ->
mem_step m m' ->
ZMap.get ofs (PMap.get b (Memory.Mem.mem_contents m)) =
ZMap.get ofs (PMap.get b (Memory.Mem.mem_contents m')).
Lemma corestep_unchanged_on:
forall c m
c' m' b (ofs : Z),
corestep semSem c m c' m' ->
Memory.Mem.valid_block m b ->
~ Memory.Mem.perm m b ofs Memtype.Cur Memtype.Writable ->
ZMap.get ofs (Memory.Mem.mem_contents m) !! b =
ZMap.get ofs (Memory.Mem.mem_contents m') !! b.
Lemma corestep_decay:
forall c c' m m',
corestep semSem c m c' m' -> decay m m'.
Lemma corestep_nextblock :
forall c m c' m',
corestep semSem c m c' m' ->
(Memory.Mem.nextblock m <= Memory.Mem.nextblock m')%positive.
Lemma at_external_halted_excl:
forall q m, semantics.at_external (@semSem X86Sem) q m = None \/ forall i, ~ halted semSem q i.
Lemma initial_core_det:
forall i m v args c c' m' m'',
initial_core semSem i m c m' v args ->
initial_core semSem i m c' m'' v args ->
c = c' /\ m' = m''.
Lemma make_arg_unchanged_on:
forall rs m l arg rs' m'
(Hmake_args: make_arg rs m l arg = Some (rs', m')),
(forall b ofs, ~ Mem.perm m b ofs Cur Writable -> ZMap.get ofs (Mem.mem_contents m) !! b = ZMap.get ofs (Mem.mem_contents m') !! b) /\
(forall b ofs k, permission_at m b ofs k = permission_at m' b ofs k) /\
(forall b, Mem.valid_block m' b <-> Mem.valid_block m b).
Lemma make_arguments_unchanged_on:
forall rs m args ls rs' m'
(Hmake_args: make_arguments rs m ls args = Some (rs', m')),
(forall b ofs, ~ Mem.perm m b ofs Cur Writable -> ZMap.get ofs (Mem.mem_contents m) !! b = ZMap.get ofs (Mem.mem_contents m') !! b) /\
(forall b ofs k, permission_at m b ofs k = permission_at m' b ofs k) /\
(forall b, Mem.valid_block m' b <-> Mem.valid_block m b).
Lemma initial_core_unchanged_on :
forall (i : nat) (v : Values.val) (args : list Values.val) (c : semC) (m m' : mem) (b : Values.block) (ofs : Z),
initial_core semSem i m c m' v args ->
Mem.valid_block m b -> ~ Mem.perm m b ofs Cur Writable -> ZMap.get ofs (Mem.mem_contents m) !! b = ZMap.get ofs (Mem.mem_contents m') !! b /\
forall k, permission_at m b ofs k = permission_at m' b ofs k.
Corollary initial_core_unchanged_on' :
forall (i : nat) (v : Values.val) (args : list Values.val) (c : semC) (m m' : mem) (b : Values.block) (ofs : Z),
initial_core semSem i m c m' v args ->
Mem.valid_block m b -> ~ Mem.perm m b ofs Cur Writable -> ZMap.get ofs (Mem.mem_contents m) !! b = ZMap.get ofs (Mem.mem_contents m') !! b.
Lemma initial_core_decay :
forall (i : nat) (v : Values.val) (args : list Values.val) (c : semC) (m m' : mem),
initial_core semSem i m c m' v args ->
strong_decay m m'.
Lemma initial_core_nextblock :
forall (i : nat) (v : Values.val) (args : list Values.val) (c : semC) (m m' : mem),
initial_core semSem i m c m' v args ->
(Mem.nextblock m <= Mem.nextblock m')%positive.