Changeset 45f7449 in mainline for kernel/arch/amd64/src/asm.S
- Timestamp:
- 2013-03-31T19:46:19Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5057cc
- Parents:
- 582f4d28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/asm.S
r582f4d28 r45f7449 37 37 .global read_efer_flag 38 38 .global set_efer_flag 39 .global memset40 .global memcpy41 39 .global memcpy_from_uspace 42 40 .global memcpy_to_uspace … … 45 43 .global early_putchar 46 44 47 #define MEMSET_DST %rdi48 #define MEMSET_VAL %rsi49 #define MEMSET_SIZE %rdx50 51 45 #define MEMCPY_DST %rdi 52 46 #define MEMCPY_SRC %rsi 53 47 #define MEMCPY_SIZE %rdx 54 48 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. 90 51 * 91 52 * This is almost conventional memcpy(). … … 102 63 * 103 64 */ 104 memcpy:105 65 memcpy_from_uspace: 106 66 memcpy_to_uspace:
Note:
See TracChangeset
for help on using the changeset viewer.