arm-hyp cparsertest: Adds ARM_HYP dependencies for testsfiles

* This is just a copy of the files inside testfile/ARM into an
    arm-hyp specific.
This commit is contained in:
Alejandro Gomez-Londono 2017-06-09 14:06:46 +10:00
parent 492d6c1817
commit bba0bb842a
3 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/*
* Copyright 2016, Data61
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
int a_global;
int a_mod_global;
int b_mod_global;
int c_mod_global;
int d_mod_global;
int
f (int x) {
unsigned int tmp1 = 0;
__asm__ volatile("ubfx" "%0, %1, #11, #8" : "=r"(tmp1) : "r"(x));
return tmp1;
}
static inline void do_dmb(void)
{
__asm__ volatile("dmb" "sy" : : : "memory");
}
int
g (void) {
a_mod_global ++;
b_mod_global ++;
c_mod_global ++;
d_mod_global ++;
}
/** MODIFIES: [*] */
void unspecified_function(unsigned int x);
int
combine (int x) {
x = f (x);
b_mod_global ++;
unspecified_function (x);
do_dmb ();
g ();
x = f (x);
return x;
}

View File

@ -0,0 +1,34 @@
(*
* Copyright 2016, Data61
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*)
theory asm_stmt
imports "../../CTranslation"
begin
declare [[populate_globals=true]]
typedecl machine_state
typedecl cghost_state
install_C_file "asm_stmt.c"
[machinety=machine_state, ghostty=cghost_state]
context asm_stmt begin
thm f_body_def
thm f_modifies
thm combine_body_def
thm combine_modifies
end
end

View File

@ -0,0 +1,24 @@
(*
* Copyright 2017, Data61, CSIRO
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(DATA61_BSD)
*)
theory MachineWords
imports "../../../CTranslation"
begin
type_synonym machine_word_len = "32"
type_synonym machine_word = "machine_word_len word"
abbreviation "machine_word_bytes \<equiv> 4 :: nat"
lemma of_nat_machine_word_bytes[simp]: "of_nat machine_word_bytes = 4"
by simp
end