Changeset 8a5a902 in mainline for kernel/arch/ia32/src/asm.S
- Timestamp:
- 2013-03-29T16:26:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ca441c
- Parents:
- 2d1195c0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r2d1195c0 r8a5a902 38 38 .global paging_on 39 39 .global enable_l_apic_in_msr 40 .global memset 41 .global memcpy 40 42 .global memcpy_from_uspace 41 43 .global memcpy_from_uspace_failover_address … … 44 46 .global early_putchar 45 47 48 #define MEMSET_DST 4 49 #define MEMSET_VAL 8 50 #define MEMSET_SIZE 12 51 46 52 #define MEMCPY_DST 4 47 53 #define MEMCPY_SRC 8 48 54 #define MEMCPY_SIZE 12 55 56 /* Fill memory with byte pattern 57 * 58 * This is a conventional memset(). 59 * 60 * @param MEMSET_DST(%esp) Destination address. 61 * @param MEMSET_VAL(%esp) Value to fill. 62 * @param MEMSET_SIZE(%esp) Size. 63 * 64 * @return MEMSET_DST(%esp). 65 * 66 */ 67 memset: 68 movl %edi, %edx /* save %edi */ 69 70 movl MEMSET_DST(%esp), %edi 71 movl MEMSET_VAL(%esp), %ecx 72 73 /* Create byte pattern */ 74 movb %cl, %ch 75 movw %cx, %ax 76 shll $16, %eax 77 orw %cx, %ax 78 79 movl MEMSET_SIZE(%esp), %ecx 80 shrl $2, %ecx /* size / 4 */ 81 82 /* Write whole words */ 83 rep stosl 84 85 movl MEMSET_SIZE(%esp), %ecx 86 andl $3, %ecx /* size % 4 */ 87 jz 0f 88 89 /* Copy the rest byte by byte */ 90 rep stosb 91 92 0: 93 94 movl %edx, %edi 95 96 /* MEMSET_DST(%esp), success */ 97 movl MEMSET_DST(%esp), %eax 98 ret 49 99 50 100 /** Copy memory to/from userspace. … … 63 113 * 64 114 */ 115 memcpy: 65 116 memcpy_from_uspace: 66 117 memcpy_to_uspace:
Note:
See TracChangeset
for help on using the changeset viewer.