| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This file contains assembly-language implementations |
|---|
| 3 | 4 | * of IP-style 1's complement checksum routines. |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation; either version |
|---|
| 10 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 11 | 7 | * |
|---|
| 12 | 8 | * Severely hacked about by Paul Mackerras (paulus@cs.anu.edu.au). |
|---|
| 13 | 9 | */ |
|---|
| .. | .. |
|---|
| 186 | 182 | |
|---|
| 187 | 183 | .macro srcnr |
|---|
| 188 | 184 | 100: |
|---|
| 189 | | - EX_TABLE(100b,.Lsrc_error_nr) |
|---|
| 185 | + EX_TABLE(100b,.Lerror_nr) |
|---|
| 190 | 186 | .endm |
|---|
| 191 | 187 | |
|---|
| 192 | 188 | .macro source |
|---|
| 193 | 189 | 150: |
|---|
| 194 | | - EX_TABLE(150b,.Lsrc_error) |
|---|
| 190 | + EX_TABLE(150b,.Lerror) |
|---|
| 195 | 191 | .endm |
|---|
| 196 | 192 | |
|---|
| 197 | 193 | .macro dstnr |
|---|
| 198 | 194 | 200: |
|---|
| 199 | | - EX_TABLE(200b,.Ldest_error_nr) |
|---|
| 195 | + EX_TABLE(200b,.Lerror_nr) |
|---|
| 200 | 196 | .endm |
|---|
| 201 | 197 | |
|---|
| 202 | 198 | .macro dest |
|---|
| 203 | 199 | 250: |
|---|
| 204 | | - EX_TABLE(250b,.Ldest_error) |
|---|
| 200 | + EX_TABLE(250b,.Lerror) |
|---|
| 205 | 201 | .endm |
|---|
| 206 | 202 | |
|---|
| 207 | 203 | /* |
|---|
| 208 | 204 | * Computes the checksum of a memory block at src, length len, |
|---|
| 209 | | - * and adds in "sum" (32-bit), while copying the block to dst. |
|---|
| 210 | | - * If an access exception occurs on src or dst, it stores -EFAULT |
|---|
| 211 | | - * to *src_err or *dst_err respectively. The caller must take any action |
|---|
| 212 | | - * required in this case (zeroing memory, recalculating partial checksum etc). |
|---|
| 205 | + * and adds in 0xffffffff (32-bit), while copying the block to dst. |
|---|
| 206 | + * If an access exception occurs, it returns 0. |
|---|
| 213 | 207 | * |
|---|
| 214 | | - * csum_partial_copy_generic(r3=src, r4=dst, r5=len, r6=sum, r7=src_err, r8=dst_err) |
|---|
| 208 | + * csum_partial_copy_generic(r3=src, r4=dst, r5=len) |
|---|
| 215 | 209 | */ |
|---|
| 216 | 210 | _GLOBAL(csum_partial_copy_generic) |
|---|
| 211 | + li r6,-1 |
|---|
| 217 | 212 | addic r0,r6,0 /* clear carry */ |
|---|
| 218 | 213 | |
|---|
| 219 | 214 | srdi. r6,r5,3 /* less than 8 bytes? */ |
|---|
| .. | .. |
|---|
| 405 | 400 | srdi r3,r3,32 |
|---|
| 406 | 401 | blr |
|---|
| 407 | 402 | |
|---|
| 408 | | -.Lsrc_error: |
|---|
| 403 | +.Lerror: |
|---|
| 409 | 404 | ld r14,STK_REG(R14)(r1) |
|---|
| 410 | 405 | ld r15,STK_REG(R15)(r1) |
|---|
| 411 | 406 | ld r16,STK_REG(R16)(r1) |
|---|
| 412 | 407 | addi r1,r1,STACKFRAMESIZE |
|---|
| 413 | | -.Lsrc_error_nr: |
|---|
| 414 | | - cmpdi 0,r7,0 |
|---|
| 415 | | - beqlr |
|---|
| 416 | | - li r6,-EFAULT |
|---|
| 417 | | - stw r6,0(r7) |
|---|
| 408 | +.Lerror_nr: |
|---|
| 409 | + li r3,0 |
|---|
| 418 | 410 | blr |
|---|
| 419 | 411 | |
|---|
| 420 | | -.Ldest_error: |
|---|
| 421 | | - ld r14,STK_REG(R14)(r1) |
|---|
| 422 | | - ld r15,STK_REG(R15)(r1) |
|---|
| 423 | | - ld r16,STK_REG(R16)(r1) |
|---|
| 424 | | - addi r1,r1,STACKFRAMESIZE |
|---|
| 425 | | -.Ldest_error_nr: |
|---|
| 426 | | - cmpdi 0,r8,0 |
|---|
| 427 | | - beqlr |
|---|
| 428 | | - li r6,-EFAULT |
|---|
| 429 | | - stw r6,0(r8) |
|---|
| 430 | | - blr |
|---|
| 431 | 412 | EXPORT_SYMBOL(csum_partial_copy_generic) |
|---|
| 432 | 413 | |
|---|
| 433 | 414 | /* |
|---|