Exemplo n.º 1
0
// Returns the new address if the argument is the address of an object that
// has moved, otherwise returns the original.
PolyWord SaveFixupAddress::GetNewAddress(PolyWord old)
{
    if (old.IsTagged() || old == PolyWord::FromUnsigned(0) || gMem.IsIOPointer(old.AsAddress()))
        return old; //  Nothing to do.

    // When we are updating addresses in the stack or in code segments we may have
    // code pointers.
    if (old.IsCodePtr())
    {
        // Find the start of the code segment
        PolyObject *oldObject = ObjCodePtrToPtr(old.AsCodePtr());
        // Calculate the byte offset of this value within the code object.
        POLYUNSIGNED offset = old.AsCodePtr() - (byte*)oldObject;
        PolyWord newObject = GetNewAddress(oldObject);
        return PolyWord::FromCodePtr(newObject.AsCodePtr() + offset);
    }

    ASSERT(old.IsDataPtr());

    PolyObject *obj = old.AsObjPtr();
    
    if (obj->ContainsForwardingPtr()) // tombstone is a pointer to a moved object
    {
        PolyObject *newp = obj->GetForwardingPtr();
        ASSERT (newp->ContainsNormalLengthWord());
        return newp;
    }
    
    ASSERT (obj->ContainsNormalLengthWord()); // object is not moved
    return old;
}
Exemplo n.º 2
0
void __fastcall sub_51A140(void *thisptr, PVOID _EDX, DWORD address, size_t scanSize)
{
	DWORD dwNew = GetNewAddress(address);

	CEG_DEBUG_PRINT;

	sub_51A140_o(thisptr, dwNew, scanSize);
}
Exemplo n.º 3
0
/*
 * Perform a normal login and do a redirect if needed. Caller should perform
 * a normal login test. We don't throw anything but the calls we make might
 * and we just let them through ...
 */
void iSCSILibWrapper::iSCSINormalLoginWithRedirect(void)
{
    // We don't need to remove ourselves and add ourselves back because
    // the methods we will call will do that.
    iSCSINormalLogin();

    // If we were redirected, then disconnect and start again
    // We just perform all the correct steps
    if (IsRedirected())
    {
        std::string newAddress = GetNewAddress();

        iSCSIDisconnect();

        SetAddress(newAddress);

        iSCSIConnect();

        iSCSINormalLogin();
    }
}
Exemplo n.º 4
0
// Returns the new address if the argument is the address of an object that
// has moved, otherwise returns the original.
PolyWord ProcessFixupAddress::GetNewAddress(PolyWord old)
{
    if (old.IsTagged() || old == PolyWord::FromUnsigned(0) || gMem.IsIOPointer(old.AsAddress()))
        return old; //  Nothing to do.

    // When we are updating addresses in the stack or in code segments we may have
    // code pointers.
    if (old.IsCodePtr())
    {
        // Find the start of the code segment
        PolyObject *oldObject = ObjCodePtrToPtr(old.AsCodePtr());
        // Calculate the byte offset of this value within the code object.
        POLYUNSIGNED offset = old.AsCodePtr() - (byte*)oldObject;
        PolyWord newObject = GetNewAddress(oldObject);
        return PolyWord::FromCodePtr(newObject.AsCodePtr() + offset);
    }

    ASSERT(old.IsDataPtr());

    PolyObject *obj = old.AsObjPtr();
    POLYUNSIGNED L = obj->LengthWord();

    // Generally each address will point to an object processed at a lower depth.
    // The exception is if we have a cycle and have assigned the rest of the
    // structure to a higher depth.
    // N.B. We return the original address here but this could actually share
    // with something else and not be retained.
    if (OBJ_IS_DEPTH(L))
        return old;

    if (obj->ContainsForwardingPtr()) // tombstone is a pointer to a shared object
    {
        PolyObject *newp = obj->GetForwardingPtr();
//        ASSERT (newp->ContainsNormalLengthWord());
        return newp;
    }

    ASSERT (obj->ContainsNormalLengthWord()); // object is not shared
    return old;
}
Exemplo n.º 5
0
POLYUNSIGNED SaveFixupAddress::ScanAddressAt(PolyWord *pt)
{
    *pt = GetNewAddress(*pt);
    return 0;
}
Exemplo n.º 6
0
 virtual PolyObject *ScanObjectAddress(PolyObject *base)
     { return GetNewAddress(base).AsObjPtr(); }
Exemplo n.º 7
0
void *hk_memcpy(void *dest, const void *src, size_t size)
{
	PVOID dwNew = (PVOID)GetNewAddress((DWORD)src);

	return memcpy(dest, dwNew, size);
}