Path: blob/master/arch/cris/arch-v32/lib/csumcpfruser.S
15125 views
/*1* Add-on to transform csum_partial_copy_nocheck in checksumcopy.S into2* csum_partial_copy_from_user by adding exception records.3*4* Copyright (C) 2001, 2003 Axis Communications AB.5*6* Author: Hans-Peter Nilsson.7*/89#include <asm/errno.h>1011/* Same function body, but a different name. If we just added exception12records to _csum_partial_copy_nocheck and made it generic, we wouldn't13know a user fault from a kernel fault and we would have overhead in14each kernel caller for the error-pointer argument.1516unsigned int csum_partial_copy_from_user17(const char *src, char *dst, int len, unsigned int sum, int *errptr);1819Note that the errptr argument is only set if we encounter an error.20It is conveniently located on the stack, so the normal function body21does not have to handle it. */2223#define csum_partial_copy_nocheck csum_partial_copy_from_user2425/* There are local labels numbered 1, 2 and 3 present to mark the26different from-user accesses. */27#include "checksumcopy.S"2829.section .fixup,"ax"3031;; Here from the movem loop; restore stack.324:33movem [$sp+],$r834;; r12 is already decremented. Add back chunk_size-2.35addq 40-2,$r123637;; Here from the word loop; r12 is off by 2; add it back.385:39addq 2,$r124041;; Here from a failing single byte.426:4344;; Signal in *errptr that we had a failing access.45move.d [$sp],$acr46moveq -EFAULT,$r947subq 4,$sp48move.d $r9,[$acr]4950;; Clear the rest of the destination area using memset. Preserve the51;; checksum for the readable bytes.52move.d $r13,[$sp]53subq 4,$sp54move.d $r11,$r1055move $srp,[$sp]56jsr memset57clear.d $r115859move [$sp+],$srp60ret61move.d [$sp+],$r106263.previous64.section __ex_table,"a"65.dword 1b,4b66.dword 2b,5b67.dword 3b,6b68.previous697071