VirtualBox

Changeset 15009 in vbox


Ignore:
Timestamp:
Dec 4, 2008 11:27:46 PM (16 years ago)
Author:
vboxsync
Message:

new_recompiler: cleanup, optimization, compile with the right tool - gets rid of the nasty bug with bootmenu

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/REMInternal.h

    r13565 r15009  
    288288void    remR3DmaRun(CPUState *env);
    289289void    remR3TimersRun(CPUState *env);
    290 int     remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, uint32_t pvNextEIP);
     290int     remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, RTGCPTR pvNextEIP);
    291291void    remR3TrapStat(CPUState *env, uint32_t uTrap);
    292292void    remR3CpuId(CPUState *env, unsigned uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
  • trunk/src/recompiler_new/Makefile.kmk

    r14980 r15009  
    3333endif
    3434
     35TEMPLATE_DUMMY = dummy template (move to kBuild)
    3536ifeq ($(KBUILD_TARGET), win)
    36  TEMPLATE_DUMMY = dummy template (move to kBuild)
    3737 $(REM_MOD)_TOOL.win.x86    = MINGW32
    3838 $(REM_MOD)_TOOL.win.amd64  = XGCCAMD64LINUX
     
    4040 $(REM_MOD)_SDKS.win.x86    = W32API
    4141 $(REM_MOD)_ASFLAGS         = -x assembler-with-cpp
    42  $(REM_MOD)_CFLAGS          = -Wall -g
    43  $(REM_MOD)_CFLAGS.debug    = -O0
    44  $(REM_MOD)_CFLAGS.release += -fno-gcse -O2
     42 $(REM_MOD)_CFLAGS          = -Wall
     43 $(REM_MOD)_CFLAGS.debug    = -O0 -g
     44 $(REM_MOD)_CFLAGS.release += -fno-gcse -O2 
    4545 $(REM_MOD)_CFLAGS.profile  = $($(REM_MOD)_CFLAGS.release)
    4646 $(REM_MOD)_CFLAGS.kprofile = $($(REM_MOD)_CFLAGS.release)
     
    5555 USE_REM_IMP = 1
    5656else
    57  $(REM_MOD)_TEMPLATE  = VBOXR3NP
     57
     58 # Unfortunately little pinguins tend to have default compilers no suitable
     59 # for real compilation, so search better alternatives
     60 if1of ($(KBUILD_TARGET), linux)
     61  $(REM_MOD)_TOOL      = GCC3V3
     62  $(REM_MOD)_TEMPLATE  = DUMMY
     63  $(REM_MOD)_CFLAGS    = -fPIC                                          \
     64                         -Wall -fno-strict-aliasing -Wno-unused         \
     65                         -Wno-long-long -Wno-sign-compare
     66  $(REM_MOD)_CFLAGS.x86      = -m32
     67  $(REM_MOD)_CFLAGS.amd64    = -m64
     68  $(REM_MOD)_CFLAGS.debug    = -g -O0
     69  $(REM_MOD)_CFLAGS.release += -O2
     70 else
     71  $(REM_MOD)_TEMPLATE  = VBOXR3N
     72 endif
    5873
    5974 IMPORT_LIBS          += VBoxREM
  • trunk/src/recompiler_new/VBoxRecompiler.c

    r14974 r15009  
    751751        Assert(!(interrupt_request & ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT | CPU_INTERRUPT_EXITTB | CPU_INTERRUPT_TIMER | CPU_INTERRUPT_EXTERNAL_HARD | CPU_INTERRUPT_EXTERNAL_EXIT | CPU_INTERRUPT_EXTERNAL_TIMER)));
    752752        Assert(!pVM->rem.s.Env.singlestep_enabled);
    753 #if 1
    754 
    755753        /*
    756754         * Now we set the execute single instruction flag and enter the cpu_exec loop.
     
    853851         * Switch back the state.
    854852         */
    855 #else
    856         pVM->rem.s.Env.interrupt_request = 0;
    857         cpu_single_step(&pVM->rem.s.Env, 1);
    858 
    859         /*
    860          * Execute and handle the return code.
    861          * We execute without enabling the cpu tick, so on success we'll
    862          * just flip it on and off to make sure it moves.
    863          *
    864          * (We do not use emulate_single_instr() because that doesn't enter the
    865          * right way in will cause serious trouble if a longjmp was attempted.)
    866          */
    867 # ifdef DEBUG_bird
    868         remR3DisasInstr(&pVM->rem.s.Env, 1, "REMR3EmulateInstruction");
    869 # endif
    870         TMNotifyStartOfExecution(pVM);
    871         int cTimesMax = 16384;
    872         uint32_t eip = pVM->rem.s.Env.eip;
    873         do
    874         {
    875             rc = cpu_exec(&pVM->rem.s.Env);
    876 
    877         } while (   eip == pVM->rem.s.Env.eip
    878                  && (rc == EXCP_DEBUG || rc == EXCP_EXECUTE_RAW)
    879                  && --cTimesMax > 0);
    880         TMNotifyEndOfExecution(pVM);
    881         switch (rc)
    882         {
    883             /*
    884              * Single step, we assume!
    885              * If there was a breakpoint there we're fucked now.
    886              */
    887             case EXCP_DEBUG:
    888             {
    889                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_DEBUG\n"));
    890                 rc = VINF_EM_RESCHEDULE;
    891                 break;
    892             }
    893 
    894             /*
    895              * We cannot be interrupted!
    896              */
    897             case EXCP_INTERRUPT:
    898                 AssertMsgFailed(("Shouldn't happen! Everything was locked!\n"));
    899                 rc = VERR_INTERNAL_ERROR;
    900                 break;
    901 
    902             /*
    903              * hlt instruction.
    904              */
    905             case EXCP_HLT:
    906                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_HLT\n"));
    907                 rc = VINF_EM_HALT;
    908                 break;
    909 
    910             /*
    911              * The VM has halted.
    912              */
    913             case EXCP_HALTED:
    914                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_HALTED\n"));
    915                 rc = VINF_EM_HALT;
    916                 break;
    917 
    918             /*
    919              * Switch to RAW-mode.
    920              */
    921             case EXCP_EXECUTE_RAW:
    922                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_EXECUTE_RAW\n"));
    923                 rc = VINF_EM_RESCHEDULE_RAW;
    924                 break;
    925 
    926             /*
    927              * Switch to hardware accelerated RAW-mode.
    928              */
    929             case EXCP_EXECUTE_HWACC:
    930                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_EXECUTE_HWACC\n"));
    931                 rc = VINF_EM_RESCHEDULE_HWACC;
    932                 break;
    933 
    934             /*
    935              * An EM RC was raised (VMR3Reset/Suspend/PowerOff/some-fatal-error).
    936              */
    937             case EXCP_RC:
    938                 Log2(("REMR3EmulateInstruction: cpu_exec -> EXCP_RC rc=%Rrc\n", pVM->rem.s.rc));
    939                 rc = pVM->rem.s.rc;
    940                 pVM->rem.s.rc = VERR_INTERNAL_ERROR;
    941                 break;
    942 
    943             /*
    944              * Figure out the rest when they arrive....
    945              */
    946             default:
    947                 AssertMsgFailed(("rc=%d\n", rc));
    948                 Log2(("REMR3EmulateInstruction: cpu_exec -> %d\n", rc));
    949                 rc = VINF_SUCCESS;
    950                 break;
    951         }
    952 
    953         /*
    954          * Switch back the state.
    955          */
    956         cpu_single_step(&pVM->rem.s.Env, 0);
    957 #endif
    958853        pVM->rem.s.Env.interrupt_request = interrupt_request;
    959854        rc2 = REMR3StateBack(pVM);
     
    15811476 * @param   pvNextEIP       Next EIP
    15821477 */
    1583 int remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, uint32_t pvNextEIP)
     1478int remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, RTGCPTR pvNextEIP)
    15841479{
    15851480    PVM pVM = env->pVM;
     
    16021497    }
    16031498#endif
    1604     Log(("remR3NotifyTrap: uTrap=%x error=%x next_eip=%RGv eip=%RGv cr2=%RGv\n", uTrap, uErrorCode, (RTGCPTR)pvNextEIP, (RTGCPTR)env->eip, (RTGCPTR)env->cr[2]));
     1499    Log(("remR3NotifyTrap: uTrap=%x error=%x next_eip=%RGv eip=%RGv cr2=%RGv\n", uTrap, uErrorCode, pvNextEIP, (RTGCPTR)env->eip, (RTGCPTR)env->cr[2]));
    16051500    if(   uTrap < 0x20
    16061501       && (env->cr[0] & X86_CR0_PE)
     
    16121507        if(pVM->rem.s.uPendingException == uTrap && ++pVM->rem.s.cPendingExceptions > 512)
    16131508        {
    1614             LogRel(("VERR_REM_TOO_MANY_TRAPS -> uTrap=%x error=%x next_eip=%RGv eip=%RGv cr2=%RGv\n", uTrap, uErrorCode, (RTGCPTR)pvNextEIP, (RTGCPTR)env->eip, (RTGCPTR)env->cr[2]));
     1509            LogRel(("VERR_REM_TOO_MANY_TRAPS -> uTrap=%x error=%x next_eip=%RGv eip=%RGv cr2=%RGv\n", uTrap, uErrorCode, pvNextEIP, (RTGCPTR)env->eip, (RTGCPTR)env->cr[2]));
    16151510            remR3RaiseRC(env->pVM, VERR_REM_TOO_MANY_TRAPS);
    16161511            return VERR_REM_TOO_MANY_TRAPS;
     
    21412036    Assert(pVM->rem.s.fInREM);
    21422037
    2143         /*
     2038    /*
    21442039     * Copy back the registers.
    21452040     * This is done in the order they are declared in the CPUMCTX structure.
  • trunk/src/recompiler_new/cpu-all.h

    r14969 r15009  
    279279#if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB)
    280280
    281 DECLINLINE(int) ldub_p(void *ptr)
     281DECLINLINE(uint8_t) ldub_p(void *ptr)
    282282{
    283283    VBOX_CHECK_ADDR(ptr);
     
    285285}
    286286
    287 DECLINLINE(int) ldsb_p(void *ptr)
     287DECLINLINE(int8_t) ldsb_p(void *ptr)
    288288{
    289289    VBOX_CHECK_ADDR(ptr);
     
    297297}
    298298
    299 DECLINLINE(int) lduw_le_p(void *ptr)
     299DECLINLINE(uint32_t) lduw_le_p(void *ptr)
    300300{
    301301    VBOX_CHECK_ADDR(ptr);
     
    303303}
    304304
    305 DECLINLINE(int) ldsw_le_p(void *ptr)
     305DECLINLINE(int32_t) ldsw_le_p(void *ptr)
    306306{
    307307    VBOX_CHECK_ADDR(ptr);
     
    315315}
    316316
    317 DECLINLINE(int) ldl_le_p(void *ptr)
     317DECLINLINE(uint32_t) ldl_le_p(void *ptr)
    318318{
    319319    VBOX_CHECK_ADDR(ptr);
  • trunk/src/recompiler_new/target-i386/op_helper.c

    r14542 r15009  
    56435643    target_ulong old_eip;
    56445644
    5645     /* ensures env is loaded in ebp! */
     5645    /* ensures env is loaded! */
    56465646    CPUX86State *savedenv = env;
    56475647    env = env1;
  • trunk/src/recompiler_new/target-i386/translate.c

    r14742 r15009  
    46404640    s->rip_offset = 0; /* for relative ip address */
    46414641#ifdef VBOX
     4642    /* nike: seems only slow down things */
     4643# if 0
    46424644    /* Always update EIP. Otherwise one must be very careful with generated code that can raise exceptions. */
     4645
    46434646    gen_update_eip(pc_start - s->cs_base);
    4644 #endif
     4647# endif
     4648#endif
     4649
    46454650 next_byte:
    46464651    b = ldub_code(s->pc);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette