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