mirror of https://github.com/ipxe/ipxe.git
Added user_to_phys() and memset_user().
parent
c980cdd0aa
commit
ceca6b185c
|
@ -152,6 +152,19 @@ copy_user ( userptr_t dest, off_t dest_off, userptr_t src, off_t src_off,
|
|||
len );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill user buffer with a constant byte
|
||||
*
|
||||
* @v buffer User buffer
|
||||
* @v offset Offset within buffer
|
||||
* @v c Constant byte with which to fill
|
||||
* @v len Length
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
memset_user ( userptr_t buffer, off_t offset, int c, size_t len ) {
|
||||
memset ( ( ( void * ) buffer + offset ), c, len );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert virtual address to user buffer
|
||||
*
|
||||
|
@ -190,6 +203,18 @@ phys_to_user ( physaddr_t physical ) {
|
|||
return virt_to_user ( phys_to_virt ( physical ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert user buffer to physical address
|
||||
*
|
||||
* @v buffer User buffer
|
||||
* @v offset Offset within user buffer
|
||||
* @ret physical Physical address
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) physaddr_t
|
||||
user_to_phys ( userptr_t buffer, off_t offset ) {
|
||||
return virt_to_phys ( ( void * ) buffer + offset );
|
||||
}
|
||||
|
||||
/* Copy to/from real-mode stack */
|
||||
extern uint16_t copy_to_rm_stack ( void *data, size_t size );
|
||||
extern void remove_from_rm_stack ( void *data, size_t size );
|
||||
|
|
Loading…
Reference in New Issue