Files
OrangePi_CM5/arch/x86/lib/putuser.S
T

95 lines
1.8 KiB
ArmAsm
Raw Normal View History

2005-04-16 15:20:36 -07:00
/*
* __put_user functions.
*
* (C) Copyright 2005 Linus Torvalds
2008-06-24 17:40:14 -03:00
* (C) Copyright 2005 Andi Kleen
* (C) Copyright 2008 Glauber Costa
2005-04-16 15:20:36 -07:00
*
* These functions have a non-standard call interface
* to make them more efficient, especially as they
* return an error value in addition to the "real"
* return value.
*/
#include <linux/linkage.h>
#include <asm/dwarf2.h>
2005-04-16 15:20:36 -07:00
#include <asm/thread_info.h>
2008-06-24 17:40:14 -03:00
#include <asm/errno.h>
2008-06-24 17:36:31 -03:00
#include <asm/asm.h>
2005-04-16 15:20:36 -07:00
/*
* __put_user_X
*
* Inputs: %eax[:%edx] contains the data
* %ecx contains the address
*
* Outputs: %eax is error code (0 or -EFAULT)
*
* These functions should not modify any other registers,
* as they get called from within inline assembly.
*/
#define ENTER CFI_STARTPROC ; \
2008-06-24 17:36:31 -03:00
GET_THREAD_INFO(%_ASM_BX)
2008-06-24 12:40:55 -03:00
#define EXIT ret ; \
CFI_ENDPROC
2005-04-16 15:20:36 -07:00
.text
ENTRY(__put_user_1)
2005-04-16 15:20:36 -07:00
ENTER
2008-06-24 17:36:31 -03:00
cmp TI_addr_limit(%_ASM_BX),%_ASM_CX
2005-04-16 15:20:36 -07:00
jae bad_put_user
2008-06-24 17:36:31 -03:00
1: movb %al,(%_ASM_CX)
xor %eax,%eax
2005-04-16 15:20:36 -07:00
EXIT
ENDPROC(__put_user_1)
2005-04-16 15:20:36 -07:00
ENTRY(__put_user_2)
2005-04-16 15:20:36 -07:00
ENTER
2008-06-24 17:36:31 -03:00
mov TI_addr_limit(%_ASM_BX),%_ASM_BX
sub $1,%_ASM_BX
cmp %_ASM_BX,%_ASM_CX
2005-04-16 15:20:36 -07:00
jae bad_put_user
2008-06-24 17:36:31 -03:00
2: movw %ax,(%_ASM_CX)
xor %eax,%eax
2005-04-16 15:20:36 -07:00
EXIT
ENDPROC(__put_user_2)
2005-04-16 15:20:36 -07:00
ENTRY(__put_user_4)
2005-04-16 15:20:36 -07:00
ENTER
2008-06-24 17:36:31 -03:00
mov TI_addr_limit(%_ASM_BX),%_ASM_BX
sub $3,%_ASM_BX
cmp %_ASM_BX,%_ASM_CX
2005-04-16 15:20:36 -07:00
jae bad_put_user
2008-06-24 17:36:31 -03:00
3: movl %eax,(%_ASM_CX)
xor %eax,%eax
2005-04-16 15:20:36 -07:00
EXIT
ENDPROC(__put_user_4)
2005-04-16 15:20:36 -07:00
ENTRY(__put_user_8)
2005-04-16 15:20:36 -07:00
ENTER
2008-06-24 17:36:31 -03:00
mov TI_addr_limit(%_ASM_BX),%_ASM_BX
sub $7,%_ASM_BX
cmp %_ASM_BX,%_ASM_CX
2005-04-16 15:20:36 -07:00
jae bad_put_user
2008-06-24 17:40:14 -03:00
4: mov %_ASM_AX,(%_ASM_CX)
#ifdef CONFIG_X86_32
2008-06-24 17:36:31 -03:00
5: movl %edx,4(%_ASM_CX)
2008-06-24 17:40:14 -03:00
#endif
xor %eax,%eax
2005-04-16 15:20:36 -07:00
EXIT
ENDPROC(__put_user_8)
2005-04-16 15:20:36 -07:00
bad_put_user:
2008-06-24 12:40:55 -03:00
CFI_STARTPROC
2008-06-24 17:40:14 -03:00
movl $-EFAULT,%eax
2005-04-16 15:20:36 -07:00
EXIT
END(bad_put_user)
2005-04-16 15:20:36 -07:00
_ASM_EXTABLE(1b,bad_put_user)
_ASM_EXTABLE(2b,bad_put_user)
_ASM_EXTABLE(3b,bad_put_user)
_ASM_EXTABLE(4b,bad_put_user)
2008-06-24 17:40:14 -03:00
#ifdef CONFIG_X86_32
_ASM_EXTABLE(5b,bad_put_user)
2008-06-24 17:40:14 -03:00
#endif