VirtualBox

Changeset 13184

Show
Ignore:
Timestamp:
10/10/08 19:04:38 (3 months ago)
Author:
vboxsync
Message:

intermediate TCG integration step

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/recompiler_new/Makefile.kmk

    r13044 r13184  
    3737include $(KBUILD_PATH)/subheader.kmk 
    3838 
    39 BLDPROGS             += dyngen 
    40 ifneq ($(or $(eq $(KBUILD_TARGET_ARCH),amd64) , $(VBOX_TARGET_MAC_OS_X_VERSION_10_5)),) 
    41  SYSMODS             += VBoxREM2 
    42  REM_MOD             += VBoxREM2 
    43 else 
    44  REM_MOD             += VBoxREM 
    45 endif 
     39 
     40REM_MOD              += VBoxREM 
    4641DLLS                 += VBoxREM 
    4742IMPORT_LIBS          += VBoxREMImp 
     
    5954TEMPLATE_DUMMY = dummy template (move to kBuild) 
    6055 
    61  
    6256# 
    6357# L4 must use the no-crt path because it's lacking math stuff it seems... 
     
    7367endif 
    7468 
    75  
    76 # 
    77 # The dyngen build tool. 
    78 # 
    79 ifeq ($(KBUILD_HOST),win) 
    80  dyngen_TOOL          = MINGW32 
    81  dyngen_SDKS          = W32API 
    82  # On 64-bit Windows we pretend to be 32-bit. 
    83  dyngen_BLD_TRG_ARCH  = x86 
    84  dyngen_BLD_TRG_CPU   = i386 
    85  dyngen_CFLAGS        = -Wall -g -fno-strict-aliasing 
    86  dyngen_TEMPLATE      = DUMMY 
    87 else 
    88  dyngen_TEMPLATE      = VBOXBLDPROG 
    89 endif 
    90 dyngen_DEFS          += REM_PHYS_ADDR_IN_TLB 
    91 ifeq ($(KBUILD_TARGET_ARCH),amd64) 
    92  dyngen_DEFS         += HOST_X86_64=1 
    93 endif 
    94 dyngen_CFLAGS        += -Wno-missing-prototypes -Wno-missing-declarations 
    95 dyngen_INCS           = \ 
    96         Sun \ 
    97         target-i386 \ 
    98         fpu \ 
    99         . 
    100 dyngen_SOURCES        = dyngen.c 
    101  
    102  
    10369# 
    10470# The VBoxREM.[dll|so|..] or VBoxREM2.rel. 
     
    10874#$(REM_MOD)_DEFS          += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB  # Enables huge amounts of debug logging. 
    10975 
    110 $(REM_MOD)_INCS             = \ 
    111         Sun \ 
    112         Sun/crt\ 
    113         target-i386 \ 
    114         fpu \ 
    115         $(PATH_$(REM_MOD)) \ 
     76$(REM_MOD)_INCS             =     \ 
     77        Sun                       \ 
     78        Sun/crt                   \ 
     79        target-i386               \ 
     80        tcg                       \ 
     81        fpu                       \ 
     82        $(PATH_$(REM_MOD))        \ 
    11683        $(PATH_ROOT)/src/VBox/VMM \ 
    11784        . 
    11885 
    119 $(REM_MOD)_SOURCES          = \ 
    120         VBoxRecompiler.c \ 
    121         cpu-exec.c \ 
    122         exec.c \ 
    123         translate-all.c \ 
    124         translate-op.c \ 
    125         fpu/softfloat-native.c \ 
    126         target-i386/helper.c \ 
    127         target-i386/helper2.c \ 
     86$(REM_MOD)_SOURCES          =   \ 
     87        VBoxRecompiler.c        \ 
     88        cpu-exec.c              \ 
     89        exec.c                  \ 
     90        translate-all.c         \ 
     91        translate-op.c          \ 
     92        tcg/tcg.c               \ 
     93        tcg/tcg-dyngen.c        \ 
     94        tcg/tcg-runtime.c       \ 
     95        fpu/softfloat-native.c  \ 
     96        target-i386/helper.c    \ 
     97        target-i386/helper2.c   \ 
    12898        target-i386/translate.c 
     99 
     100ifeq ($(KBUILD_TARGET_ARCH),amd64) 
     101 $(REM_MOD)_INCS             +=  tcg/x86_64 
     102 $(REM_MOD)_SOURCES          +=  tcg/x86_64/tcg-target.c 
     103else 
     104 $(REM_MOD)_INCS             +=  tcg/i386 
     105 $(REM_MOD)_SOURCES          +=  tcg/i386/tcg-target.c 
     106endif 
     107 
     108 
    129109$(REM_MOD)_SOURCES.debug = \ 
    130110        Sun/testmath.c 
    131 ifeq ($(filter-out win os2,$(KBUILD_TARGET)),) 
    132  $(REM_MOD)_SOURCES        += target-i386/op.c 
    133  FILE_OP_OBJ                = $(PATH_$(REM_MOD))/target-i386/op.o 
    134 else # The remaining targets can be using gcc-4 and needs checking. 
    135  $(REM_MOD)_SOURCES        += $(PATH_$(REM_MOD))/op.S 
    136  FILE_OP_OBJ                = $(PATH_$(REM_MOD))/gen/op.o 
    137  $(REM_MOD)_CLEAN           = $(FILE_OP_OBJ) $(PATH_$(REM_MOD))/op.S.dep 
    138 endif 
    139111$(REM_MOD)_SOURCES.win.x86  = $(REM_MOD).def 
    140112ifneq ($(REM_MOD),VBoxREM2) 
     
    238210 
    239211# Extra flags for these source modules. 
    240 target-i386/op.c_CFLAGS         = -O2 -fno-strict-aliasing -fomit-frame-pointer -falign-functions=0 -fno-reorder-blocks -fno-optimize-sibling-calls 
    241 target-i386/op.c_CFLAGS.x86     = -fno-gcse -fno-instrument-functions -mpreferred-stack-boundary=2 
    242 target-i386/op.c_CFLAGS.darwin.x86 = -m128bit-long-double -mpreferred-stack-boundary=4 
    243212target-i386/helper.c_CFLAGS.x86 = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse 
    244213cpu-exec.c_CFLAGS.x86           = -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-gcse 
     
    246215 
    247216 
    248 translate-all.c_DEPS = \ 
    249         $(PATH_$(REM_MOD))/op.h \ 
    250         $(PATH_$(REM_MOD))/opc.h \ 
    251         $(PATH_$(REM_MOD))/gen-op.h 
     217# transitional rule 
     218$(PATH_$(REM_MOD))/op.h: 
     219        $(APPEND)    $@ '' 
     220 
     221translate-all.c_DEPS =  
    252222translate-op.c_DEPS = $(translate-all.c_DEPS) 
    253223target-i386/translate.c_DEPS = $(translate-all.c_DEPS) 
    254  
    255224 
    256225# 
     
    338307include $(KBUILD_PATH)/subfooter.kmk 
    339308 
    340  
    341 # 
    342 # Generate the op.S file somehow... 
    343 # 
    344 # Gathering the flags, defines and include dirs for the command is a lot 
    345 # of work. Unfortunately, there is only a highly specialized kBuild function 
    346 # for doing this, so we're currently left to our own devices here. 
    347 # 
    348 # Add something like VBOX_RECOMPILER_OP_GCC = gcc-3.4.6 to LocalConfig.kmk 
    349 # to be 100% sure that you get a working op.S. My gcc 4.1.1 seems to work 
    350 # fine, so feel free to try VBOX_RECOMPILER_OP_GCC = gcc. 
    351 # 
    352 # The op-undefined.lst is generated by finding all the undefined symbols 
    353 # in one (or more) ELF op.o files using nm. 
    354 # 
    355 ifndef VBOX_RECOMPILER_OP_GCC 
    356  ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86) 
    357   VBOX_RECOMPILER_OP_GCC ?= $(notdir $(firstword $(which i386-elf-gcc-3.4 i386-elf-gcc-3.4.6 i386-elf-gcc-3.4.3 i386-elf-gcc) i386-elf-gcc)) # (port install i386-gcc-elf) 
    358   VBOX_RECOMPILER_OP_GCC_OK := yes 
    359   VBOX_RECOMPILER_OP_GCC_INCS ?= $(abspath $(dir $(shell LC_ALL=C $(VBOX_RECOMPILER_OP_GCC) -print-libgcc-file-name)))/include 
    360  endif 
    361  ifndef VBOX_RECOMPILER_OP_GCC 
    362   VBOX_RECOMPILER_OP_GCC := $(TOOL_$(VBOX_GCC_TOOL)_CC) 
    363   VBOX_RECOMPILER_OP_GCC_OK := dunno 
    364  endif 
    365 else 
    366  # If set, assume it's an OK compiler. 
    367  VBOX_RECOMPILER_OP_GCC_OK := yes 
    368 endif 
    369  
    370  
    371 # The command sans -o op.S.tmp. 
    372 COMPILE_OP_CMDS_3 = $(VBOX_RECOMPILER_OP_GCC) \ 
    373         -S -s \ 
    374         $(filter-out -g -O0, \ 
    375                 $($(REM_MOD)_CFLAGS) $($(REM_MOD)_CFLAGS.$(KBUILD_TYPE)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CFLAGS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \ 
    376                 $(target-i386/op.c_CFLAGS) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET)) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET_ARCH)) $(target-i386/op.c_CFLAGS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \ 
    377                 ) \ 
    378         $(addprefix -I, $(abspathex \ 
    379                 $($(REM_MOD)_CINCS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CINCS.$(KBUILD_TARGET)) $($(REM_MOD)_CINCS) $(CINCS) \ 
    380                 $($(REM_MOD)_INCS.$(KBUILD_TARGET_ARCH))  $($(REM_MOD)_INCS.$(KBUILD_TARGET))  $($(REM_MOD)_INCS) $(INCS) \ 
    381                 , $($(REM_MOD)_PATH))) \ 
    382         $(addprefix -D, \ 
    383                 $($(REM_MOD)_CDEFS.$(KBUILD_TARGET_ARCH)) $($(REM_MOD)_CDEFS.$(KBUILD_TARGET)) $($(REM_MOD)_CDEFS) $(CDEFS.$(KBUILD_TARGET)) $(CDEFS.$(KBUILD_TARGET_ARCH)) $(CDEFS.$(KBUILD_TYPE)) $(CDEFS) \ 
    384                 $($(REM_MOD)_DEFS.$(KBUILD_TARGET_ARCH))  $($(REM_MOD)_DEFS.$(KBUILD_TARGET))  $($(REM_MOD)_DEFS)  $(DEFS.$(KBUILD_TARGET))  $(DEFS.$(KBUILD_TARGET_ARCH))  $(DEFS.$(KBUILD_TYPE))  $(DEFS) \ 
    385                 ) \ 
    386         -Wp,-MD,$(PATH_$(REM_MOD))/op.S.dep \ 
    387         -Wp,-MT,$(PATH_$(REM_MOD))/op.S \ 
    388         -Wp,-MP \ 
    389         $(VBOX_PATH_RECOMPILER_SRC)/target-i386/op.c 
    390  
    391 # Use the right GCC includes. 
    392 ifdef VBOX_RECOMPILER_OP_GCC_INCS 
    393 COMPILE_OP_CMDS_2 = $(subst $(VBOX_PATH_GCC_INCS),$(VBOX_RECOMPILER_OP_GCC_INCS),$(COMPILE_OP_CMDS_3)) 
    394 else 
    395 COMPILE_OP_CMDS_2 = $(COMPILE_OP_CMDS_3) 
    396 endif 
    397  
    398 # Drop incompatible options when using the cross-compiler on darwin. 
    399 ifeq ($(KBUILD_TARGET),darwin) 
    400  ifeq ($(filter-out i386-elf-gcc%, $(VBOX_RECOMPILER_OP_GCC)),) 
    401   COMPILE_OP_CMDS = $(filter-out -mdynamic-no-pic -mno-dynamic-no-pic -fno-stack-protector -Wno-missing-field-initializers, $(COMPILE_OP_CMDS_2)) 
    402  endif 
    403 else if1of ($(KBUILD_TARGET),linux) 
    404  ifneq ($(TOOL_$(VBOX_GCC_TOOL)_CC),$(VBOX_RECOMPILER_OP_GCC)) 
    405   VBOX_RECOMPILER_OP_CHECK_CC_GCC = $(shell \ 
    406     if $(VBOX_RECOMPILER_OP_GCC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ 
    407     then echo "$(1)"; \ 
    408     else echo "$(2)"; fi; ) 
    409   COMPILE_OP_CMDS = \ 
    410     $(filter-out -fno-stack-protector -Wextra -Wno-missing-field-initializers, $(COMPILE_OP_CMDS_2)) \ 
    411     $(call VBOX_RECOMPILER_OP_CHECK_CC_GCC,-fno-stack-protector) 
    412  endif 
    413 endif 
    414 COMPILE_OP_CMDS ?= $(COMPILE_OP_CMDS_2) 
    415  
    416 # include the dependencies 
    417 -include $(PATH_$(REM_MOD))/op.S.dep 
    418  
    419 # The rule. 
    420 $(PATH_$(REM_MOD))/op.S: \ 
    421                 $(VBOX_PATH_RECOMPILER_SRC)/target-i386/op.c \ 
    422                 $(VBOX_PATH_RECOMPILER_SRC)/Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S \ 
    423                 $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-validate.sed \ 
    424                 $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-darwin.sed \ 
    425                 $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-undefined.lst \ 
    426                 $(VBOX_PATH_RECOMPILER_SRC)/Makefile.kmk \ 
    427                 $$(comp-cmds COMPILE_OP_CMDS,COMPILE_OP_CMDS_PREV,FORCE) \ 
    428                 | $(call DIRDEP,$(PATH_$(REM_MOD))) 
    429         $(RM) -f $@ $@.tmp $@.tmp2 $@.dep 
    430 ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),yes) 
    431         $(call MSG_COMPILE,VBoxREM,$<,$@,AS) 
    432         $(addsuffix $(SP)\$(NL)$(TAB)  ,$(COMPILE_OP_CMDS)) -o $@.tmp 
    433 else ifeq ($(VBOX_RECOMPILER_OP_GCC_OK),dunno) # (permit 3.x.x and 4.1.x+ for now) 
    434         major_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^\([2-9]\)\..*$$/\1/'`; \ 
    435         minor_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.\([0-9]\)\..*$$/\1/'`; \ 
    436         bugfix_ver=`$(VBOX_RECOMPILER_OP_GCC) -dumpversion | $(SED) -e 's/^[2-9]\.[0-9]\.\([0-9]\).*$$/\1/'`; \ 
    437         if test "$$major_ver" = "3" -o "(" "$$major_ver" = "4" -a "$$minor_ver" != "0" ")"; then \ 
    438                 $(ECHO_EXT) "Compiling $< => $@ [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \ 
    439                 $(addsuffix $(SP)\$(NL)$(TAB)$(TAB)  ,$(COMPILE_OP_CMDS)) -o $@.tmp; \ 
    440         else \ 
    441                 $(ECHO_EXT) "Using staged op.S [gcc v$${major_ver}.$${minor_ver}.$${bugfix_ver}]" && \ 
    442                 $(CP_EXT) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S $@.tmp; \ 
    443         fi 
    444 else 
    445         $(CP) $(VBOX_PATH_RECOMPILER_SRC)/Sun/staged-op-elf-$(KBUILD_TARGET_ARCH).S $@.tmp 
    446 endif 
    447         $(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-validate.sed $@.tmp 
    448 ifeq ($(KBUILD_TARGET),darwin) 
    449         $(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-darwin.sed $@.tmp > $@.tmp2 
    450         $(SED) -e 's/^\(.*\)$$/#define \1 _\1/' $(VBOX_PATH_RECOMPILER_SRC)/Sun/op-undefined.lst > $@.tmp 
    451         $(CAT_EXT) $@.tmp2 >> $@.tmp 
    452 endif 
    453         $(MV) -f $@.tmp $@ 
    454         $(QUIET2)$(APPEND) "$@.dep" 
    455         $(QUIET2)$(APPEND) "$@.dep" 'define COMPILE_OP_CMDS_PREV' 
    456         $(QUIET2)$(APPEND) "$@.dep" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$@.dep" ',$(COMPILE_OP_CMDS))' 
    457         $(QUIET2)$(APPEND) "$@.dep" 'endef' 
    458  
    459  
    460 # Hack for crosscompiling. 
    461 DYNGEN = $(PATH_dyngen)/dyngen$(HOSTSUFF_EXE) 
    462 DYNGEN_EXEC = $(DYNGEN) 
    463 ifneq ($(KBUILD_HOST),$(KBUILD_TARGET)) # hack for crosscompiling. 
    464  ifeq ($(KBUILD_TARGET),win) 
    465   DYNGEN       = $(PATH_dyngen)/dyngen.exe 
    466   DYNGEN_EXEC := $(EXEC_X86_WIN32) $(DYNGEN_EXEC) 
    467  endif 
    468 endif 
    469  
    470 # The dyngen rules. 
    471 $(PATH_$(REM_MOD))/op.h:     $(FILE_OP_OBJ) $(DYNGEN) 
    472         $(call MSG_TOOL,dyngen,VBoxREM,$<,$@) 
    473         $(QUIET)$(DYNGEN_EXEC) -o $@ $< 
    474  
    475 $(PATH_$(REM_MOD))/opc.h:    $(FILE_OP_OBJ) $(DYNGEN) 
    476         $(call MSG_TOOL,dyngen,VBoxREM,$<,$@) 
    477         $(QUIET)$(DYNGEN_EXEC) -c -o $@ $< 
    478  
    479 $(PATH_$(REM_MOD))/gen-op.h: $(FILE_OP_OBJ) $(DYNGEN) 
    480         $(call MSG_TOOL,dyngen,VBoxREM,$<,$@) 
    481         $(QUIET)$(DYNGEN_EXEC) -g -o $@ $< 
    482  
    483  
    484 # Some aliases 
    485 do_dyngen: $(PATH_$(REM_MOD))/gen-op.h $(PATH_$(REM_MOD))/opc.h $(PATH_$(REM_MOD))/op.h 
    486309importlib: $(LIB_REM) 
    487 op.S: $(PATH_$(REM_MOD))/op.S 
    488  
  • trunk/src/recompiler_new/Sun/config.h

    r9143 r13184  
    2929#define TARGET_X86_64 
    3030#endif 
     31 
     32#define unlikely(cond) RT_UNLIKELY(cond) 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy