Changeset e3c762cd in mainline for arch/ia32/src/asm.S
- Timestamp:
- 2006-05-05T11:59:19Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- de07bcf
- Parents:
- 22cf454d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/asm.S
r22cf454d re3c762cd 38 38 .global enable_l_apic_in_msr 39 39 .global interrupt_handlers 40 .global memcpy 41 .global memcpy_from_uspace 42 .global memcpy_from_uspace_failover_address 43 .global memcpy_to_uspace 44 .global memcpy_to_uspace_failover_address 45 46 47 #define MEMCPY_DST 4 48 #define MEMCPY_SRC 8 49 #define MEMCPY_SIZE 12 50 51 /** Copy memory to/from userspace. 52 * 53 * This is almost conventional memcpy(). 54 * The difference is that there is a failover part 55 * to where control is returned from a page fault 56 * if the page fault occurs during copy_from_uspace() 57 * or copy_to_uspace(). 58 * 59 * @param MEMCPY_DST(%esp) Destination address. 60 * @param MEMCPY_SRC(%esp) Source address. 61 * @param MEMCPY_SIZE(%esp) Size. 62 * 63 * @return MEMCPY_SRC(%esp) on success and 0 on failure. 64 */ 65 memcpy: 66 memcpy_from_uspace: 67 memcpy_to_uspace: 68 movl %edi, %edx /* save %edi */ 69 movl %esi, %eax /* save %esi */ 70 71 movl MEMCPY_SIZE(%esp), %ecx 72 shrl $2, %ecx /* size / 4 */ 73 74 movl MEMCPY_DST(%esp), %edi 75 movl MEMCPY_SRC(%esp), %esi 76 77 rep movsl /* copy as much as possible word by word */ 78 79 movl MEMCPY_SIZE(%esp), %ecx 80 andl $3, %ecx /* size % 4 */ 81 jz 0f 82 83 rep movsb /* copy the rest byte by byte */ 84 85 0: 86 movl %edx, %edi 87 movl %eax, %esi 88 movl MEMCPY_SRC(%esp), %eax /* MEMCPY_SRC(%esp), success */ 89 ret 90 91 /* 92 * We got here from as_page_fault() after the memory operations 93 * above had caused a page fault. 94 */ 95 memcpy_from_uspace_failover_address: 96 memcpy_to_uspace_failover_address: 97 movl %edx, %edi 98 movl %eax, %esi 99 xorl %eax, %eax /* return 0, failure */ 100 ret 40 101 41 102 ## Turn paging on
Note:
See TracChangeset
for help on using the changeset viewer.