What the difference between phys_copy and memcpy in Minix?
/*===========================================================================*/
/* phys_copy */
/*===========================================================================*/
/*
* PUBLIC phys_bytes phys_copy(phys_bytes source, phys_bytes destination,
* phys_bytes bytecount);
* Copy a block of data from anywhere to anywhere in physical memory.
*/
/* es edi esi eip src dst len */
ENTRY(phys_copy)
push %ebp
mov %esp, %ebp
cld
push %esi
push %edi
mov 8(%ebp), %esi
mov 12(%ebp), %edi
mov 16(%ebp), %eax
cmp $10, %eax /* avoid align overhead for small counts */
jb pc_small
mov %esi, %ecx /* align source, hope target is too */
neg %ecx
and $3, %ecx /* count for alignment */
sub %ecx, %eax
rep movsb (%esi), (%edi)
mov %eax, %ecx
shr $2, %ecx /* count of dwords */
rep movsl (%esi), (%edi)
and $3, %eax
pc_small:
xchg %eax, %ecx /* remainder */
rep movsb (%esi), (%edi)
mov $0, %eax /* 0 means: no fault */
LABEL(phys_copy_fault) /* kernel can send us here */
pop %edi
pop %esi
pop %ebp
ret
LABEL(phys_copy_fault_in_kernel) /* kernel can send us here */
pop %edi
pop %esi
pop %ebp
mov %cr2, %eax
ret