Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 Remove the amd64 implementation of fuwo...



details:   https://anonhg.NetBSD.org/src/rev/ee9e1cea6b31
branches:  trunk
changeset: 341762:ee9e1cea6b31
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Nov 21 12:34:48 2015 +0000

description:
Remove the amd64 implementation of fuword and suword. They are not used in
the MI+amd64 code - Christos replaced them yesterday by copy*.

They are both buggy:
 - suword does not properly check the userspace limit: 64 bits are copied,
   but the max address checked is VM_MAXUSER_ADDRESS-4, which means that 4
   bytes may overflow. Reported by Ed Schouten.
 - fuword is supposed to be symmetrical with suword. But it uses 32bit
   registers, so it stores 32bit values! Spotted by Chuck (chs@).

diffstat:

 sys/arch/amd64/amd64/copy.S |  31 +------------------------------
 1 files changed, 1 insertions(+), 30 deletions(-)

diffs (52 lines):

diff -r 9c1b366d53e3 -r ee9e1cea6b31 sys/arch/amd64/amd64/copy.S
--- a/sys/arch/amd64/amd64/copy.S       Sat Nov 21 12:22:25 2015 +0000
+++ b/sys/arch/amd64/amd64/copy.S       Sat Nov 21 12:34:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copy.S,v 1.18 2010/07/07 01:13:29 chs Exp $    */
+/*     $NetBSD: copy.S,v 1.19 2015/11/21 12:34:48 maxv Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -359,19 +359,6 @@
 
 7:     ret
 
-ENTRY(fuword)
-       DEFERRED_SWITCH_CHECK
-       movq    $VM_MAXUSER_ADDRESS-4,%r11
-       cmpq    %r11,%rdi
-       ja      _C_LABEL(fusuaddrfault)
-       GET_CURPCB(%rcx)
-       leaq    _C_LABEL(fusufailure)(%rip),%r11
-       movq    %r11,PCB_ONFAULT(%rcx)
-       movl    (%rdi),%eax
-       movq    $0,PCB_ONFAULT(%rcx)
-       ret
-       DEFERRED_SWITCH_CALL
-       
 ENTRY(fusword)
        DEFERRED_SWITCH_CHECK
        movq    $VM_MAXUSER_ADDRESS-2,%r11
@@ -411,22 +398,6 @@
        ret
        DEFERRED_SWITCH_CALL
 
-ENTRY(suword)
-       DEFERRED_SWITCH_CHECK
-       movq    $VM_MAXUSER_ADDRESS-4,%r11
-       cmpq    %r11,%rdi
-       ja      _C_LABEL(fusuaddrfault)
-
-       GET_CURPCB(%rcx)
-       leaq    _C_LABEL(fusufailure)(%rip),%r11
-       movq    %r11,PCB_ONFAULT(%rcx)
-
-       movq    %rsi,(%rdi)
-       xorq    %rax,%rax
-       movq    %rax,PCB_ONFAULT(%rcx)
-       ret
-       DEFERRED_SWITCH_CALL
-       
 ENTRY(susword)
        DEFERRED_SWITCH_CHECK
        movq    $VM_MAXUSER_ADDRESS-2,%r11



Home | Main Index | Thread Index | Old Index