Copymem() – Intel Extensible Firmware Interface User Manual
Page 187
Services — Boot Services
Version 1.10
12/01/02
5-89
CopyMem()
Summary
The
CopyMem()
function copies the contents of one buffer to another buffer.
Prototype
VOID
CopyMem (
IN VOID
*Destination,
IN VOID
*Source,
IN UINTN
Length
);
Parameters
Destination
Pointer to the destination buffer of the memory copy.
Source
Pointer to the source buffer of the memory copy.
Length
Number of bytes to copy from
Source
to
Destination
.
Description
The
CopyMem()
function copies
Length
bytes from the buffer
Source
to the buffer
Destination
.
The implementation of
CopyMem()
must be reentrant, and it must handle overlapping
Source
and
Destination
buffers. This means that the implementation of
CopyMem()
must choose the
correct direction of the copy operation based on the type of overlap that exists between the
Source
and
Destination
buffers. If either the
Source
buffer or the
Destination
buffer
crosses the top of the processor’s address space, then the result of the copy operation is
unpredictable.
The contents of the
Destination
buffer on exit from this service must match the contents of the
Source
buffer on entry to this service. Due to potential overlaps, the contents of the
Source
buffer may be modified by this service. The following rules can be used to guarantee the correct
behavior:
1. If
Destination
and
Source
are identical, then no operation should be performed.
2. If
Destination
>
Source
and
Destination
< (
Source
+
Length
), then the data
should be copied from the
Source
buffer to the
Destination
buffer starting from the end
of the buffers and working toward the beginning of the buffers.
3. Otherwise, the data should be copied from the
Source
buffer to the
Destination
buffer
starting from the beginning of the buffers and working toward the end of the buffers.
Status Codes Returned
None.