Commit 7d55170268abe2fedc96a662edff52bfe68763a6

Authored by blueswir1
1 parent 2e56350e

Fix compilation on Sparc host, implement ld and st

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4457 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
... ... @@ -53,19 +53,14 @@ static unsigned long next_tb;
53 53 // Work around ugly bugs in glibc that mangle global register contents
54 54  
55 55 static volatile void *saved_env;
56   -static volatile unsigned long saved_t0, saved_i7;
57 56 #undef SAVE_GLOBALS
58 57 #define SAVE_GLOBALS() do { \
59 58 saved_env = env; \
60   - saved_t0 = T0; \
61   - asm volatile ("st %%i7, [%0]" : : "r" (&saved_i7)); \
62 59 } while(0)
63 60  
64 61 #undef RESTORE_GLOBALS
65 62 #define RESTORE_GLOBALS() do { \
66 63 env = (void *)saved_env; \
67   - T0 = saved_t0; \
68   - asm volatile ("ld [%0], %%i7" : : "r" (&saved_i7)); \
69 64 } while(0)
70 65  
71 66 static int sparc_setjmp(jmp_buf buf)
... ...
tcg/sparc/tcg-target.c
... ... @@ -266,13 +266,19 @@ static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, in
266 266 static inline void tcg_out_ld(TCGContext *s, TCGType type, int ret,
267 267 int arg1, tcg_target_long arg2)
268 268 {
269   - fprintf(stderr, "unimplemented %s\n", __func__);
  269 + if (type == TCG_TYPE_I32)
  270 + tcg_out_ldst(s, ret, arg1, arg2, LDUW);
  271 + else
  272 + tcg_out_ldst(s, ret, arg1, arg2, LDX);
270 273 }
271 274  
272 275 static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
273 276 int arg1, tcg_target_long arg2)
274 277 {
275   - fprintf(stderr, "unimplemented %s\n", __func__);
  278 + if (type == TCG_TYPE_I32)
  279 + tcg_out_ldst(s, arg, arg1, arg2, STW);
  280 + else
  281 + tcg_out_ldst(s, arg, arg1, arg2, STX);
276 282 }
277 283  
278 284 static inline void tcg_out_arith(TCGContext *s, int rd, int rs1, int rs2,
... ... @@ -312,10 +318,14 @@ static inline void tcg_out_nop(TCGContext *s)
312 318 tcg_out32(s, SETHI | INSN_RD(TCG_REG_G0) | 0);
313 319 }
314 320  
315   -static inline void tcg_target_prologue(TCGContext *s)
  321 +/* Generate global QEMU prologue and epilogue code */
  322 +void tcg_target_qemu_prologue(TCGContext *s)
316 323 {
317 324 tcg_out32(s, SAVE | INSN_RD(TCG_REG_O6) | INSN_RS1(TCG_REG_O6) |
318 325 INSN_IMM13(-TCG_TARGET_STACK_MINFRAME));
  326 + tcg_out32(s, JMPL | INSN_RD(TCG_REG_G0) | INSN_RS1(TCG_REG_O0) |
  327 + INSN_RS2(TCG_REG_G0));
  328 + tcg_out_nop(s);
319 329 }
320 330  
321 331 static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
... ...
tcg/sparc/tcg-target.h
... ... @@ -84,8 +84,9 @@ enum {
84 84 /* optional instructions */
85 85 //#define TCG_TARGET_HAS_bswap_i32
86 86 //#define TCG_TARGET_HAS_bswap_i64
  87 +//#define TCG_TARGET_HAS_neg_i32
  88 +//#define TCG_TARGET_HAS_neg_i64
87 89  
88   -#define TCG_TARGET_NEEDS_PROLOGUE 1
89 90  
90 91 /* Note: must be synced with dyngen-exec.h */
91 92 #ifdef HOST_SOLARIS
... ...