-
Notifications
You must be signed in to change notification settings - Fork 1
/
emulate_mmio_read.v
99 lines (95 loc) · 3.85 KB
/
emulate_mmio_read.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Require Import CodeDeps.
Require Import Ident.
Local Open Scope Z_scope.
Definition _bit := 1%positive.
Definition _bit_count := 2%positive.
Definition _esr := 3%positive.
Definition _g := 4%positive.
Definition _i := 5%positive.
Definition _mask := 6%positive.
Definition _rec := 7%positive.
Definition _rec__1 := 8%positive.
Definition _reg := 9%positive.
Definition _ret := 10%positive.
Definition _rt := 11%positive.
Definition _val := 12%positive.
Definition _t'1 := 13%positive.
Definition _t'2 := 14%positive.
Definition _t'3 := 15%positive.
Definition _t'4 := 16%positive.
Definition _t'5 := 17%positive.
Definition _t'6 := 18%positive.
Definition emulate_mmio_read_body :=
(Ssequence
(Ssequence
(Ssequence
(Scall (Some _t'1)
(Evar _get_rec_run_emulated_read_val (Tfunction Tnil tulong
cc_default)) nil)
(Scall (Some _t'2)
(Evar _access_mask (Tfunction (Tcons tulong Tnil) tulong cc_default))
((Etempvar _esr tulong) :: nil)))
(Sset _val
(Ebinop Oand (Etempvar _t'1 tulong) (Etempvar _t'2 tulong) tulong)))
(Ssequence
(Ssequence
(Scall (Some _t'6)
(Evar _esr_sign_extend (Tfunction (Tcons tulong Tnil) tuint
cc_default))
((Etempvar _esr tulong) :: nil))
(Sifthenelse (Ebinop One (Etempvar _t'6 tuint)
(Econst_int (Int.repr 0) tuint) tint)
(Ssequence
(Ssequence
(Scall (Some _t'3)
(Evar _access_len (Tfunction (Tcons tulong Tnil) tuint
cc_default))
((Etempvar _esr tulong) :: nil))
(Sset _bit_count
(Ebinop Omul (Etempvar _t'3 tuint)
(Econst_int (Int.repr 8) tuint) tuint)))
(Ssequence
(Ssequence
(Scall (Some _t'4)
(Evar _shiftl (Tfunction (Tcons tulong (Tcons tulong Tnil))
tulong cc_default))
((Econst_long (Int64.repr 1) tulong) ::
(Ebinop Osub (Etempvar _bit_count tuint)
(Econst_int (Int.repr 1) tuint) tuint) :: nil))
(Sset _mask (Etempvar _t'4 tulong)))
(Ssequence
(Sset _val
(Ebinop Osub
(Ebinop Oxor (Etempvar _val tulong) (Etempvar _mask tulong)
tulong) (Etempvar _mask tulong) tulong))
(Ssequence
(Scall (Some _t'5)
(Evar _esr_sixty_four (Tfunction (Tcons tulong Tnil) tuint
cc_default))
((Etempvar _esr tulong) :: nil))
(Sifthenelse (Ebinop Oeq (Etempvar _t'5 tuint)
(Econst_int (Int.repr 0) tuint) tint)
(Sset _val
(Ebinop Oand (Etempvar _val tulong)
(Econst_int (Int.repr (4294967295)) tuint) tulong))
Sskip)))))
Sskip))
(Scall None
(Evar _set_rec_regs (Tfunction
(Tcons (tptr Tvoid)
(Tcons tuint (Tcons tulong Tnil))) tvoid
cc_default))
((Etempvar _rec (tptr Tvoid)) ::
(Etempvar _rt tuint) :: (Etempvar _val tulong) :: nil))))
.
Definition f_emulate_mmio_read := {|
fn_return := tvoid;
fn_callconv := cc_default;
fn_params := ((_esr, tulong) :: (_rt, tuint) ::
(_rec, (tptr Tvoid)) :: nil);
fn_vars := nil;
fn_temps := ((_val, tulong) :: (_bit_count, tuint) :: (_mask, tulong) ::
(_t'6, tuint) :: (_t'5, tuint) :: (_t'4, tulong) ::
(_t'3, tuint) :: (_t'2, tulong) :: (_t'1, tulong) :: nil);
fn_body := emulate_mmio_read_body
|}.