[4438] temporary hack to handle register shortage with dyngen for qemu_st64 ()
Revision: 4438
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4438 Author: bellard Date: 2008-05-12 13:49:14 +0000 (Mon, 12 May 2008)
Log Message:
-----------
temporary hack to handle register shortage with dyngen for qemu_st64()
Modified Paths:
--------------
trunk/tcg/tcg.c
trunk/tcg/tcg.h
Modified: trunk/tcg/tcg.c
===================================================================
tcg/tcg.c +39 -0
@@ -308,6 +308,45 @@return MAKE_TCGV (idx); } +#if TCG_TARGET_REG_BITS ==32 +/* temporary hack to avoid register shortage for tcg_qemu_st64() */ +TCGv tcg_global_reg2_new_hack (TCGType type,int reg1,int reg2, +const char *name) +{ +TCGContext *s = &tcg_ctx; +TCGTemp *ts; +int idx; +char buf[64 ]; + +if (type !=TCG_TYPE_I64 ) +tcg_abort (); + idx = s->nb_globals; +tcg_temp_alloc (s, s->nb_globals +2 ); + ts = &s->temps[s->nb_globals]; + ts->base_type = type; + ts->type =TCG_TYPE_I32 ; + ts->fixed_reg =1 ; + ts->reg = reg1; + ts->val_type =TEMP_VAL_REG ; +pstrcpy (buf,sizeof (buf), name); +pstrcat (buf,sizeof (buf),"_0" ); + ts->name =strdup (buf); + + ts++; + ts->base_type = type; + ts->type =TCG_TYPE_I32 ; + ts->fixed_reg =1 ; + ts->reg = reg2; + ts->val_type =TEMP_VAL_REG ; +pstrcpy (buf,sizeof (buf), name); +pstrcat (buf,sizeof (buf),"_1" ); + ts->name =strdup (buf); + + s->nb_globals +=2 ; +return MAKE_TCGV (idx); +} +#endif +TCGv tcg_global_mem_new (TCGType type,int reg,tcg_target_long offset,const char *name) {
Modified: trunk/tcg/tcg.h
===================================================================
tcg/tcg.h +2 -0
@@ -267,6 +267,8 @@ tcg_target_long start, tcg_target_long size);void tcg_set_macro_func (TCGContext *s,TCGMacroFunc *func);TCGv tcg_global_reg_new (TCGType type,int reg,const char *name); +TCGv tcg_global_reg2_new_hack (TCGType type,int reg1,int reg2, +const char *name);TCGv tcg_global_mem_new (TCGType type,int reg,tcg_target_long offset,const char *name);TCGv tcg_temp_new (TCGType type);
First, thanks to all for your time & energy...
I saw all the changes, and decided to take it for a spin. (and yes, I know gcc4 is not 'supported' ...)
It fails to compile in target-i386/translate.c ...
I poked around a bit, but to no avail.
Perhaps you knew about this, in which case sorry for the noise.
./configure --prefix=/usr/bin --enable-ac97 --enable-alsa --disable-vnc-tls --disable-gcc-check --target-list=x86_64-softmmu
gcc -I. -I.. -I/home/rick/docs/qemu/trunk/target-i386 -I/home/rick/docs/qemu/trunk -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/rick/docs/qemu/trunk/tcg -I/home/rick/docs/qemu/trunk/tcg/x86_64 -I/home/rick/docs/qemu/trunk/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/rick/docs/qemu/trunk/slirp -Wall -O2 -g -fno-strict-aliasing -m64 -c -o helper2.o /home/rick/docs/qemu/trunk/target-i386/helper2.c
gcc -I. -I.. -I/home/rick/docs/qemu/trunk/target-i386 -I/home/rick/docs/qemu/trunk -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/rick/docs/qemu/trunk/tcg -I/home/rick/docs/qemu/trunk/tcg/x86_64 -I/home/rick/docs/qemu/trunk/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/rick/docs/qemu/trunk/slirp -Wall -O2 -g -fno-strict-aliasing -m64 -c -o disas.o /home/rick/docs/qemu/trunk/disas.c
rm -f libqemu.a
ar rcs libqemu.a exec.o kqemu.o translate-all.o cpu-exec.o translate.o
host-utils.o op.o tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.ofpu/softfloat-native.o helper.o helper2.o disas.o i386-dis.o
gcc -g -m64 -o qemu-system-x86_64 vl.o osdep.o monitor.o pci.o loader.o
isa_mmio.o machine.o block-raw-posix.o lsi53c895a.o esp.o usb-ohci.o
eeprom93xx.o eepro100.o ne2000.o pcnet.o rtl8139.o e1000.o ide.o pckbd.o
ps2.o vga.o sb16.o es1370.o ac97.o dma.o fdc.o mc146818rtc.o serial.o i8259.o
i8254.o pcspk.o pc.o cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
usb-uhci.o vmmouse.o vmport.o vmware_vga.o gdbstub.o ../libqemu_common.a
libqemu.a -lm -lz -lasound -lrt -lpthread -lutil -lSDL -lpthread -lcurseslibqemu.a(translate.o): In function `optimize_flags_init':/home/rick/docs/qemu/trunk/target-i386/translate.c:6694: undefined reference
to `tcg_global_reg2_new_hack'
collect2: ld returned 1 exit status
Quoted 78 lines · Fabrice Bellard
Revision: 4438
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4438 Author: bellard Date: 2008-05-12 13:49:14 +0000 (Mon, 12 May 2008)Log Message:
-----------
temporary hack to handle register shortage with dyngen forqemu_st64()Modified Paths:
--------------
trunk/tcg/tcg.c
trunk/tcg/tcg.hModified:
trunk/tcg/tcg.c
===================================================================tcg/tcg.c +39
-0@@ -308,6 +308,45 @@return MAKE_TCGV (idx); } +#if TCG_TARGET_REG_BITS ==32 +/* temporary hack to avoid register shortage for tcg_qemu_st64() */ +TCGv tcg_global_reg2_new_hack (TCGType type,int reg1,int reg2, +const char *name) +{ +TCGContext *s = &tcg_ctx; +TCGTemp *ts; +int idx; +char buf[64 ]; + +if (type !=TCG_TYPE_I64 ) +tcg_abort (); + idx = s->nb_globals; +tcg_temp_alloc (s, s->nb_globals +2 ); + ts = &s->temps[s->nb_globals]; + ts->base_type = type; + ts->type =TCG_TYPE_I32 ; + ts->fixed_reg =1 ; + ts->reg = reg1; + ts->val_type =TEMP_VAL_REG ; +pstrcpy (buf,sizeof (buf), name); +pstrcat (buf,sizeof (buf),"_0" ); + ts->name =strdup (buf); + + ts++; + ts->base_type = type; + ts->type =TCG_TYPE_I32 ; + ts->fixed_reg =1 ; + ts->reg = reg2; + ts->val_type =TEMP_VAL_REG ; +pstrcpy (buf,sizeof (buf), name); +pstrcat (buf,sizeof (buf),"_1" ); + ts->name =strdup (buf); + + s->nb_globals +=2 ; +return MAKE_TCGV (idx); +} +#endif +TCGv tcg_global_mem_new (TCGType type,int reg,tcg_target_long offset,const char *name) {Modified:
trunk/tcg/tcg.h
===================================================================tcg/tcg.h +2
-0@@ -267,6 +267,8 @@ tcg_target_long start, tcg_target_long size);void tcg_set_macro_func (TCGContext *s,TCGMacroFunc *func);TCGv tcg_global_reg_new (TCGType type,int reg,const char *name); +TCGv tcg_global_reg2_new_hack (TCGType type,int reg1,int reg2, +const char *name);TCGv tcg_global_mem_new (TCGType type,int reg,tcg_target_long offset,const char *name);TCGv tcg_temp_new (TCGType type);
Quoted 2 lines · Rick Vernam
/home/rick/docs/qemu/trunk/target-i386/translate.c:6694: undefined reference to `tcg_global_reg2_new_hack'
I have no clue how/why tcg works.
however, I suspect that the call to tcg_global_reg2_new_hack in target-i386/translate.c should also be conditional on #if TCG_TARGET_REG_BITS == 32 (as it's implementation in tcg.c is...)
well, in any case, doing so circumvents that compilation error, and qemu runs fine...
Thanks again!
-Rick