Commit af313e5a authored by Martin Schwidefsky's avatar Martin Schwidefsky

[S390] broken copy_in_user function.

The copy_in_user primitive does not work as advertised. If the source
and target area are available copy_in_user copies one byte too much.
If one of the memory areas is not available it does not copy as much
data as it can, but up to 257 bytes less.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent dc709bd1
...@@ -88,30 +88,31 @@ __copy_to_user_asm: ...@@ -88,30 +88,31 @@ __copy_to_user_asm:
.globl __copy_in_user_asm .globl __copy_in_user_asm
# %r2 = from, %r3 = n, %r4 = to # %r2 = from, %r3 = n, %r4 = to
__copy_in_user_asm: __copy_in_user_asm:
ahi %r3,-1
jo 6f
sacf 256 sacf 256
bras 1,1f bras %r1,4f
mvc 0(1,%r4),0(%r2) 0: ahi %r3,257
0: mvc 0(256,%r4),0(%r2) 1: mvc 0(1,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
1: ahi %r3,-256
jnm 0b
2: ex %r3,0(%r1)
sacf 0
slr %r2,%r2
br 14
3: mvc 0(1,%r4),0(%r2)
la %r2,1(%r2) la %r2,1(%r2)
la %r4,1(%r4) la %r4,1(%r4)
ahi %r3,-1 ahi %r3,-1
jnz 1b
2: lr %r2,%r3
br %r14
3: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
4: ahi %r3,-256
jnm 3b jnm 3b
4: lr %r2,%r3 5: ex %r3,4(%r1)
sacf 0 sacf 0
6: slr %r2,%r2
br %r14 br %r14
.section __ex_table,"a" .section __ex_table,"a"
.long 0b,3b .long 1b,2b
.long 2b,3b .long 3b,0b
.long 3b,4b .long 5b,0b
.previous .previous
.align 4 .align 4
......
...@@ -88,30 +88,31 @@ __copy_to_user_asm: ...@@ -88,30 +88,31 @@ __copy_to_user_asm:
.globl __copy_in_user_asm .globl __copy_in_user_asm
# %r2 = from, %r3 = n, %r4 = to # %r2 = from, %r3 = n, %r4 = to
__copy_in_user_asm: __copy_in_user_asm:
aghi %r3,-1
jo 6f
sacf 256 sacf 256
bras 1,1f bras %r1,4f
mvc 0(1,%r4),0(%r2) 0: aghi %r3,257
0: mvc 0(256,%r4),0(%r2) 1: mvc 0(1,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
1: aghi %r3,-256
jnm 0b
2: ex %r3,0(%r1)
sacf 0
slgr %r2,%r2
br 14
3: mvc 0(1,%r4),0(%r2)
la %r2,1(%r2) la %r2,1(%r2)
la %r4,1(%r4) la %r4,1(%r4)
aghi %r3,-1 aghi %r3,-1
jnz 1b
2: lgr %r2,%r3
br %r14
3: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
4: aghi %r3,-256
jnm 3b jnm 3b
4: lgr %r2,%r3 5: ex %r3,4(%r1)
sacf 0 sacf 0
br %r14 6: slgr %r2,%r2
br 14
.section __ex_table,"a" .section __ex_table,"a"
.quad 0b,3b .quad 1b,2b
.quad 2b,3b .quad 3b,0b
.quad 3b,4b .quad 5b,0b
.previous .previous
.align 4 .align 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment