Rev 1288 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1288 | Rev 1295 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | 30 | ||
31 | .text |
31 | .text |
32 | 32 | ||
33 | /** Copy memory from/to userspace. |
33 | /** Copy memory from/to userspace. |
34 | * |
34 | * |
- | 35 | * This memcpy() has been taken from the assembler output of |
|
- | 36 | * the generic _memcpy() and modified to have the failover part. |
|
- | 37 | * |
|
35 | * @param in0 Destination address. |
38 | * @param in0 Destination address. |
36 | * @param in1 Source address. |
39 | * @param in1 Source address. |
37 | * @param in2 Number of byte to copy. |
40 | * @param in2 Number of byte to copy. |
38 | */ |
41 | */ |
39 | .global memcpy |
42 | .global memcpy |
Line 42... | Line 45... | ||
42 | .global memcpy_from_uspace_failover_address |
45 | .global memcpy_from_uspace_failover_address |
43 | .global memcpy_to_uspace_failover_address |
46 | .global memcpy_to_uspace_failover_address |
44 | memcpy: |
47 | memcpy: |
45 | memcpy_from_uspace: |
48 | memcpy_from_uspace: |
46 | memcpy_to_uspace: |
49 | memcpy_to_uspace: |
- | 50 | alloc loc0 = ar.pfs, 3, 1, 0, 0 |
|
- | 51 | ||
- | 52 | shr.u r18 = in2, 3 |
|
- | 53 | mov r8 = in1 ;; /* prepare to return in1 on success */ |
|
- | 54 | cmp.ne p6, p7 = 0, r18 ;; |
|
- | 55 | (p7) mov r17 = r0 |
|
- | 56 | (p7) br.cond.dptk 1f ;; |
|
47 | br _memcpy |
57 | mov r16 = r0 |
- | 58 | mov r17 = r0 ;; |
|
- | 59 | ||
- | 60 | 0: |
|
- | 61 | shladd r14 = r17, 3, r0 |
|
- | 62 | adds r16 = 1, r16 ;; |
|
- | 63 | add r15 = r14, r8 |
|
- | 64 | sxt4 r17 = r16 |
|
- | 65 | add r14 = r14, in0 ;; |
|
- | 66 | ld8 r15 = [r15] |
|
- | 67 | cmp.gtu p6, p7 = r18, r17 ;; |
|
- | 68 | st8 [r14] = r15 |
|
- | 69 | (p6) br.cond.dptk 0b |
|
- | 70 | ||
- | 71 | 1: |
|
- | 72 | and in2 = 7, in2 ;; |
|
- | 73 | cmp.eq p6, p7 = 0, in2 ;; |
|
- | 74 | (p6) mov ar.pfs = loc0 |
|
- | 75 | (p6) br.ret.dptk.many rp |
|
- | 76 | shladd r14 = r17, 3, r0 |
|
- | 77 | mov r16 = r0 |
|
- | 78 | mov r17 = r0 ;; |
|
- | 79 | add in0 = in0, r14 |
|
- | 80 | add r18 = r8, r14 ;; |
|
- | 81 | ||
- | 82 | 2: |
|
- | 83 | add r14 = r16, r18 |
|
- | 84 | adds r17 = 1, r17 |
|
- | 85 | add r15 = in0, r16 ;; |
|
- | 86 | ld1 r14 = [r14] |
|
- | 87 | sxt4 r16 = r17 ;; |
|
- | 88 | st1 [r15] = r14 |
|
- | 89 | cmp.gtu p6, p7 = in2, r16 |
|
- | 90 | (p6) br.cond.dptk 2b |
|
- | 91 | ||
- | 92 | mov ar.pfs = loc0 |
|
- | 93 | br.ret.sptk.many rp |
|
48 | 94 | ||
49 | memcpy_from_uspace_failover_address: |
95 | memcpy_from_uspace_failover_address: |
50 | memcpy_to_uspace_failover_address: |
96 | memcpy_to_uspace_failover_address: |
51 | br memcpy_from_uspace_failover_address |
97 | mov r8 = r0 /* return 0 on failure */ |
- | 98 | mov ar.pfs = loc0 |
|
- | 99 | br.ret.sptk.many rp |
|
52 | 100 | ||
53 | .global memsetb |
101 | .global memsetb |
54 | memsetb: |
102 | memsetb: |
55 | br _memsetb |
103 | br _memsetb |
56 | 104 |