iPXE
Functions
x86_string.c File Reference

Optimised string operations. More...

#include <string.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
void * __attribute__ ((noinline))
 Copy memory area. More...
 
void * __memmove (void *dest, const void *src, size_t len)
 Copy (possibly overlapping) memory area. More...
 

Detailed Description

Optimised string operations.

Definition in file x86_string.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

void* __attribute__ ( (noinline)  )

Copy memory area.

Copy memory area backwards.

Parameters
destDestination address
srcSource address
lenLength
Return values
destDestination address

Definition at line 42 of file x86_string.c.

43  {
44  void *edi = dest;
45  const void *esi = src;
46  int discard_ecx;
47 
48  /* We often do large dword-aligned and dword-length block
49  * moves. Using movsl rather than movsb speeds these up by
50  * around 32%.
51  */
52  __asm__ __volatile__ ( "rep movsl"
53  : "=&D" ( edi ), "=&S" ( esi ),
54  "=&c" ( discard_ecx )
55  : "0" ( edi ), "1" ( esi ), "2" ( len >> 2 )
56  : "memory" );
57  __asm__ __volatile__ ( "rep movsb"
58  : "=&D" ( edi ), "=&S" ( esi ),
59  "=&c" ( discard_ecx )
60  : "0" ( edi ), "1" ( esi ), "2" ( len & 3 )
61  : "memory" );
62  return dest;
63 }
const void * esi
Definition: string.h:58
static void * dest
Definition: strings.h:176
static __always_inline void off_t userptr_t src
Definition: efi_uaccess.h:66
uint32_t discard_ecx
Definition: hyperv.h:31
void * edi
Definition: string.h:59
__asm__ __volatile__("\n1:\n\t" "movb -1(%2,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %3, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
uint32_t len
Length.
Definition: ena.h:14

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

◆ __memmove()

void* __memmove ( void *  dest,
const void *  src,
size_t  len 
)

Copy (possibly overlapping) memory area.

Parameters
destDestination address
srcSource address
lenLength
Return values
destDestination address

Definition at line 103 of file x86_string.c.

103  {
104 
105  if ( dest <= src ) {
106  return __memcpy ( dest, src, len );
107  } else {
108  return __memcpy_reverse ( dest, src, len );
109  }
110 }
void * __memcpy_reverse(void *dest, const void *src, size_t len)
static void * dest
Definition: strings.h:176
static __always_inline void off_t userptr_t src
Definition: efi_uaccess.h:66
uint32_t len
Length.
Definition: ena.h:14
void * __memcpy(void *dest, const void *src, size_t len)

References __memcpy(), __memcpy_reverse(), dest, len, and src.