提交 d1308e39 编写于 作者: M Mao Minkai 提交者: guzitao

sw64: fix exception handling of deep-copy_user.S

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5PN9S

--------------------------------

If exception happened inside simd part causing the function to exit,
pop stack to make sure everything works correctly.
Signed-off-by: NMao Minkai <maominkai@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 e6896efc
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
* *
* $4: 8-byte misalignment of src when dest is 8-byte aligned * $4: 8-byte misalignment of src when dest is 8-byte aligned
* $5: 32-byte misalignment of src when dest is 32-byte aligned * $5: 32-byte misalignment of src when dest is 32-byte aligned
* $7: SIMD status
* 0: not in simd loop
* 1: in simd loop
* 2: in simd_u loop
* $16: latest dest, clobbered * $16: latest dest, clobbered
* $17: latest src, clobbered * $17: latest src, clobbered
* $18: bytes left to copy * $18: bytes left to copy
...@@ -18,14 +22,16 @@ ...@@ -18,14 +22,16 @@
addl $sp, 0x1f, $23; \ addl $sp, 0x1f, $23; \
bic $23, 0x1f, $23; \ bic $23, 0x1f, $23; \
vstd $f1, 0($23); \ vstd $f1, 0($23); \
vstd $f2, 0x20($23) vstd $f2, 0x20($23); \
ldi $7, 1
#define RESTORE_SIMD_REGS \ #define RESTORE_SIMD_REGS \
addl $sp, 0x1f, $23; \ addl $sp, 0x1f, $23; \
bic $23, 0x1f, $23; \ bic $23, 0x1f, $23; \
vldd $f1, 0($23); \ vldd $f1, 0($23); \
vldd $f2, 0x20($23); \ vldd $f2, 0x20($23); \
ldi $sp, 0x60($sp) ldi $sp, 0x60($sp); \
bis $31, $31, $7
#define SAVE_SIMD_U_REGS \ #define SAVE_SIMD_U_REGS \
ldi $sp, -0xc0($sp); \ ldi $sp, -0xc0($sp); \
...@@ -35,7 +41,8 @@ ...@@ -35,7 +41,8 @@
vstd $f2, 0x20($23); \ vstd $f2, 0x20($23); \
vstd $f4, 0x40($23); \ vstd $f4, 0x40($23); \
vstd $f5, 0x60($23); \ vstd $f5, 0x60($23); \
vstd $f3, 0x80($23) vstd $f3, 0x80($23); \
ldi $7, 2
#define RESTORE_SIMD_U_REGS \ #define RESTORE_SIMD_U_REGS \
addl $sp, 0x1f, $23; \ addl $sp, 0x1f, $23; \
...@@ -45,7 +52,8 @@ ...@@ -45,7 +52,8 @@
vldd $f4, 0x40($23); \ vldd $f4, 0x40($23); \
vldd $f5, 0x60($23); \ vldd $f5, 0x60($23); \
vldd $f3, 0x80($23); \ vldd $f3, 0x80($23); \
ldi $sp, 0xc0($sp) ldi $sp, 0xc0($sp); \
bis $31, $31, $7
ble $18, $out ble $18, $out
and $16, 7, $1 and $16, 7, $1
......
...@@ -10,13 +10,34 @@ ...@@ -10,13 +10,34 @@
ldi $31, $out-99b($31); \ ldi $31, $out-99b($31); \
.previous .previous
/*
* $7: SIMD status
* 0: not in simd loop
* 1: in simd loop
* 2: in simd_u loop
* $18: bytes left to copy
*
*/
.globl __copy_user .globl __copy_user
.ent __copy_user .ent __copy_user
__copy_user: __copy_user:
.prologue 0 .prologue 0
bis $31, $31, $7
#include "deep-copy_template.S" #include "deep-copy_template.S"
$out: $out:
bis $31, $18, $0 bis $31, $18, $0
beq $7, $return
subl $7, 1, $7
beq $7, $restore_simd
$restore_simd_u:
RESTORE_SIMD_U_REGS
br $31, $return
$restore_simd:
RESTORE_SIMD_REGS
$return:
ret ret
.end __copy_user .end __copy_user
EXPORT_SYMBOL(__copy_user) EXPORT_SYMBOL(__copy_user)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册