]>
Commit | Line | Data |
---|---|---|
f2093fc3 MŁ |
1 | --- qemu/dyngen.c.x 2005-05-16 10:30:43.000000000 +0100 |
2 | +++ qemu/dyngen.c 2005-05-16 10:32:41.000000000 +0100 | |
3 | @@ -1996,6 +1996,9 @@ void gen_code(const char *name, host_ulo | |
4 | int retpos; | |
5 | int exit_addrs[MAX_EXITS]; | |
6 | #endif | |
7 | +#if defined(HOST_PPC) | |
8 | + uint8_t *blr_addr = NULL; | |
9 | +#endif | |
10 | ||
11 | /* Compute exact size excluding prologue and epilogue instructions. | |
12 | * Increment start_offset to skip epilogue instructions, then compute | |
13 | @@ -2018,9 +2021,23 @@ void gen_code(const char *name, host_ulo | |
14 | p = (void *)(p_end - 4); | |
15 | if (p == p_start) | |
16 | error("empty code for %s", name); | |
17 | - if (get32((uint32_t *)p) != 0x4e800020) | |
18 | - error("blr expected at the end of %s", name); | |
19 | - copy_size = p - p_start; | |
20 | + if (get32((uint32_t *)p) == 0x4e800020) { | |
21 | + copy_size = p - p_start; /* blr at end */ | |
22 | + } else { | |
23 | + /* Find the blr and note its address so that we | |
24 | + can emit code to rewrite it to a branch. */ | |
25 | + do { | |
26 | + p -= 4; | |
27 | + | |
28 | + if (get32((uint32_t *)p) == 0x4e800020) { | |
29 | + blr_addr = p; | |
30 | + copy_size = p_end - p_start; | |
31 | + break; | |
32 | + } | |
33 | + } while (p > p_start); | |
34 | + if (p == p_start) | |
35 | + error("blr expected in the end of %s", name); | |
36 | + } | |
37 | } | |
38 | #elif defined(HOST_S390) | |
39 | { | |
40 | @@ -2633,6 +2650,9 @@ void gen_code(const char *name, host_ulo | |
41 | #else | |
42 | #error unsupport object format | |
43 | #endif | |
44 | + if (blr_addr) | |
45 | + fprintf(outfile, " *(uint32_t *)(gen_code_ptr + %d) = 0x48000000 | %d;\n", | |
46 | + blr_addr - p_start, p_end - blr_addr); | |
47 | } | |
48 | #elif defined(HOST_S390) | |
49 | { |