iPXE
|
Access to external ("user") memory. More...
#include <stdint.h>
#include <string.h>
#include <ipxe/api.h>
#include <config/ioapi.h>
#include <ipxe/linux/linux_uaccess.h>
#include <bits/uaccess.h>
Go to the source code of this file.
Macros | |
#define | UACCESS_PREFIX_flat __flat_ |
#define | UNULL ( ( userptr_t ) 0 ) |
Equivalent of NULL for user pointers. More... | |
#define | UACCESS_INLINE(_subsys, _api_func) SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) |
Calculate static inline user access API function name. More... | |
#define | PROVIDE_UACCESS(_subsys, _api_func, _func) PROVIDE_SINGLE_API ( UACCESS_PREFIX_ ## _subsys, _api_func, _func ) |
Provide an user access API implementation. More... | |
#define | PROVIDE_UACCESS_INLINE(_subsys, _api_func) PROVIDE_SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) |
Provide a static inline user access API implementation. More... | |
Typedefs | |
typedef unsigned long | userptr_t |
A pointer to a user buffer. More... | |
Variables | |
static __always_inline unsigned long off_t | offset |
static __always_inline off_t userptr_t | subtrahend |
static __always_inline void off_t | dest_off |
static __always_inline void off_t userptr_t | src |
static __always_inline void off_t userptr_t off_t | src_off |
static __always_inline void off_t userptr_t off_t size_t | len |
static __always_inline int off_t | first_off |
static __always_inline int off_t userptr_t | second |
static __always_inline int off_t userptr_t off_t | second_off |
static __always_inline void off_t int | c |
Access to external ("user") memory.
iPXE often needs to transfer data between internal and external buffers. On i386, the external buffers may require access via a different segment, and the buffer address cannot be encoded into a simple void * pointer. The userptr_t
type encapsulates the information needed to identify an external buffer, and the copy_to_user() and copy_from_user() functions provide methods for transferring data between internal and external buffers.
Note that userptr_t is an opaque type; in particular, performing arithmetic upon a userptr_t is not allowed.
Definition in file uaccess.h.
#define UNULL ( ( userptr_t ) 0 ) |
#define UACCESS_INLINE | ( | _subsys, | |
_api_func | |||
) | SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) |
#define PROVIDE_UACCESS | ( | _subsys, | |
_api_func, | |||
_func | |||
) | PROVIDE_SINGLE_API ( UACCESS_PREFIX_ ## _subsys, _api_func, _func ) |
#define PROVIDE_UACCESS_INLINE | ( | _subsys, | |
_api_func | |||
) | PROVIDE_SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) |
typedef unsigned long userptr_t |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Definition at line 236 of file uaccess.h.
References addr, and trivial_virt_to_user().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
userptr_t phys_to_user | ( | unsigned long | phys_addr | ) |
Convert physical address to user pointer.
phys_addr | Physical address |
userptr | User pointer |
Referenced by acpi_extract(), acpi_find_via_rsdt(), bios_find_smbios2(), bios_find_smbios3(), bzimage_load_initrds(), bzimage_parse_header(), cachedhcp_init(), cmdline_init(), com32_cfarcall(), com32_farcall(), com32_intcall(), com32_load_image(), efi_find_rsdt(), efi_find_smbios(), efi_urealloc(), efifb_init(), elf_load_segment(), imgmem_exec(), initrd_init(), int13_cdrom_read_boot_catalog(), int13_extended_rw(), int13_load_eltorito(), largest_memblock(), multiboot_add_modules(), multiboot_load_raw(), nbi_process_segments(), phys_to_virt(), pxenv_tftp_read_file(), real_to_user(), rsdp_find_rsdt(), rsdp_find_rsdt_range(), shuffle(), ucode_status(), vesafb_init(), and vram_fetch().
Convert user pointer to physical address.
userptr | User pointer |
offset | Offset from user pointer |
phys_addr | Physical address |
Referenced by acpi_find_via_rsdt(), acpi_zsdt(), arbel_alloc_icm(), arbel_start_firmware(), block_translate(), bzimage_check_initrds(), bzimage_load_initrd(), bzimage_load_initrds(), bzimage_parse_header(), bzimage_update_header(), cachedhcp_record(), ecollect_free(), efi_find_smbios(), efi_urealloc(), exanic_open(), exanic_probe_port(), fbcon_init(), find_smbios3_entry(), find_smbios_entry(), golan_provide_pages(), gve_alloc_qpl(), gve_alloc_queue(), gve_create_rx_param(), gve_create_tx_param(), gve_register(), hermon_map_icm(), hermon_start_firmware(), init_eheap(), initrd_dump(), initrd_reshuffle(), initrd_squash_high(), initrd_swap(), memtop_urealloc(), prep_segment(), register_image(), rsdp_find_rsdt_range(), sdi_exec(), srp_cmd(), txnic_create_cq(), txnic_create_rq(), txnic_create_sq(), txnic_poll_cq(), ucode_parse_amd(), ucode_parse_intel(), ucode_update_all(), virt_to_phys(), vmbus_establish_gpadl(), and xhci_scratchpad_alloc().
userptr_t virt_to_user | ( | volatile const void * | addr | ) |
Convert virtual address to user pointer.
addr | Virtual address |
userptr | User pointer |
Referenced by acpi_fix_checksum(), acpi_test_find(), asn1_okx(), atacmd_data_priv(), bofm_test(), cmdline_init(), cms_decrypt_okx(), cms_message_okx(), cms_verify_fail_okx(), cms_verify_okx(), com32_farcall(), com32_intcall(), copy_from_user(), copy_to_user(), deflate_inflate(), deflate_okx(), efi_block_rw(), efi_bofm_start(), efi_cachedhcp_record(), efi_cmdline_init(), efi_file_read_initrd(), efipci_dma_umalloc(), embedded_init(), gzip_okx(), int13_guess_geometry_hdd(), int13_parse_eltorito(), ipair_rx_pubkey(), peerdist_info_okx(), pixbuf_okx(), read(), sandev_parse_iso9660(), scsicmd_read_capacity_cmd(), virt_to_phys(), vmbus_open(), and zlib_okx().
Convert user pointer to virtual address.
userptr | User pointer |
offset | Offset from user pointer |
addr | Virtual address |
This operation is not available under all memory models.
Referenced by bzimage_check_initrds(), bzimage_load_initrd(), efi_image_exec(), efi_image_probe(), efipci_dma_ufree(), initrd_dump(), and phys_to_virt().
Add offset to user pointer.
userptr | User pointer |
offset | Offset |
userptr | New pointer value |
Referenced by bzimage_check_initrds(), bzimage_load_initrds(), ecollect_free(), gve_buffer(), gzip_extract(), init_eheap(), initrd_startup(), initrd_swap(), initrd_swap_any(), memtop_urealloc(), nbi_process_segments(), and sandev_rw().
Subtract user pointers.
userptr | User pointer |
subtrahend | User pointer to be subtracted |
offset | Offset |
Referenced by bzimage_load_initrds(), initrd_reshuffle(), initrd_reshuffle_check(), and initrd_squash_high().
|
inlinestatic |
Convert virtual address to a physical address.
addr | Virtual address |
phys_addr | Physical address |
Definition at line 361 of file uaccess.h.
References addr, user_to_phys(), and virt_to_user().
Referenced by alloc_iob_okx(), alloc_memblock(), arbel_alloc_icm(), arbel_cmd(), arbel_complete(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_poll_eq(), arbel_post_send(), arbel_ring_doorbell(), bios_mp_start_all(), com32_exec_loop(), dma(), efipci_dma_alloc(), ehci_bus_open(), ehci_ctrl_reachable(), ehci_endpoint_reset(), ehci_enqueue(), ehci_init(), ehci_link_qh(), ehci_ring_alloc(), ena_admin(), ena_create_admin(), ena_create_async(), ena_create_cq(), ena_create_sq(), ena_probe(), flexboot_nodnic_poll_cq(), fnrec_dump(), gdbmach_set_breakpoint(), gve_admin_alloc(), gve_alloc_shared(), hermon_alloc_mtt(), hermon_cmd(), hermon_complete(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_poll_cq(), hermon_poll_eq(), hermon_post_send(), hide_etherboot(), hide_textdata(), hide_umalloc(), hv_map_hypercall(), hv_map_synic(), hvm_ioremap(), hvm_iounmap(), hvm_map_grant(), hvm_map_hypercall(), hvm_map_shared_info(), icplus_transmit(), init_idt(), intel_create_ring(), intel_refill_rx(), intel_transmit(), intelxl_admin_command(), intelxl_alloc_admin(), intelxl_alloc_ring(), intelxl_msix_enable(), intelxl_poll_admin(), intelxl_refill_rx(), intelxl_transmit(), intelxlvf_admin_event(), iob_map(), IOMAP_INLINE(), mp_address(), multiboot_add_cmdline(), multiboot_exec(), nbi_boot32(), netfront_create_ring(), netfront_poll_rx(), netfront_refill_rx(), netfront_transmit(), pxe_start_nbp(), rdc_create_ring(), rdc_refill_rx(), realtek_create_buffer(), realtek_create_ring(), realtek_refill_rx(), realtek_transmit(), relocate(), ucode_update_all(), uhci_bus_open(), uhci_describe(), uhci_endpoint_poll(), uhci_enqueue(), uhci_link_qh(), uhci_reachable(), uhci_restart(), virt_to_bus(), vmbus_initiate_contact(), vmbus_open(), vmbus_send_data(), vring_init(), xen_hvm_get_param(), xhci_command_alloc(), xhci_dcbaa_alloc(), xhci_device_open(), xhci_endpoint_open(), xhci_event_alloc(), xhci_event_poll(), xhci_init(), xhci_ring_consumed(), and xhci_scratchpad_alloc().
|
inlinestatic |
Convert physical address to a virtual address.
addr | Virtual address |
phys_addr | Physical address |
This operation is not available under all memory models.
Definition at line 373 of file uaccess.h.
References phys_to_user(), and user_to_virt().
Referenced by bus_to_virt(), efipci_dma_map(), fnrec_init(), interrupt_dump(), myri10ge_net_open(), video_init(), and vring_init().
Copy data between user buffers.
dest | Destination |
dest_off | Destination offset |
src | Source |
src_off | Source offset |
len | Length |
Referenced by bzimage_exec(), com32_farcall(), com32_intcall(), com32_load_image(), comboot_prepare_segment(), copy_from_user(), copy_to_user(), copy_user_to_rm_stack(), deflate_copy(), efi_urealloc(), elf_load_segment(), fbcon_draw(), fbcon_init(), image_set_data(), initrd_squash_high(), initrd_swap(), int22(), multiboot_add_modules(), multiboot_load_raw(), nbi_load_segment(), pxe_exec(), remove_user_from_rm_stack(), and sdi_exec().
|
inlinestatic |
Copy data to user buffer.
dest | Destination |
dest_off | Destination offset |
src | Source |
len | Length |
Definition at line 398 of file uaccess.h.
References dest, dest_off, len, memcpy_user(), src, and virt_to_user().
Referenced by aoecmd_ata_rsp(), blktrans_xferbuf_write(), bofm(), bzimage_load_initrd(), bzimage_set_cmdline(), bzimage_update_header(), cms_decrypt(), comboot_copy_cmdline(), comboot_init_psp(), copy_to_real(), efi_urealloc(), efifb_draw(), fbcon_clear(), fbcon_draw(), fbcon_picture_init(), fbcon_store(), fcpcmd_recv_rddata(), gve_alloc_queue(), gve_transmit(), iscsi_rx_data_in(), memtop_urealloc(), png_pixels_pass(), png_unfilter_pass(), pnm_data(), pxe_api_call(), pxe_loader_call(), pxe_tftp_xfer_deliver(), pxenv_file_cmdline(), pxenv_get_cached_info(), pxenv_udp_read(), read_user(), txnic_refill_rq(), txnic_send(), usbblk_in_data(), and xferbuf_umalloc_write().
|
inlinestatic |
Copy data from user buffer.
dest | Destination |
src | Source |
src_off | Source offset |
len | Length |
Definition at line 411 of file uaccess.h.
References dest, len, memcpy_user(), src, src_off, and virt_to_user().
Referenced by acpi_extract(), acpi_extract_sx(), acpi_find_via_rsdt(), acpi_poweroff(), acpi_settings_fetch(), acpi_timer_probe(), acpi_zsdt(), acpimac_extract(), aoecmd_ata_cmd(), blktrans_xferbuf_read(), bofm(), bofm_locate_section(), bzimage_parse_header(), cachedhcp_record(), cmdline_init(), cms_decrypt(), cms_digest(), com32_identify(), copy_from_real(), deflate_accumulate(), der_asn1(), der_probe(), digest_exec(), ecam_find(), ecollect_free(), efi_file_read_chunk(), efi_pe_image_probe(), efi_urealloc(), efifb_glyph(), elf_load(), elf_segments(), elfboot_probe(), exanic_poll_rx(), fbcon_draw_cursor(), fbcon_picture_init(), fbcon_redraw(), fcpcmd_send_wrdata(), find_smbios3_entry(), find_smbios_entry(), find_smbios_structure(), find_strings_terminator(), gve_poll_rx(), gzip_extract(), gzip_probe(), int13_load_eltorito(), int22(), iscsi_tx_data_out(), memtop_urealloc(), multiboot_find_header(), nbi_exec(), nbi_probe(), nbi_process_segments(), netvsc_buffer_copy(), peerdist_info_get(), pem_asn1(), pem_marker(), png_image_header(), png_palette(), png_pixbuf(), png_pixels_pass(), png_probe(), png_unfilter_pass(), pnm_ascii(), pnm_binary(), pnm_probe(), pnm_type(), print_user_string(), process_script(), pxe_api_call(), pxe_loader_call(), pxe_probe_no_mz(), pxenv_file_exec(), pxenv_file_open(), pxenv_udp_write(), read_smbios_string(), read_smbios_structure(), rsdp_find_rsdt_range(), script_probe(), sdi_parse_header(), shuffle(), smbios_checksum(), txnic_poll_cq(), typeof(), ucode_parse_amd(), ucode_parse_intel(), ucode_probe(), ucode_status(), ucode_verify(), usbblk_out_data(), vesafb_mode_list(), vram_fetch(), xferbuf_umalloc_read(), and zlib_probe().
Copy data between user buffers, allowing for overlap.
dest | Destination |
dest_off | Destination offset |
src | Source |
src_off | Source offset |
len | Length |
Referenced by bzimage_load_initrd(), fbcon_scroll(), initrd_squash_high(), initrd_swap(), memtop_urealloc(), and shuffle().
int memcmp_user | ( | userptr_t | first, |
off_t | first_off, | ||
userptr_t | second, | ||
off_t | second_off, | ||
size_t | len | ||
) |
Compare data between user buffers.
first | First buffer |
first_off | First buffer offset |
second | Second buffer |
second_off | Second buffer offset |
len | Length |
diff | Difference |
Referenced by cms_decrypt_okx(), gzip_okx(), pixbuf_okx(), and zlib_okx().
Fill user buffer with a constant byte.
userptr | User buffer |
offset | Offset within buffer |
c | Constant byte with which to fill |
len | Length |
Referenced by bzimage_load_initrd(), comboot_prepare_segment(), efifb_draw(), efifb_glyphs(), exanic_open(), fbcon_draw(), fbcon_init(), fbcon_picture_init(), gve_start(), prep_segment(), shuffle(), ucode_update_all(), and xhci_scratchpad_alloc().
Find length of NUL-terminated string in user buffer.
userptr | User buffer |
offset | Offset within buffer |
len | Length of string (excluding NUL) |
Referenced by cmdline_init(), int22(), pxenv_file_exec(), pxenv_file_open(), and read_smbios_string().
Find character in user buffer.
userptr | User buffer |
offset | Starting offset within buffer |
c | Character to search for |
len | Length of user buffer |
offset | Offset of character, or <0 if not found |
Referenced by gzip_extract(), pem_next(), and process_script().
__always_inline off_t off_t offset |
Definition at line 231 of file uaccess.h.
Referenced by trivial_memchr_user(), trivial_memset_user(), trivial_strlen_user(), trivial_user_to_virt(), and trivial_userptr_add().
__always_inline off_t userptr_t subtrahend |
Definition at line 252 of file uaccess.h.
Referenced by trivial_userptr_sub().
__always_inline void off_t dest_off |
Definition at line 257 of file uaccess.h.
Referenced by copy_to_user(), trivial_memcpy_user(), and trivial_memmove_user().
__always_inline void off_t userptr_t src |
Definition at line 257 of file uaccess.h.
Referenced by copy_from_user(), copy_to_user(), trivial_memcpy_user(), and trivial_memmove_user().
__always_inline void off_t userptr_t off_t src_off |
Definition at line 257 of file uaccess.h.
Referenced by copy_from_user(), trivial_memcpy_user(), and trivial_memmove_user().
__always_inline off_t off_t int size_t len |
Definition at line 259 of file uaccess.h.
Referenced by copy_from_user(), copy_to_user(), trivial_memchr_user(), trivial_memcmp_user(), trivial_memcpy_user(), trivial_memmove_user(), and trivial_memset_user().
__always_inline int off_t first_off |
Definition at line 271 of file uaccess.h.
Referenced by trivial_memcmp_user().
__always_inline int off_t userptr_t second |
Definition at line 271 of file uaccess.h.
Referenced by trivial_memcmp_user().
__always_inline int off_t userptr_t off_t second_off |
Definition at line 271 of file uaccess.h.
Referenced by trivial_memcmp_user().
__always_inline off_t off_t int c |
Definition at line 278 of file uaccess.h.
Referenced by trivial_memchr_user(), and trivial_memset_user().