mirror of https://github.com/proxmox/mirror_qemu
self modifying code also tests translation block chaining invalidation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@184 c046a42c-6fe2-441c-8c8c-71466251a162master
parent
d4e8164f7e
commit
d1fe2b2459
|
@ -1218,15 +1218,18 @@ uint8_t code[] = {
|
||||||
0xc3, /* ret */
|
0xc3, /* ret */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef int FuncType(void);
|
||||||
|
|
||||||
void test_self_modifying_code(void)
|
void test_self_modifying_code(void)
|
||||||
{
|
{
|
||||||
int (*func)(void);
|
int i;
|
||||||
|
|
||||||
func = (void *)code;
|
|
||||||
printf("self modifying code:\n");
|
printf("self modifying code:\n");
|
||||||
printf("func1 = 0x%x\n", func());
|
printf("func1 = 0x%x\n", ((FuncType *)code)());
|
||||||
code[1] = 0x2;
|
for(i = 2; i <= 4; i++) {
|
||||||
printf("func1 = 0x%x\n", func());
|
code[1] = i;
|
||||||
|
printf("func%d = 0x%x\n", i, ((FuncType *)code)());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *call_end __init_call = NULL;
|
static void *call_end __init_call = NULL;
|
||||||
|
|
Loading…
Reference in New Issue