mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-14 07:11:32 +00:00
Rename copy_user() to memcpy_user(). Add memmove_user() and
userptr_add().
This commit is contained in:
parent
859da6bd32
commit
1d313234b3
@ -255,7 +255,7 @@ static int multiboot_load_raw ( struct image *image,
|
||||
}
|
||||
|
||||
/* Copy image to segment */
|
||||
copy_user ( buffer, 0, image->data, offset, filesz );
|
||||
memcpy_user ( buffer, 0, image->data, offset, filesz );
|
||||
|
||||
/* Record execution entry point */
|
||||
image->entry = hdr->mb.entry_addr;
|
||||
|
@ -110,6 +110,18 @@ copy_from_real_librm ( void *dest, unsigned int src_seg,
|
||||
*/
|
||||
typedef intptr_t userptr_t;
|
||||
|
||||
/**
|
||||
* Add offset to user pointer
|
||||
*
|
||||
* @v ptr User pointer
|
||||
* @v offset Offset
|
||||
* @ret new_ptr New pointer value
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) userptr_t
|
||||
userptr_add ( userptr_t ptr, off_t offset ) {
|
||||
return ( ptr + offset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy data to user buffer
|
||||
*
|
||||
@ -146,12 +158,28 @@ copy_from_user ( void *dest, userptr_t buffer, off_t offset, size_t len ) {
|
||||
* @v len Length
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
copy_user ( userptr_t dest, off_t dest_off, userptr_t src, off_t src_off,
|
||||
size_t len ) {
|
||||
memcpy_user ( userptr_t dest, off_t dest_off, userptr_t src, off_t src_off,
|
||||
size_t len ) {
|
||||
memcpy ( ( ( void * ) dest + dest_off ), ( ( void * ) src + src_off ),
|
||||
len );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy data between user buffers, allowing for overlap
|
||||
*
|
||||
* @v dest Destination user buffer
|
||||
* @v dest_off Offset within destination buffer
|
||||
* @v src Source user buffer
|
||||
* @v src_off Offset within source buffer
|
||||
* @v len Length
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
memmove_user ( userptr_t dest, off_t dest_off, userptr_t src, off_t src_off,
|
||||
size_t len ) {
|
||||
memmove ( ( ( void * ) dest + dest_off ), ( ( void * ) src + src_off ),
|
||||
len );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill user buffer with a constant byte
|
||||
*
|
||||
|
@ -94,7 +94,7 @@ static int elf_load_segment ( struct image *image, Elf_Phdr *phdr ) {
|
||||
}
|
||||
|
||||
/* Copy image to segment */
|
||||
copy_user ( buffer, 0, image->data, phdr->p_offset, phdr->p_filesz );
|
||||
memcpy_user ( buffer, 0, image->data, phdr->p_offset, phdr->p_filesz );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user