Changeset 45f7449 in mainline for kernel/arch/amd64/src/asm.S


Ignore:
Timestamp:
2013-03-31T19:46:19Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a5057cc
Parents:
582f4d28
Message:

Revert to the state of mainline,1783.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/asm.S

    r582f4d28 r45f7449  
    3737.global read_efer_flag
    3838.global set_efer_flag
    39 .global memset
    40 .global memcpy
    4139.global memcpy_from_uspace
    4240.global memcpy_to_uspace
     
    4543.global early_putchar
    4644
    47 #define MEMSET_DST   %rdi
    48 #define MEMSET_VAL   %rsi
    49 #define MEMSET_SIZE  %rdx
    50 
    5145#define MEMCPY_DST   %rdi
    5246#define MEMCPY_SRC   %rsi
    5347#define MEMCPY_SIZE  %rdx
    5448
    55 /* Fill memory with byte pattern
    56  *
    57  * This is a conventional memset().
    58  *
    59  * @param MEMSET_DST  Destination address.
    60  * @param MEMSET_VAL  Value to fill.
    61  * @param MEMSET_SIZE Size.
    62  *
    63  * @return MEMSET_DST.
    64  *
    65  */
    66 memset:
    67         movq MEMSET_DST, %r8    /* save %rdi */
    68        
    69         /* Create byte pattern */
    70         movzbl %sil, %esi       /* MEMSET_VAL */
    71         movabs $0x0101010101010101, %rax
    72         imulq %rsi, %rax
    73        
    74         movq MEMSET_SIZE, %rcx
    75         shrq $3, %rcx           /* size / 8 */
    76        
    77         rep stosq               /* store as much as possible word by word */
    78        
    79         movq MEMSET_SIZE, %rcx
    80         andq $7, %rcx           /* size % 8 */
    81         jz 0f
    82        
    83         rep stosb               /* store the rest byte by byte */
    84        
    85         0:
    86                 movq %r8, %rax
    87                 ret                 /* return MEMCPY_SRC, success */
    88 
    89 /** Copy memory from/to userspace.
     49/**
     50 * Copy memory from/to userspace.
    9051 *
    9152 * This is almost conventional memcpy().
     
    10263 *
    10364 */
    104 memcpy:
    10565memcpy_from_uspace:
    10666memcpy_to_uspace:
Note: See TracChangeset for help on using the changeset viewer.