VirtualBox

Ignore:
Timestamp:
Apr 3, 2013 11:15:02 AM (12 years ago)
Author:
vboxsync
Message:

IOM: Adding pVCpu to a lot of calls and moving the lookup caches from VM to VMCPU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/VBoxRecompiler.c

    r45276 r45305  
    9393static int      remR3InitPhysRamSizeAndDirtyMap(PVM pVM, bool fGuarded);
    9494
    95 static uint32_t remR3MMIOReadU8(void *pvVM, target_phys_addr_t GCPhys);
    96 static uint32_t remR3MMIOReadU16(void *pvVM, target_phys_addr_t GCPhys);
    97 static uint32_t remR3MMIOReadU32(void *pvVM, target_phys_addr_t GCPhys);
    98 static void     remR3MMIOWriteU8(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32);
    99 static void     remR3MMIOWriteU16(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32);
    100 static void     remR3MMIOWriteU32(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32);
     95static uint32_t remR3MMIOReadU8(void *pvEnv, target_phys_addr_t GCPhys);
     96static uint32_t remR3MMIOReadU16(void *pvEnv, target_phys_addr_t GCPhys);
     97static uint32_t remR3MMIOReadU32(void *pvEnv, target_phys_addr_t GCPhys);
     98static void     remR3MMIOWriteU8(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32);
     99static void     remR3MMIOWriteU16(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32);
     100static void     remR3MMIOWriteU32(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32);
    101101
    102102static uint32_t remR3HandlerReadU8(void *pvVM, target_phys_addr_t GCPhys);
     
    334334     * Register ram types.
    335335     */
    336     pVM->rem.s.iMMIOMemType    = cpu_register_io_memory(g_apfnMMIORead, g_apfnMMIOWrite, pVM);
     336    pVM->rem.s.iMMIOMemType    = cpu_register_io_memory(g_apfnMMIORead, g_apfnMMIOWrite, &pVM->rem.s.Env);
    337337    AssertReleaseMsg(pVM->rem.s.iMMIOMemType >= 0, ("pVM->rem.s.iMMIOMemType=%d\n", pVM->rem.s.iMMIOMemType));
    338338    pVM->rem.s.iHandlerMemType = cpu_register_io_memory(g_apfnHandlerRead, g_apfnHandlerWrite, pVM);
     
    37853785
    37863786/** Read MMIO memory. */
    3787 static uint32_t remR3MMIOReadU8(void *pvVM, target_phys_addr_t GCPhys)
    3788 {
    3789     uint32_t u32 = 0;
    3790     int rc = IOMMMIORead((PVM)pvVM, GCPhys, &u32, 1);
     3787static uint32_t remR3MMIOReadU8(void *pvEnv, target_phys_addr_t GCPhys)
     3788{
     3789    CPUX86State *env = (CPUX86State *)pvEnv;
     3790    uint32_t     u32 = 0;
     3791    int rc = IOMMMIORead(env->pVM, env->pVCpu, GCPhys, &u32, 1);
    37913792    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    37923793    Log2(("remR3MMIOReadU8: GCPhys=%RGp -> %02x\n", (RTGCPHYS)GCPhys, u32));
     
    37953796
    37963797/** Read MMIO memory. */
    3797 static uint32_t remR3MMIOReadU16(void *pvVM, target_phys_addr_t GCPhys)
    3798 {
    3799     uint32_t u32 = 0;
    3800     int rc = IOMMMIORead((PVM)pvVM, GCPhys, &u32, 2);
     3798static uint32_t remR3MMIOReadU16(void *pvEnv, target_phys_addr_t GCPhys)
     3799{
     3800    CPUX86State *env = (CPUX86State *)pvEnv;
     3801    uint32_t     u32 = 0;
     3802    int rc = IOMMMIORead(env->pVM, env->pVCpu, GCPhys, &u32, 2);
    38013803    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    38023804    Log2(("remR3MMIOReadU16: GCPhys=%RGp -> %04x\n", (RTGCPHYS)GCPhys, u32));
     
    38053807
    38063808/** Read MMIO memory. */
    3807 static uint32_t remR3MMIOReadU32(void *pvVM, target_phys_addr_t GCPhys)
    3808 {
    3809     uint32_t u32 = 0;
    3810     int rc = IOMMMIORead((PVM)pvVM, GCPhys, &u32, 4);
     3809static uint32_t remR3MMIOReadU32(void *pvEnv, target_phys_addr_t GCPhys)
     3810{
     3811    CPUX86State *env = (CPUX86State *)pvEnv;
     3812    uint32_t     u32 = 0;
     3813    int rc = IOMMMIORead(env->pVM, env->pVCpu, GCPhys, &u32, 4);
    38113814    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    38123815    Log2(("remR3MMIOReadU32: GCPhys=%RGp -> %08x\n", (RTGCPHYS)GCPhys, u32));
     
    38153818
    38163819/** Write to MMIO memory. */
    3817 static void     remR3MMIOWriteU8(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
    3818 {
    3819     int rc;
     3820static void     remR3MMIOWriteU8(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32)
     3821{
     3822    CPUX86State *env = (CPUX86State *)pvEnv;
     3823    int          rc;
    38203824    Log2(("remR3MMIOWriteU8: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3821     rc = IOMMMIOWrite((PVM)pvVM, GCPhys, u32, 1);
     3825    rc = IOMMMIOWrite(env->pVM, env->pVCpu, GCPhys, u32, 1);
    38223826    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    38233827}
    38243828
    38253829/** Write to MMIO memory. */
    3826 static void     remR3MMIOWriteU16(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
    3827 {
    3828     int rc;
     3830static void     remR3MMIOWriteU16(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32)
     3831{
     3832    CPUX86State *env = (CPUX86State *)pvEnv;
     3833    int          rc;
    38293834    Log2(("remR3MMIOWriteU16: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3830     rc = IOMMMIOWrite((PVM)pvVM, GCPhys, u32, 2);
     3835    rc = IOMMMIOWrite(env->pVM, env->pVCpu, GCPhys, u32, 2);
    38313836    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    38323837}
    38333838
    38343839/** Write to MMIO memory. */
    3835 static void     remR3MMIOWriteU32(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
    3836 {
    3837     int rc;
     3840static void     remR3MMIOWriteU32(void *pvEnv, target_phys_addr_t GCPhys, uint32_t u32)
     3841{
     3842    CPUX86State *env = (CPUX86State *)pvEnv;
     3843    int          rc;
    38383844    Log2(("remR3MMIOWriteU32: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
    3839     rc = IOMMMIOWrite((PVM)pvVM, GCPhys, u32, 4);
     3845    rc = IOMMMIOWrite(env->pVM, env->pVCpu, GCPhys, u32, 4);
    38403846    AssertMsg(rc == VINF_SUCCESS, ("rc=%Rrc\n", rc)); NOREF(rc);
    38413847}
     
    45574563        Log2(("cpu_outb: addr=%#06x val=%#x\n", addr, val));
    45584564
    4559     rc = IOMIOPortWrite(env->pVM, (RTIOPORT)addr, val, 1);
     4565    rc = IOMIOPortWrite(env->pVM, env->pVCpu, (RTIOPORT)addr, val, 1);
    45604566    if (RT_LIKELY(rc == VINF_SUCCESS))
    45614567        return;
     
    45724578{
    45734579    //Log2(("cpu_outw: addr=%#06x val=%#x\n", addr, val));
    4574     int rc = IOMIOPortWrite(env->pVM, (RTIOPORT)addr, val, 2);
     4580    int rc = IOMIOPortWrite(env->pVM, env->pVCpu, (RTIOPORT)addr, val, 2);
    45754581    if (RT_LIKELY(rc == VINF_SUCCESS))
    45764582        return;
     
    45884594    int rc;
    45894595    Log2(("cpu_outl: addr=%#06x val=%#x\n", addr, val));
    4590     rc = IOMIOPortWrite(env->pVM, (RTIOPORT)addr, val, 4);
     4596    rc = IOMIOPortWrite(env->pVM, env->pVCpu, (RTIOPORT)addr, val, 4);
    45914597    if (RT_LIKELY(rc == VINF_SUCCESS))
    45924598        return;
     
    46034609{
    46044610    uint32_t u32 = 0;
    4605     int rc = IOMIOPortRead(env->pVM, (RTIOPORT)addr, &u32, 1);
     4611    int rc = IOMIOPortRead(env->pVM, env->pVCpu, (RTIOPORT)addr, &u32, 1);
    46064612    if (RT_LIKELY(rc == VINF_SUCCESS))
    46074613    {
     
    46234629{
    46244630    uint32_t u32 = 0;
    4625     int rc = IOMIOPortRead(env->pVM, (RTIOPORT)addr, &u32, 2);
     4631    int rc = IOMIOPortRead(env->pVM, env->pVCpu, (RTIOPORT)addr, &u32, 2);
    46264632    if (RT_LIKELY(rc == VINF_SUCCESS))
    46274633    {
     
    46424648{
    46434649    uint32_t u32 = 0;
    4644     int rc = IOMIOPortRead(env->pVM, (RTIOPORT)addr, &u32, 4);
     4650    int rc = IOMIOPortRead(env->pVM, env->pVCpu, (RTIOPORT)addr, &u32, 4);
    46454651    if (RT_LIKELY(rc == VINF_SUCCESS))
    46464652    {
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