PsWriteMmioLinear

Writes MMIO contents using a linear address.

Syntax

PULSE_STATUS PsWriteMmioLinear(
 [in] PPS_ENGINE pEngine,
 [in] uint64_t PageTableAddress,
 [in] uint64_t Address,
 [in] uint8_t AccessSize,
 [in, out] PS_CACHE_TYPE *pCacheType,
 [in] void* pBuffer,
 [in] uint64_t cbToWrite,
 [out, optional] uint64_t* pcbWritten
);

Parameters

PPS_ENGINE pEngine

An opaque handle to an engine created by the EngCreateEngine function.

uint64_t PageTableAddress

The target page table root address. This page table is used to perform the page walk for the given address. The currently loaded page table address is in the CR3 register.

uint64_t Address

The linear address to which data is written.

uint8_t AccessSize

The size of the access that will be used for MMIO writes. Valid values are 1, 2, 4 and 8.

PS_CACHE_TYPE *pCacheType

The memory caching type that will be used for MMIO writes. Receives the effective memory-caching type used for the operation. See Remarks for more information.

void* pBuffer

The buffer containing the data to be wrttien.

uint64_t cbToWrite

Specifies how many bytes should be written.

uint64_t* pcbWritten

Returns the number of bytes that were actually written.

Return value

If the function succeeds, the return value is PULSE_STATUS_SUCCESS.

If it fails, it returns one of the PULSE_STATUS values. Possible return codes include, but are not limited to, the following:

PULSE_STATUS_PARTIAL_WRITE
0x00000002
Only a portion of memory was written. Check the *pcbWritten parameter value to determine how many bytes were written.
PULSE_STATUS_INSUFFICIENT_RESOURCES
0xC0000002
One of the memory allocations failed during initialization.
PULSE_STATUS_READ_FAILED
0xC0000003
Transport communication failed during a read operation.
PULSE_STATUS_WRITE_FAILED
0xC0000004
Transport communication failed during a write operation.
PULSE_STATUS_TIMEOUT
0xC0000007
Might happen if
  • Transport I/O timed out.
  • No response was received from the debuggee within the request timeout period.
PULSE_STATUS_INVALID_PARAMETER
0xC0000010
Might happen if
  • The pEngine parameter is NULL.
  • The pBuffer parameter is NULL.
  • The pCacheType parameter is NULL.
  • The offset parameter is not aligned to the AccessSize.
  • The cbToRead parameter is not aligned to the AccessSize.
  • The AccessSize is not equal to 1, 2, 4 or 8.
PULSE_STATUS_INVALID_PACKET
0xC0000031
An invalid or unexpected packet was received in response.
PULSE_STATUS_INVALID_TRANSLATION
0xC0000021
Linear to physical address translation failed. Might happen if there is no valid page in the translation.
PULSE_STATUS_DEVICE_CONNECTION_LOST
0xC0000308
The connection to the transport was lost. Try restarting the engine or the transport.

Remarks

The maximum number of bytes that can be written in a single request can be determined using the PsRequestGetMaxWriteMmioLinearBufferSize function. If a larger amount is specified, this function performs multiple requests to the debug target.

Partial writes may occur when address translation is not available beyond a certain point.

The function attempts to use the memory caching type specified by pCacheType, but platform settings may override it. The effective memory caching type used for the operation is returned through pCacheType