diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-28 17:43:48 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-03-28 17:43:48 +0100 |
commit | 2d61ce4c595245109214cb5e33b48c087ec2cbf0 (patch) | |
tree | 3a1de67175d6ec866b2b39db23fe6e7c7e7957e5 | |
parent | 4847331ea3d7b77be3a0f280ad52d4c58c578bdb (diff) |
Move copyinmsg/copyoutmsg to same place as in master
-rw-r--r-- | x86_64/locore.S | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/x86_64/locore.S b/x86_64/locore.S index 4896727f..5310a77d 100644 --- a/x86_64/locore.S +++ b/x86_64/locore.S @@ -1277,13 +1277,37 @@ ENTRY(discover_x86_cpu_type) * Utility routines. */ +ENTRY(copyin) + xchgq %rsi,%rdi /* Get user source and kernel destination */ + +copyin_remainder: + /*cld*/ /* count up: default mode in all GCC code */ + movq %rdx,%rcx /* move by longwords first */ + shrq $3,%rcx + RECOVER(copyin_fail) + rep + movsq /* move longwords */ + movq %rdx,%rcx /* now move remaining bytes */ + andq $7,%rcx + RECOVER(copyin_fail) + rep + movsb + xorq %rax,%rax /* return 0 for success */ + +copyin_ret: + ret /* and return */ + +copyin_fail: + movq $1,%rax /* return 1 for failure */ + jmp copyin_ret /* pop frame and return */ + /* - * Copy from user address space. + * Copy from user address space - version for copying messages. * arg0: user address * arg1: kernel address - * arg2: byte count + * arg2: byte count - must be a multiple of eight */ -Entry(copyinmsg) +ENTRY(copyinmsg) xchgq %rsi,%rdi /* Get user source and kernel destination */ /* 32 on 64 conversion */ @@ -1317,29 +1341,33 @@ Entry(copyinmsg) jmp copyin_remainder -ENTRY(copyin) +ENTRY(copyout) xchgq %rsi,%rdi /* Get user source and kernel destination */ -copyin_remainder: - /*cld*/ /* count up: default mode in all GCC code */ - movq %rdx,%rcx /* move by longwords first */ +copyout_remainder: + movq %rdx,%rax /* use count */ + /*cld*/ /* count up: always this way in GCC code */ + movq %rax,%rcx /* move by longwords first */ shrq $3,%rcx - RECOVER(copyin_fail) + RECOVER(copyout_fail) rep - movsq /* move longwords */ - movq %rdx,%rcx /* now move remaining bytes */ + movsq + movq %rax,%rcx /* now move remaining bytes */ andq $7,%rcx - RECOVER(copyin_fail) + RECOVER(copyout_fail) rep - movsb + movsb /* move */ xorq %rax,%rax /* return 0 for success */ -copyin_ret: +copyout_ret: ret /* and return */ -copyin_fail: +copyout_fail: movq $1,%rax /* return 1 for failure */ - jmp copyin_ret /* pop frame and return */ + jmp copyout_ret /* pop frame and return */ + +bogus: + ud2 /* * Copy to user address space. @@ -1347,7 +1375,7 @@ copyin_fail: * arg1: user address * arg2: byte count */ -Entry(copyoutmsg) +ENTRY(copyoutmsg) xchgq %rsi,%rdi /* Get user source and kernel destination */ /* 32 on 64 conversion */ @@ -1380,34 +1408,6 @@ Entry(copyoutmsg) jmp copyin_remainder -ENTRY(copyout) - xchgq %rsi,%rdi /* Get user source and kernel destination */ - -copyout_remainder: - movq %rdx,%rax /* use count */ - /*cld*/ /* count up: always this way in GCC code */ - movq %rax,%rcx /* move by longwords first */ - shrq $3,%rcx - RECOVER(copyout_fail) - rep - movsq - movq %rax,%rcx /* now move remaining bytes */ - andq $7,%rcx - RECOVER(copyout_fail) - rep - movsb /* move */ - xorq %rax,%rax /* return 0 for success */ - -copyout_ret: - ret /* and return */ - -copyout_fail: - movq $1,%rax /* return 1 for failure */ - jmp copyout_ret /* pop frame and return */ - -bogus: - ud2 - /* * int inst_fetch(int eip, int cs); * |