/*1* __get_user functions.2*3* (C) Copyright 1998 Linus Torvalds4* (C) Copyright 2005 Andi Kleen5* (C) Copyright 2008 Glauber Costa6*7* These functions have a non-standard call interface8* to make them more efficient, especially as they9* return an error value in addition to the "real"10* return value.11*/1213/*14* __get_user_X15*16* Inputs: %[r|e]ax contains the address.17* The register is modified, but all changes are undone18* before returning because the C code doesn't know about it.19*20* Outputs: %[r|e]ax is error code (0 or -EFAULT)21* %[r|e]dx contains zero-extended value22*23*24* These functions should not modify any other registers,25* as they get called from within inline assembly.26*/2728#include <linux/linkage.h>29#include <asm/dwarf2.h>30#include <asm/page_types.h>31#include <asm/errno.h>32#include <asm/asm-offsets.h>33#include <asm/thread_info.h>34#include <asm/asm.h>3536.text37ENTRY(__get_user_1)38CFI_STARTPROC39GET_THREAD_INFO(%_ASM_DX)40cmp TI_addr_limit(%_ASM_DX),%_ASM_AX41jae bad_get_user421: movzb (%_ASM_AX),%edx43xor %eax,%eax44ret45CFI_ENDPROC46ENDPROC(__get_user_1)4748ENTRY(__get_user_2)49CFI_STARTPROC50add $1,%_ASM_AX51jc bad_get_user52GET_THREAD_INFO(%_ASM_DX)53cmp TI_addr_limit(%_ASM_DX),%_ASM_AX54jae bad_get_user552: movzwl -1(%_ASM_AX),%edx56xor %eax,%eax57ret58CFI_ENDPROC59ENDPROC(__get_user_2)6061ENTRY(__get_user_4)62CFI_STARTPROC63add $3,%_ASM_AX64jc bad_get_user65GET_THREAD_INFO(%_ASM_DX)66cmp TI_addr_limit(%_ASM_DX),%_ASM_AX67jae bad_get_user683: mov -3(%_ASM_AX),%edx69xor %eax,%eax70ret71CFI_ENDPROC72ENDPROC(__get_user_4)7374#ifdef CONFIG_X86_6475ENTRY(__get_user_8)76CFI_STARTPROC77add $7,%_ASM_AX78jc bad_get_user79GET_THREAD_INFO(%_ASM_DX)80cmp TI_addr_limit(%_ASM_DX),%_ASM_AX81jae bad_get_user824: movq -7(%_ASM_AX),%_ASM_DX83xor %eax,%eax84ret85CFI_ENDPROC86ENDPROC(__get_user_8)87#endif8889bad_get_user:90CFI_STARTPROC91xor %edx,%edx92mov $(-EFAULT),%_ASM_AX93ret94CFI_ENDPROC95END(bad_get_user)9697.section __ex_table,"a"98_ASM_PTR 1b,bad_get_user99_ASM_PTR 2b,bad_get_user100_ASM_PTR 3b,bad_get_user101#ifdef CONFIG_X86_64102_ASM_PTR 4b,bad_get_user103#endif104105106