Function simics_api_sys::dbuffer_append_external_data
source · pub unsafe extern "C" fn dbuffer_append_external_data(
dbuffer: *mut dbuffer_t,
data: *mut c_void,
len: usize,
adopt: bool,
) -> *mut uint8
Expand description
Add static data. This will make the buffer reference the data pointed to directly, without making a copy.
If the ‘adopt’ flag is true, the control of the data block is transferred to the dbuffer. It is assumed to be a MM_MALLOCed block that will be MM_FREEd when the dbuffer is freed.
If the ‘adopt’ flag is false, the dbuffer will not free the memory. Instead it is up to the caller to free the memory, but it must not do so before the dbuffer is freed. Actually, this reference could be copied to other dbuffers, so great care has to be taken. This should only be used for buffers that will only be read, since it hard to know if a write operation will actually write to the buffer or to a copy.