Commit 76d83bde4a804e02bd944ecad648999be2f34ab7
1 parent
8c462f8f
Fixes for s/390 host support, by Bastian Blank.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3693 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
32 additions
and
24 deletions
check_ops.sh
configure
dyngen-exec.h
... | ... | @@ -38,7 +38,7 @@ typedef unsigned int uint32_t; |
38 | 38 | // Linux/Sparc64 defines uint64_t |
39 | 39 | #if !(defined (__sparc_v9__) && defined(__linux__)) |
40 | 40 | /* XXX may be done for all 64 bits targets ? */ |
41 | -#if defined (__x86_64__) || defined(__ia64) | |
41 | +#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) | |
42 | 42 | typedef unsigned long uint64_t; |
43 | 43 | #else |
44 | 44 | typedef unsigned long long uint64_t; |
... | ... | @@ -55,7 +55,7 @@ typedef signed short int16_t; |
55 | 55 | typedef signed int int32_t; |
56 | 56 | // Linux/Sparc64 defines int64_t |
57 | 57 | #if !(defined (__sparc_v9__) && defined(__linux__)) |
58 | -#if defined (__x86_64__) || defined(__ia64) | |
58 | +#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) | |
59 | 59 | typedef signed long int64_t; |
60 | 60 | #else |
61 | 61 | typedef signed long long int64_t; |
... | ... | @@ -205,7 +205,7 @@ extern int printf(const char *, ...); |
205 | 205 | #define stringify(s) tostring(s) |
206 | 206 | #define tostring(s) #s |
207 | 207 | |
208 | -#ifdef __alpha__ | |
208 | +#if defined(__alpha__) || defined(__s390__) | |
209 | 209 | /* the symbols are considered non exported so a br immediate is generated */ |
210 | 210 | #define __hidden __attribute__((visibility("hidden"))) |
211 | 211 | #else |
... | ... | @@ -224,6 +224,13 @@ extern int __op_param3 __hidden; |
224 | 224 | #define PARAM1 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param1)); _r; }) |
225 | 225 | #define PARAM2 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param2)); _r; }) |
226 | 226 | #define PARAM3 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param3)); _r; }) |
227 | +#elif defined(__s390__) | |
228 | +extern int __op_param1 __hidden; | |
229 | +extern int __op_param2 __hidden; | |
230 | +extern int __op_param3 __hidden; | |
231 | +#define PARAM1 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param1) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) | |
232 | +#define PARAM2 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param2) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) | |
233 | +#define PARAM3 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param3) "; l %0,0(%0)" : "=r"(_r) : ); _r; }) | |
227 | 234 | #else |
228 | 235 | #if defined(__APPLE__) |
229 | 236 | static int __op_param1, __op_param2, __op_param3; |
... | ... | @@ -254,7 +261,7 @@ extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3; |
254 | 261 | #define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n) |
255 | 262 | #elif defined(__s390__) |
256 | 263 | #define EXIT_TB() asm volatile ("br %r14") |
257 | -#define GOTO_LABEL_PARAM(n) asm volatile ("bras %r7,8; .long " ASM_NAME(__op_gen_label) #n "; l %r7, 0(%r7); br %r7") | |
264 | +#define GOTO_LABEL_PARAM(n) asm volatile ("larl %r7,12; l %r7,0(%r7); br %r7; .long " ASM_NAME(__op_gen_label) #n) | |
258 | 265 | #elif defined(__alpha__) |
259 | 266 | #define EXIT_TB() asm volatile ("ret") |
260 | 267 | #elif defined(__ia64__) | ... | ... |
dyngen.c
... | ... | @@ -1495,8 +1495,8 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, |
1495 | 1495 | p = (void *)(p_end - 2); |
1496 | 1496 | if (p == p_start) |
1497 | 1497 | error("empty code for %s", name); |
1498 | - if (get16((uint16_t *)p) != 0x07fe && get16((uint16_t *)p) != 0x07f4) | |
1499 | - error("br %%r14 expected at the end of %s", name); | |
1498 | + if ((get16((uint16_t *)p) & 0xfff0) != 0x07f0) | |
1499 | + error("br expected at the end of %s", name); | |
1500 | 1500 | copy_size = p - p_start; |
1501 | 1501 | } |
1502 | 1502 | #elif defined(HOST_ALPHA) |
... | ... | @@ -2120,6 +2120,19 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, |
2120 | 2120 | fprintf(outfile, " *(uint8_t *)(gen_code_ptr + %d) = %s + %d;\n", |
2121 | 2121 | reloc_offset, relname, addend); |
2122 | 2122 | break; |
2123 | + case R_390_PC32DBL: | |
2124 | + if (ELF32_ST_TYPE(symtab[ELFW(R_SYM)(rel->r_info)].st_info) == STT_SECTION) { | |
2125 | + fprintf(outfile, | |
2126 | + " *(uint32_t *)(gen_code_ptr + %d) += " | |
2127 | + "((long)&%s - (long)gen_code_ptr) >> 1;\n", | |
2128 | + reloc_offset, name); | |
2129 | + } | |
2130 | + else | |
2131 | + fprintf(outfile, | |
2132 | + " *(uint32_t *)(gen_code_ptr + %d) = " | |
2133 | + "(%s + %d - ((uint32_t)gen_code_ptr + %d)) >> 1;\n", | |
2134 | + reloc_offset, relname, addend, reloc_offset); | |
2135 | + break; | |
2123 | 2136 | default: |
2124 | 2137 | error("unsupported s390 relocation (%d)", type); |
2125 | 2138 | } | ... | ... |
exec-all.h
... | ... | @@ -350,24 +350,6 @@ do {\ |
350 | 350 | "1:\n");\ |
351 | 351 | } while (0) |
352 | 352 | |
353 | -#elif defined(__s390__) | |
354 | -/* GCC spills R13, so we have to restore it before branching away */ | |
355 | - | |
356 | -#define GOTO_TB(opname, tbparam, n)\ | |
357 | -do {\ | |
358 | - static void __attribute__((used)) *dummy ## n = &&dummy_label ## n;\ | |
359 | - static void __attribute__((used)) *__op_label ## n \ | |
360 | - __asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\ | |
361 | - __asm__ __volatile__ ( \ | |
362 | - "l %%r13,52(%%r15)\n" \ | |
363 | - "br %0\n" \ | |
364 | - : : "r" (((TranslationBlock*)tbparam)->tb_next[n]));\ | |
365 | - \ | |
366 | - for(;*((int*)0);); /* just to keep GCC busy */ \ | |
367 | -label ## n: ;\ | |
368 | -dummy_label ## n: ;\ | |
369 | -} while(0) | |
370 | - | |
371 | 353 | #else |
372 | 354 | |
373 | 355 | /* jump to next block operations (more portable code, does not need | ... | ... |