Merge branch 'master' into x86_64
This commit is contained in:
@@ -161,6 +161,8 @@ arch_cpu_user_TLB_invalidate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: all functions that use fault handlers need to be implemented
|
||||||
|
// in assembly due to problems passing in label addresses in gcc4.
|
||||||
status_t
|
status_t
|
||||||
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
||||||
addr_t *faultHandler)
|
addr_t *faultHandler)
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ arch_cpu_user_TLB_invalidate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: all functions that use fault handlers need to be implemented
|
||||||
|
// in assembly due to problems passing in label addresses in gcc4.
|
||||||
status_t
|
status_t
|
||||||
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
||||||
addr_t *faultHandler)
|
addr_t *faultHandler)
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ arch_cpu_user_TLB_invalidate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: all functions that use fault handlers need to be implemented
|
||||||
|
// in assembly due to problems passing in label addresses in gcc4.
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
|
||||||
addr_t *faultHandler)
|
addr_t *faultHandler)
|
||||||
|
|||||||
@@ -276,32 +276,37 @@ FUNCTION(arch_cpu_user_strlcpy):
|
|||||||
/* Copy at most count - 1 bytes */
|
/* Copy at most count - 1 bytes */
|
||||||
dec %ecx
|
dec %ecx
|
||||||
|
|
||||||
/* move data by bytes */
|
/* If count is now 0, skip straight to null terminating
|
||||||
|
as our loop will otherwise overflow */
|
||||||
|
jnz .L_user_strlcpy_copy_begin
|
||||||
|
movb $0,(%edi)
|
||||||
|
jmp .L_user_strlcpy_source_count
|
||||||
|
|
||||||
|
.L_user_strlcpy_copy_begin:
|
||||||
cld
|
cld
|
||||||
repnz
|
.L_user_strlcpy_copy_loop:
|
||||||
movsb
|
/* move data by bytes */
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
test %al,%al
|
||||||
|
jz .L_user_strlcpy_source_done
|
||||||
|
loop .L_user_strlcpy_copy_loop
|
||||||
|
|
||||||
/* null terminate string */
|
/* null terminate string */
|
||||||
movb $0,(%edi)
|
movb $0,(%edi)
|
||||||
dec %esi
|
dec %esi
|
||||||
|
|
||||||
/* check if we copied the entire source string */
|
|
||||||
cmp $0,%ecx
|
|
||||||
jne .L_user_strlcpy_source_done
|
|
||||||
|
|
||||||
/* count remaining bytes in src */
|
/* count remaining bytes in src */
|
||||||
.L_user_strlcpy_source_count:
|
.L_user_strlcpy_source_count:
|
||||||
not %ecx
|
not %ecx
|
||||||
movb $0,%al
|
xor %al,%al
|
||||||
repnz
|
repnz
|
||||||
scasb
|
scasb
|
||||||
|
|
||||||
.L_user_strlcpy_source_done:
|
.L_user_strlcpy_source_done:
|
||||||
|
|
||||||
movl %esi,%eax
|
movl %esi,%eax
|
||||||
subl 20(%esp),%eax
|
subl 20(%esp),%eax
|
||||||
subl $1,%eax
|
dec %eax
|
||||||
|
|
||||||
/* restore the old fault handler */
|
/* restore the old fault handler */
|
||||||
movl %ebx,(%edx)
|
movl %ebx,(%edx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user