Rev 393 | Rev 501 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 393 | Rev 419 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | * @param cnt Number of bytes |
41 | * @param cnt Number of bytes |
42 | * @return Destination |
42 | * @return Destination |
43 | */ |
43 | */ |
44 | static inline void * memcpy(void * dst, const void * src, size_t cnt) |
44 | static inline void * memcpy(void * dst, const void * src, size_t cnt) |
45 | { |
45 | { |
46 | __u32 d0, d1, d2; |
46 | __native d0, d1, d2; |
47 | 47 | ||
48 | __asm__ __volatile__( |
48 | __asm__ __volatile__( |
49 | /* copy all full dwords */ |
49 | /* copy all full dwords */ |
50 | "rep movsl\n\t" |
50 | "rep movsl\n\t" |
51 | /* load count again */ |
51 | /* load count again */ |
Line 57... | Line 57... | ||
57 | /* copy last <=3 bytes */ |
57 | /* copy last <=3 bytes */ |
58 | "rep movsb\n\t" |
58 | "rep movsb\n\t" |
59 | /* exit from asm block */ |
59 | /* exit from asm block */ |
60 | "1:\n" |
60 | "1:\n" |
61 | : "=&c" (d0), "=&D" (d1), "=&S" (d2) |
61 | : "=&c" (d0), "=&D" (d1), "=&S" (d2) |
62 | : "0" (cnt / 4), "g" (cnt), "1" ((__u32) dst), "2" ((__u32) src) |
62 | : "0" ((__native) (cnt / 4)), "g" ((__native) cnt), "1" ((__native) dst), "2" ((__native) src) |
63 | : "memory"); |
63 | : "memory"); |
64 | 64 | ||
65 | return dst; |
65 | return dst; |
66 | } |
66 | } |
67 | 67 | ||
Line 75... | Line 75... | ||
75 | * @param src Region 1 |
75 | * @param src Region 1 |
76 | * @param dst Region 2 |
76 | * @param dst Region 2 |
77 | * @param cnt Number of bytes |
77 | * @param cnt Number of bytes |
78 | * @return Zero if bytes are equal, non-zero otherwise |
78 | * @return Zero if bytes are equal, non-zero otherwise |
79 | */ |
79 | */ |
80 | static inline int memcmp(__address src, __address dst, size_t cnt) |
80 | static inline int memcmp(const void * src, const void * dst, size_t cnt) |
81 | { |
81 | { |
82 | __u32 d0, d1, d2; |
82 | __u32 d0, d1, d2; |
83 | int ret; |
83 | int ret; |
84 | 84 | ||
85 | __asm__ ( |
85 | __asm__ ( |
Line 87... | Line 87... | ||
87 | "je 1f\n\t" |
87 | "je 1f\n\t" |
88 | "movl %3, %0\n\t" |
88 | "movl %3, %0\n\t" |
89 | "addl $1, %0\n\t" |
89 | "addl $1, %0\n\t" |
90 | "1:\n" |
90 | "1:\n" |
91 | : "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2) |
91 | : "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2) |
92 | : "0" (0), "1" (src), "2" (dst), "3" (cnt) |
92 | : "0" (0), "1" ((__native) src), "2" ((__native) dst), "3" ((__native) cnt) |
93 | ); |
93 | ); |
94 | 94 | ||
95 | return ret; |
95 | return ret; |
96 | } |
96 | } |
97 | 97 |