Require compcert.cfrontend.Ctypes.
Require compcert.cfrontend.Clight.
Set Implicit Arguments.
Definition is_defchar (mv: memval) :=
match mv with
| Byte _ => True
| _ => False
end.
Inductive extcall_storebytes_sem
(F V: Type) (ge: Genv.t F V): list memval -> list val -> mem -> trace -> val -> mem -> Prop :=
| extcall_storebytes_sem_intro: forall (b: block) (ofs: int) bytes m m',
Zlength bytes > 0 ->
Forall is_defchar bytes ->
Mem.storebytes m b (Int.unsigned ofs) bytes = Some m' ->
extcall_storebytes_sem ge bytes (Vptr b ofs :: nil) m E0 Vundef m'.

Lemma extcall_storebytes_sem_inject_comm:
forall (F V : Type) (ge : Genv.t F V) (vargs : list val)
(m1 : mem) (t : trace) (m2 : mem)
(f : block -> option (block * Z)) (m1' : mem)
(vargs' : list val) bytes,
meminj_preserves_globals ge f ->
extcall_storebytes_sem ge bytes vargs m1 t Vundef m2 ->
Mem.inject f m1 m1' ->
val_list_inject f vargs vargs' ->
exists (m2' : mem),
extcall_storebytes_sem ge bytes vargs' m1' t Vundef m2' /\
Mem.inject f m2 m2' /\
Mem.unchanged_on (loc_unmapped f) m1 m2 /\
Mem.unchanged_on (loc_out_of_reach f m1) m1' m2'.