summaryrefslogtreecommitdiff
path: root/tests/test-i386.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-25 16:47:16 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-25 16:47:16 +0000
commitd1fe2b245910d42715e556458afe7d975d9417ef (patch)
tree0657dabbcfcc44aea3fa69e6a021a4cee62917de /tests/test-i386.c
parentd4e8164f7e9342d692c1d6f1c848ed05f8007ece (diff)
downloadqemu-d1fe2b245910d42715e556458afe7d975d9417ef.zip
self modifying code also tests translation block chaining invalidation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@184 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/test-i386.c')
-rw-r--r--tests/test-i386.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test-i386.c b/tests/test-i386.c
index 50c2d5b2cb..4629105c77 100644
--- a/tests/test-i386.c
+++ b/tests/test-i386.c
@@ -1218,15 +1218,18 @@ uint8_t code[] = {
0xc3, /* ret */
};
+typedef int FuncType(void);
+
void test_self_modifying_code(void)
{
- int (*func)(void);
+ int i;
- func = (void *)code;
printf("self modifying code:\n");
- printf("func1 = 0x%x\n", func());
- code[1] = 0x2;
- printf("func1 = 0x%x\n", func());
+ printf("func1 = 0x%x\n", ((FuncType *)code)());
+ for(i = 2; i <= 4; i++) {
+ code[1] = i;
+ printf("func%d = 0x%x\n", i, ((FuncType *)code)());
+ }
}
static void *call_end __init_call = NULL;