iPXE
string.h File Reference

Optimised string operations. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void * __memcpy (void *dest, const void *src, size_t len)
void * __memcpy_reverse (void *dest, const void *src, size_t len)
static __attribute__ ((always_inline)) void *__constant_memcpy(void *dest
 Copy memory area (where length is a compile-time constant)
union { 
   uint32_t   u32 [2] 
   uint16_t   u16 [4] 
   uint8_t   u8 [8] 
__attribute__ ((__may_alias__)) *src_u
 switch (len)
 if (len >=26) return __memcpy(dest
 if (__builtin_constant_p(offset))
__asm__ __volatile__ ("rep stosb" :"=&D"(discard_D), "=&c"(discard_c) :"0"(dest), "1"(len), "a"(fill) :"memory")

Variables

static const void * src
static const void size_t len
const void * esi = src
void * edi = dest
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest )
 else
static int fill
size_t discard_c
uint32_t eax = 0

Detailed Description

Optimised string operations.

Definition in file string.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ __memcpy()

void * __memcpy ( void * dest,
const void * src,
size_t len )
extern

References dest, len, and src.

Referenced by __memmove().

◆ __memcpy_reverse()

void * __memcpy_reverse ( void * dest,
const void * src,
size_t len )
extern

References dest, len, and src.

Referenced by __memmove(), and if().

◆ __attribute__() [1/2]

__attribute__ ( (always_inline) )
inlinestatic

Copy memory area (where length is a compile-time constant)

Fill memory region with zero (where length is a compile-time constant)

Fill memory region.

Copy (possibly overlapping) memory area.

Copy memory area.

Parameters
destDestination address
srcSource address
lenLength
Return values
destDestination address
Parameters
destDestination address
fillFill pattern
lenLength
Return values
destDestination address
Parameters
destDestination address
lenLength
Return values
destDestination address

◆ __attribute__() [2/2]

const union @164170075364345007147034376162107362241367277267 __attribute__ ( (__may_alias__) )

References __attribute__, dest, len, src, u16, u32, and u8.

◆ switch()

switch ( len )

Definition at line 62 of file string.h.

62 {
63 case 0 : /* 0 bytes */
64 return dest;
65 /*
66 * Single-register moves; these are always better than a
67 * string operation. We can clobber an arbitrary two
68 * registers (data, source, dest can re-use source register)
69 * instead of being restricted to esi and edi. There's also a
70 * much greater potential for optimising with nearby code.
71 *
72 */
73 case 1 : /* 4 bytes */
74 dest_u->u8[0] = src_u->u8[0];
75 return dest;
76 case 2 : /* 6 bytes */
77 dest_u->u16[0] = src_u->u16[0];
78 return dest;
79 case 4 : /* 4 bytes */
80 dest_u->u32[0] = src_u->u32[0];
81 return dest;
82 /*
83 * Double-register moves; these are probably still a win.
84 *
85 */
86 case 3 : /* 12 bytes */
87 dest_u->u16[0] = src_u->u16[0];
88 dest_u->u8[2] = src_u->u8[2];
89 return dest;
90 case 5 : /* 10 bytes */
91 dest_u->u32[0] = src_u->u32[0];
92 dest_u->u8[4] = src_u->u8[4];
93 return dest;
94 case 6 : /* 12 bytes */
95 dest_u->u32[0] = src_u->u32[0];
96 dest_u->u16[2] = src_u->u16[2];
97 return dest;
98 case 8 : /* 10 bytes */
99 dest_u->u32[0] = src_u->u32[0];
100 dest_u->u32[1] = src_u->u32[1];
101 return dest;
102 }
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
Definition string.h:151

References dest, and len.

Referenced by dns_xfer_deliver().

◆ if() [1/2]

if ( len >= 26)

References __asm__(), dest, edi, esi, len, and src.

◆ if() [2/2]

if ( __builtin_constant_p(offset) )

Definition at line 189 of file string.h.

189 {
190 if ( offset <= 0 ) {
191 return memcpy ( dest, src, len );
192 } else {
193 return __memcpy_reverse ( dest, src, len );
194 }
195 } else {
void * __memcpy_reverse(void *dest, const void *src, size_t len)
static const void * src
Definition string.h:48
uint16_t offset
Offset to command line.
Definition bzimage.h:3
ring len
Length.
Definition dwmac.h:226
void * memcpy(void *dest, const void *src, size_t len) __nonnull

References __memcpy_reverse(), dest, len, memcpy(), offset, and src.

◆ __volatile__()

__asm__ __volatile__ ( )

References __asm__(), dest, discard_c, discard_D, fill, and len.

Variable Documentation

◆ src

const void * src

Definition at line 48 of file string.h.

Referenced by __attribute__(), __attribute__(), __memcpy(), __memcpy_reverse(), __memmove(), acpi_settings_fetch(), aes_decrypt(), aes_encrypt(), aes_unwrap(), aes_wrap(), arc4_skip(), arc4_xor(), bnxt_add_vlan(), bnxt_get_pkt_vlan(), cbc_decrypt(), cbc_encrypt(), cbc_xor(), ccmp_ctr_xor(), cipher_cost(), cipher_decrypt(), cipher_encrypt(), cipher_null_decrypt(), cipher_null_decrypt(), cipher_null_encrypt(), cipher_null_encrypt(), copy_to_real(), copy_to_real_libkir(), crc32_le(), create_pinger(), des_decrypt(), des_encrypt(), dhcpv6_rx(), digest_null_update(), digest_null_update(), dns_copy(), ecb_decrypt(), ecb_encrypt(), efi_paths(), efi_pxe_udp_write(), efi_undi_fill_header(), efi_undi_receive(), ena_transmit(), eth_pio_read(), eth_pio_read(), eth_pio_write(), eth_pio_write(), exanic_transmit(), fbcon_draw(), fc_els_rx(), fc_xchg_rx(), FILE_SECBOOT(), gcc_implicit_memcpy(), gcm_decrypt(), gcm_encrypt(), gcm_process(), gcm_xor_block(), gdbstub_from_hex_buf(), gdbstub_to_hex_buf(), generic_memcpy(), generic_memcpy_reverse(), generic_memmove(), hv_wait_for_message(), ib_mcast_complete(), if(), if(), ipv4_route_okx(), ipv4_rx(), ipv6_route_okx(), ipv6_rx(), ipv6_tx(), memchr(), memcpy(), memcpy_0(), memcpy_1(), memcpy_10(), memcpy_11(), memcpy_12(), memcpy_13(), memcpy_14(), memcpy_15(), memcpy_16(), memcpy_17(), memcpy_18(), memcpy_19(), memcpy_2(), memcpy_20(), memcpy_21(), memcpy_22(), memcpy_23(), memcpy_24(), memcpy_25(), memcpy_26(), memcpy_27(), memcpy_28(), memcpy_29(), memcpy_3(), memcpy_30(), memcpy_31(), memcpy_4(), memcpy_5(), memcpy_6(), memcpy_7(), memcpy_8(), memcpy_9(), memcpy_test_speed(), memcpy_var(), memmove(), mschapv2_expand_hash(), nii_sync(), shuffle(), smbios_fetch(), stpcpy(), strcat(), strchr(), strcpy(), strdup(), string_copy(), string_test_exec(), strlen(), strncpy(), strndup(), strnlen(), strrchr(), udp_tx(), uri_copy_fields(), and usb_settings_fetch().

◆ len

len
Initial value:
{
union {
uint8_t u8[8];
} __attribute__ (( __may_alias__ )) *dest_u = dest
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
#define u8
Definition igbvf_osdep.h:40
#define __attribute__(x)
Definition compiler.h:10
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21

Definition at line 48 of file string.h.

48 {
49 union {
50 uint32_t u32[2];
51 uint16_t u16[4];
52 uint8_t u8[8];
53 } __attribute__ (( __may_alias__ )) *dest_u = dest;

◆ u32

Definition at line 55 of file string.h.

◆ u16

Definition at line 56 of file string.h.

◆ u8

uint8_t u8[8]

Definition at line 57 of file string.h.

◆ esi

esi = src

Definition at line 59 of file string.h.

Referenced by __attribute__(), and if().

◆ edi

void * edi = dest

Definition at line 60 of file string.h.

Referenced by __attribute__(), and if().

◆ dest

return dest

Definition at line 155 of file string.h.

Referenced by __attribute__(), __attribute__(), __attribute__(), __memcpy(), __memcpy_reverse(), __memmove(), __volatile__(), __volatile__(), __volatile__(), a3c90x_internal_ReadEeprom(), acpi_describe(), aes_unwrap(), aes_wrap(), arbel_fill_mlx_send_wqe(), arbel_fill_rc_send_wqe(), arbel_fill_ud_send_wqe(), arbel_post_send(), ata_command(), bigint_copy_sample(), bigint_grow_sample(), bigint_shrink_sample(), block_capacity(), block_read(), block_read_capacity(), block_write(), bzimage_check_initrds(), ccmp_ctr_xor(), copy_encap_settings(), copy_from_real(), copy_from_real_libkir(), copy_settings(), dmfe_transmit(), edd_describe(), efi_describe(), efi_pxe_udp_write(), efi_undi_fill_header(), efi_undi_receive(), elf_load_segment(), elf_segment(), elf_segments(), elfboot_check_segment(), ena_transmit(), eoib_complete_recv(), eth_transmit(), fc_els_rx(), fc_els_tx(), fc_xchg_rx(), fc_xchg_tx(), FILE_SECBOOT(), flexboot_nodnic_eth_complete_recv(), gcc_implicit_memcpy(), gcc_implicit_memset(), generic_memcpy(), generic_memcpy_reverse(), generic_memmove(), generic_memset(), hermon_eth_complete_recv(), hermon_fill_eth_send_wqe(), hermon_fill_mlx_send_wqe(), hermon_fill_nop_send_wqe(), hermon_fill_rc_send_wqe(), hermon_fill_ud_send_wqe(), hermon_post_send(), ib_cmrc_complete_recv(), ib_complete_recv(), ib_mi_complete_recv(), ib_post_send(), ib_pull(), ib_push(), ibft_alloc_string(), ibft_set_string(), ibft_set_string_setting(), identify_device(), if(), if(), inet6_ntoa(), initrd_load_all(), intf_close(), intf_get_dest_op_no_passthru_untyped(), intf_get_dest_op_untyped(), intf_insert(), intf_plug(), intf_poke(), ipoib_complete_recv(), ipoib_transmit(), ipv4_netdev(), ipv4_route(), ipv4_route_okx(), ipv4_rx(), ipv6_netdev(), ipv6_route(), ipv6_route_okx(), ipv6_rx(), job_progress(), linda_complete_recv(), linda_post_send(), lkrn_exec(), memcpy(), memcpy_0(), memcpy_1(), memcpy_10(), memcpy_11(), memcpy_12(), memcpy_13(), memcpy_14(), memcpy_15(), memcpy_16(), memcpy_17(), memcpy_18(), memcpy_19(), memcpy_2(), memcpy_20(), memcpy_21(), memcpy_22(), memcpy_23(), memcpy_24(), memcpy_25(), memcpy_26(), memcpy_27(), memcpy_28(), memcpy_29(), memcpy_3(), memcpy_30(), memcpy_31(), memcpy_4(), memcpy_5(), memcpy_6(), memcpy_7(), memcpy_8(), memcpy_9(), memcpy_test_speed(), memcpy_var(), memmove(), memset(), memset_var(), memset_zero_0(), memset_zero_1(), memset_zero_10(), memset_zero_11(), memset_zero_12(), memset_zero_13(), memset_zero_14(), memset_zero_15(), memset_zero_16(), memset_zero_17(), memset_zero_18(), memset_zero_19(), memset_zero_2(), memset_zero_20(), memset_zero_21(), memset_zero_22(), memset_zero_23(), memset_zero_24(), memset_zero_25(), memset_zero_26(), memset_zero_27(), memset_zero_28(), memset_zero_29(), memset_zero_3(), memset_zero_30(), memset_zero_31(), memset_zero_4(), memset_zero_5(), memset_zero_6(), memset_zero_7(), memset_zero_8(), memset_zero_9(), nbi_load_segment(), nbi_prepare_segment(), nbi_process_segments(), net80211_tx_mgmt(), peerdisc_stat(), pxenv_udp_write(), qib7322_complete_recv(), qib7322_post_send(), resize_dhcp_option(), resolv_done(), scsi_command(), scsi_response(), shuffle(), stpcpy(), strcat(), strcpy(), string_copy(), string_test_exec(), strncpy(), switch(), tcp_process_tx_queue(), tls_cipherstream_deliver(), udp_tx(), uri_copy_fields(), weierstrass_exec(), xfer_alloc_iob(), xfer_buffer(), xfer_deliver(), xfer_vredirect(), xfer_window(), xhci_enqueue(), and xsigo_xds_complete().

◆ else

else
Initial value:
{
return __memmove ( dest, src, len )
void * __memmove(void *dest, const void *src, size_t len)
Copy (possibly overlapping) memory area.
Definition x86_string.c:118

Definition at line 195 of file string.h.

◆ fill

◆ discard_c

size_t discard_c

Definition at line 211 of file string.h.

◆ eax

eax = 0

Definition at line 235 of file string.h.

Referenced by com32_cfarcall().