/* Find the highest image not yet in its final position */
highest = NULL;
for_each_image ( initrd ) {
- if ( ( userptr_sub ( initrd->data, current ) < 0 ) &&
+ if ( ( userptr_diff ( initrd->data, current ) < 0 ) &&
( ( highest == NULL ) ||
- ( userptr_sub ( initrd->data,
- highest->data ) > 0 ) ) ) {
+ ( userptr_diff ( initrd->data,
+ highest->data ) > 0 ) ) ) {
highest = initrd;
}
}
/* Move this image to its final position */
len = ( ( highest->len + INITRD_ALIGN - 1 ) &
~( INITRD_ALIGN - 1 ) );
- current = userptr_sub ( current, len );
+ current = userptr_add ( current, -len );
DBGC ( &images, "INITRD squashing %s [%#08lx,%#08lx)->"
"[%#08lx,%#08lx)\n", highest->name,
user_to_phys ( highest->data, 0 ),
/* Copy any remaining initrds (e.g. embedded images) to the region */
for_each_image ( initrd ) {
- if ( userptr_sub ( initrd->data, top ) >= 0 ) {
+ if ( userptr_diff ( initrd->data, top ) >= 0 ) {
len = ( ( initrd->len + INITRD_ALIGN - 1 ) &
~( INITRD_ALIGN - 1 ) );
- current = userptr_sub ( current, len );
+ current = userptr_add ( current, -len );
DBGC ( &images, "INITRD copying %s [%#08lx,%#08lx)->"
"[%#08lx,%#08lx)\n", initrd->name,
user_to_phys ( initrd->data, 0 ),
/* Calculate limits of available space for initrds */
top = initrd_top;
- if ( userptr_sub ( initrd_bottom, bottom ) > 0 )
+ if ( userptr_diff ( initrd_bottom, bottom ) > 0 )
bottom = initrd_bottom;
/* Debug */
/* Calculate available free space */
free = bottom;
- free_len = userptr_sub ( used, free );
+ free_len = userptr_diff ( used, free );
/* Bubble-sort initrds into desired order */
while ( initrd_swap_any ( free, free_len ) ) {}
/* Calculate limits of available space for initrds */
top = initrd_top;
- if ( userptr_sub ( initrd_bottom, bottom ) > 0 )
+ if ( userptr_diff ( initrd_bottom, bottom ) > 0 )
bottom = initrd_bottom;
- available = userptr_sub ( top, bottom );
+ available = userptr_diff ( top, bottom );
/* Allow for a sensible minimum amount of free space */
len += INITRD_MIN_FREE_LEN;
}
static inline __always_inline off_t
-UACCESS_INLINE ( librm, userptr_sub ) ( userptr_t userptr,
- userptr_t subtrahend ) {
- return trivial_userptr_sub ( userptr, subtrahend );
+UACCESS_INLINE ( librm, userptr_diff ) ( userptr_t userptr,
+ userptr_t subtrahend ) {
+ return trivial_userptr_diff ( userptr, subtrahend );
}
static inline __always_inline void
* @ret offset Offset
*/
static inline __always_inline off_t
-trivial_userptr_sub ( userptr_t userptr, userptr_t subtrahend ) {
+trivial_userptr_diff ( userptr_t userptr, userptr_t subtrahend ) {
return ( userptr - subtrahend );
}
}
static inline __always_inline off_t
-UACCESS_INLINE ( flat, userptr_sub ) ( userptr_t userptr,
- userptr_t subtrahend ) {
- return trivial_userptr_sub ( userptr, subtrahend );
+UACCESS_INLINE ( flat, userptr_diff ) ( userptr_t userptr,
+ userptr_t subtrahend ) {
+ return trivial_userptr_diff ( userptr, subtrahend );
}
static inline __always_inline void
* @v subtrahend User pointer to be subtracted
* @ret offset Offset
*/
-off_t userptr_sub ( userptr_t userptr, userptr_t subtrahend );
+off_t userptr_diff ( userptr_t userptr, userptr_t subtrahend );
/**
* Convert virtual address to a physical address