VirtualBox

Ticket #10222: patch-implement_MachineDebugger_ReadPhysicalMemory.patch

File patch-implement_MachineDebugger_ReadPhysicalMemory.patch, 1.3 KB (added by Luiz Angelo Daros de Luca, 13 years ago)

Implemented MachineDebugger::ReadPhysicalMemory using PGMPhysSimpleReadGCPhys

  • VBox/Main/src-client/MachineDebuggerImpl.cpp

    diff --git a/VBox/Main/src-client/MachineDebuggerImpl.cpp b/VBox/Main/src-client/MachineDebuggerImpl.cpp
    index 899965b..df3670a 100644
    a b  
    3232#include <VBox/err.h>
    3333#include <iprt/cpp/utils.h>
    3434
     35#include <VBox/vmm/pgm.h>
     36
    3537// defines
    3638/////////////////////////////////////////////////////////////////////////////
    3739
    STDMETHODIMP MachineDebugger::ModifyLogDestinations(IN_BSTR a_bstrSettings)  
    10371039
    10381040STDMETHODIMP MachineDebugger::ReadPhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData))
    10391041{
    1040     ReturnComNotImplemented();
     1042    Console::SafeVMPtrQuiet pVM (mParent);
     1043
     1044    if (!pVM.isOk())
     1045        return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running");
     1046
     1047    int rc = E_UNEXPECTED;
     1048    try
     1049    {
     1050        com::SafeArray<BYTE> buf(a_cbRead);
     1051        rc = PGMPhysSimpleReadGCPhys(pVM.raw(), buf.raw(), a_Address, a_cbRead);
     1052        if (RT_SUCCESS(rc))
     1053        {
     1054            buf.detachTo(ComSafeArrayOutArg(a_abData));
     1055        }
     1056        else
     1057        {
     1058            RTLogRelPrintf("rc=%Rrc\n", rc);
     1059            return rc;
     1060        }
     1061    }
     1062    catch (std::bad_alloc)
     1063    {
     1064        return E_OUTOFMEMORY;
     1065    }
     1066
     1067    return rc;
    10411068}
    10421069
    10431070STDMETHODIMP MachineDebugger::WritePhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData))

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