4 * Test self-modifying code
7 volatile int array
[20];
9 int return_const(short *p
, int i
)
11 // Include lots of writes to stress store buffer flushing
34 //__builtin_flush_icache(p, 2);
36 // calling __builtin_flush_icache(p, 2) is correct, but here
37 // I use synci directly to test the worst case.
41 ".set pop" :: "m" (*p
));
43 asm(".set noreorder");
50 int return_const2(short *p
, int i
)
52 // Include lots of writes to stress store buffer flushing
75 //__builtin_flush_icache(p, 2);
77 // calling __builtin_flush_icache(p, 2) is correct, but here
78 // I use synci directly to test the worst case.
83 "synci %0" :: "m" (*p
));
87 asm("here: li $2, 1729");
97 for (i
= 0; i
< 100; ++i
) {
98 short *p
= (short *) return_const2
+ 53; // Magic!
99 if (return_const2(p
, i
) != i
) {