Path: blob/master/arch/cris/arch-v10/lib/csumcpfruser.S
15126 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 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.45moveq -EFAULT,$r946move.d $r9,[[$sp]]4748;; Clear the rest of the destination area using memset. Preserve the49;; checksum for the readable bytes.50push $srp51push $r1352move.d $r11,$r1053clear.d $r1154jsr memset55pop $r1056jump [$sp+]5758.previous59.section __ex_table,"a"60.dword 1b,4b61.dword 2b,5b62.dword 3b,6b63.previous646566