mirror of
https://github.com/ipxe/ipxe
synced 2026-02-04 06:59:59 +03:00
[uaccess] Remove user_to_phys() and phys_to_user()
Remove the intermediate concept of a user pointer from physical address conversions, leaving virt_to_phys() and phys_to_virt() as the directly implemented functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -128,16 +128,16 @@ userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index ) {
|
||||
copy_from_user ( &acpi, rsdt, 0, sizeof ( acpi ) );
|
||||
if ( acpi.signature != cpu_to_le32 ( RSDT_SIGNATURE ) ) {
|
||||
DBGC ( colour, "RSDT %#08lx has invalid signature:\n",
|
||||
user_to_phys ( rsdt, 0 ) );
|
||||
DBGC_HDA ( colour, user_to_phys ( rsdt, 0 ), &acpi,
|
||||
virt_to_phys ( rsdt ) );
|
||||
DBGC_HDA ( colour, virt_to_phys ( rsdt ), &acpi,
|
||||
sizeof ( acpi ) );
|
||||
return UNULL;
|
||||
}
|
||||
len = le32_to_cpu ( acpi.length );
|
||||
if ( len < sizeof ( rsdtab->acpi ) ) {
|
||||
DBGC ( colour, "RSDT %#08lx has invalid length:\n",
|
||||
user_to_phys ( rsdt, 0 ) );
|
||||
DBGC_HDA ( colour, user_to_phys ( rsdt, 0 ), &acpi,
|
||||
virt_to_phys ( rsdt ) );
|
||||
DBGC_HDA ( colour, virt_to_phys ( rsdt ), &acpi,
|
||||
sizeof ( acpi ) );
|
||||
return UNULL;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index ) {
|
||||
sizeof ( entry ) );
|
||||
|
||||
/* Read table header */
|
||||
table = phys_to_user ( entry );
|
||||
table = phys_to_virt ( entry );
|
||||
copy_from_user ( &acpi.signature, table, 0,
|
||||
sizeof ( acpi.signature ) );
|
||||
|
||||
@@ -169,20 +169,20 @@ userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index ) {
|
||||
/* Check table integrity */
|
||||
if ( acpi_checksum ( table ) != 0 ) {
|
||||
DBGC ( colour, "RSDT %#08lx found %s with bad "
|
||||
"checksum at %08lx\n", user_to_phys ( rsdt, 0 ),
|
||||
"checksum at %08lx\n", virt_to_phys ( rsdt ),
|
||||
acpi_name ( signature ),
|
||||
user_to_phys ( table, 0 ) );
|
||||
virt_to_phys ( table ) );
|
||||
break;
|
||||
}
|
||||
|
||||
DBGC ( colour, "RSDT %#08lx found %s at %08lx\n",
|
||||
user_to_phys ( rsdt, 0 ), acpi_name ( signature ),
|
||||
user_to_phys ( table, 0 ) );
|
||||
virt_to_phys ( rsdt ), acpi_name ( signature ),
|
||||
virt_to_phys ( table ) );
|
||||
return table;
|
||||
}
|
||||
|
||||
DBGC ( colour, "RSDT %#08lx could not find %s\n",
|
||||
user_to_phys ( rsdt, 0 ), acpi_name ( signature ) );
|
||||
virt_to_phys ( rsdt ), acpi_name ( signature ) );
|
||||
return UNULL;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ static int acpi_zsdt ( userptr_t zsdt, uint32_t signature, void *data,
|
||||
if ( buf != cpu_to_le32 ( signature ) )
|
||||
continue;
|
||||
DBGC ( zsdt, "DSDT/SSDT %#08lx found %s at offset %#zx\n",
|
||||
user_to_phys ( zsdt, 0 ), acpi_name ( signature ),
|
||||
virt_to_phys ( zsdt ), acpi_name ( signature ),
|
||||
offset );
|
||||
|
||||
/* Attempt to extract data */
|
||||
@@ -251,7 +251,7 @@ int acpi_extract ( uint32_t signature, void *data,
|
||||
fadt = acpi_table ( FADT_SIGNATURE, 0 );
|
||||
if ( fadt ) {
|
||||
copy_from_user ( &fadtab, fadt, 0, sizeof ( fadtab ) );
|
||||
dsdt = phys_to_user ( fadtab.dsdt );
|
||||
dsdt = phys_to_virt ( fadtab.dsdt );
|
||||
if ( ( rc = acpi_zsdt ( dsdt, signature, data,
|
||||
extract ) ) == 0 )
|
||||
return 0;
|
||||
|
||||
@@ -248,7 +248,7 @@ int block_translate ( struct interface *block, userptr_t buffer, size_t size ) {
|
||||
DBGC2 ( blktrans, "BLKTRANS %p created", blktrans );
|
||||
if ( buffer ) {
|
||||
DBGC2 ( blktrans, " for %#lx+%#zx",
|
||||
user_to_phys ( buffer, 0 ), size );
|
||||
virt_to_phys ( buffer ), size );
|
||||
}
|
||||
DBGC2 ( blktrans, "\n" );
|
||||
return 0;
|
||||
|
||||
@@ -251,7 +251,7 @@ int cachedhcp_record ( struct cached_dhcp_packet *cache, unsigned int vlan,
|
||||
|
||||
/* Store as cached packet */
|
||||
DBGC ( colour, "CACHEDHCP %s at %#08lx+%#zx/%#zx\n", cache->name,
|
||||
user_to_phys ( data, 0 ), len, max_len );
|
||||
virt_to_phys ( data ), len, max_len );
|
||||
cache->dhcppkt = dhcppkt;
|
||||
cache->vlan = vlan;
|
||||
|
||||
|
||||
@@ -613,8 +613,8 @@ int fbcon_init ( struct fbcon *fbcon, userptr_t start,
|
||||
/* Derive overall length */
|
||||
fbcon->len = ( pixel->height * pixel->stride );
|
||||
DBGC ( fbcon, "FBCON %p at [%08lx,%08lx)\n", fbcon,
|
||||
user_to_phys ( fbcon->start, 0 ),
|
||||
user_to_phys ( fbcon->start, fbcon->len ) );
|
||||
virt_to_phys ( fbcon->start ),
|
||||
( virt_to_phys ( fbcon->start ) + fbcon->len ) );
|
||||
|
||||
/* Calculate margin. If the actual screen size is larger than
|
||||
* the requested screen size, then update the margins so that
|
||||
|
||||
@@ -300,8 +300,8 @@ int register_image ( struct image *image ) {
|
||||
image->flags |= IMAGE_REGISTERED;
|
||||
list_add_tail ( &image->list, &images );
|
||||
DBGC ( image, "IMAGE %s at [%lx,%lx) registered\n",
|
||||
image->name, user_to_phys ( image->data, 0 ),
|
||||
user_to_phys ( image->data, image->len ) );
|
||||
image->name, virt_to_phys ( image->data ),
|
||||
( virt_to_phys ( image->data ) + image->len ) );
|
||||
|
||||
/* Try to detect image type, if applicable. Ignore failures,
|
||||
* since we expect to handle some unrecognised images
|
||||
|
||||
@@ -32,7 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*/
|
||||
|
||||
/* Flat address space user access API */
|
||||
PROVIDE_UACCESS_INLINE ( flat, phys_to_user );
|
||||
PROVIDE_UACCESS_INLINE ( flat, user_to_phys );
|
||||
PROVIDE_UACCESS_INLINE ( flat, phys_to_virt );
|
||||
PROVIDE_UACCESS_INLINE ( flat, virt_to_phys );
|
||||
PROVIDE_UACCESS_INLINE ( flat, virt_to_user );
|
||||
PROVIDE_UACCESS_INLINE ( flat, memchr_user );
|
||||
|
||||
Reference in New Issue
Block a user