e1efc8e9bfe17353f3fc803edb0b206ec1d12897
[satcheck.git] / test / userprog_pointers.c
1 #include <stdio.h>
2 #include <stdatomic.h>
3 #include "threads.h"
4 #include "libinterface.h"
5
6 int x;
7 int y;
8 int z;
9 int *px;
10 int *py;
11 int gr1;
12 int gr2;
13
14 int user_main(int argc, char **argv)
15 {
16         //      thrd_t t1, t2;
17
18         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
19         store_32(&x, 0);   // x = 0
20         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
21         store_32(&y, 0);   // y = 0
22
23         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
24         store_32(&py, (uint32_t)&z); // py = &z
25         // MCID mpx = MC2_nextOpLoad(MCID_NODEP);
26         px = (int *)load_32(&py); // px = y;
27         // MC2_nextOpStore(mpx, MCID_NODEP);
28         store_32(px, 25); // *px = 25;
29         
30         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
31         store_32(&px, (uint32_t)&x); // px = &x
32
33         // MC2_nextOpStore(MCID_NODEP, mx);
34         store_32(&y, x);
35         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
36         store_32(&y, (uint32_t) &x);
37
38         // MC2_nextOpStore(MCID_NODEP, mpx);
39         store_32(&y, (uint32_t) px);
40         // MC2_nextOpStore(MCID_NODEP, MCID_NODEP);
41         store_32(&y, (uint32_t) &px);
42
43         return 0;
44 }