Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/m68k Move to motorola syntax



details:   https://anonhg.NetBSD.org/src/rev/2a5b18005157
branches:  trunk
changeset: 788834:2a5b18005157
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jul 22 17:52:21 2013 +0000

description:
Move to motorola syntax
Change all branches to use j.. instead of b.. (branches now use byte offsets)
(this causes it to go from 932 to 848 bytes of text)
Add GETCURPCB macro.
(binary identical before the b -> j changes)

diffstat:

 sys/arch/m68k/m68k/copy.s |  338 +++++++++++++++++++++++----------------------
 1 files changed, 172 insertions(+), 166 deletions(-)

diffs (truncated from 583 to 300 lines):

diff -r c598414e6bae -r 2a5b18005157 sys/arch/m68k/m68k/copy.s
--- a/sys/arch/m68k/m68k/copy.s Mon Jul 22 14:52:02 2013 +0000
+++ b/sys/arch/m68k/m68k/copy.s Mon Jul 22 17:52:21 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copy.s,v 1.43 2010/07/07 01:16:25 chs Exp $    */
+/*     $NetBSD: copy.s,v 1.44 2013/07/22 17:52:21 matt Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -80,6 +80,12 @@
        .file   "copy.s"
        .text
 
+#ifdef CI_CURPCB
+#define        GETCURPCB(r)    movl    _C_LABEL(cpu_info_store)+CI_CURPCB,r
+#else
+#define        GETCURPCB(r)    movl    _C_LABEL(curpcb),r
+#endif
+
 #ifdef DIAGNOSTIC
 /*
  * The following routines all use the "moves" instruction to access
@@ -93,7 +99,7 @@
  */
 Lbadfc:
        PANIC("copy.s: bad sfc or dfc")
-       bra     Lbadfc
+       jra     Lbadfc
 #define        CHECK_SFC       movec %sfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
 #define        CHECK_DFC       movec %dfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
 #else  /* DIAGNOSTIC */
@@ -114,57 +120,57 @@
  */
 ENTRY(copyin)
        CHECK_SFC
-       movl    %sp@(12),%d0            | check count
-       beq     Lciret                  | == 0, don't do anything
+       movl    12(%sp),%d0             | check count
+       jeq     Lciret                  | == 0, don't do anything
 #ifdef MAPPEDCOPY
        cmpl    _C_LABEL(mappedcopysize),%d0 | size >= mappedcopysize
-       bcc     _C_LABEL(mappedcopyin)  | yes, go do it the new way
+       jcc     _C_LABEL(mappedcopyin)  | yes, go do it the new way
 #endif
-       movl    %d2,%sp@-               | save scratch register
-       movl    _C_LABEL(curpcb),%a0    | set fault handler
-       movl    #Lcifault,%a0@(PCB_ONFAULT)
-       movl    %sp@(8),%a0             | src address
-       movl    %sp@(12),%a1            | dest address
+       movl    %d2,-(%sp)              | save scratch register
+       GETCURPCB(%a0)                  | set fault handler
+       movl    #Lcifault,PCB_ONFAULT(%a0)
+       movl    8(%sp),%a0              | src address
+       movl    12(%sp),%a1             | dest address
        movl    %a0,%d1
        btst    #0,%d1                  | src address odd?
-       beq     Lcieven                 | no, skip alignment
-       movsb   %a0@+,%d2               | yes, copy a byte
-       movb    %d2,%a1@+
+       jeq     Lcieven                 | no, skip alignment
+       movsb   (%a0)+,%d2              | yes, copy a byte
+       movb    %d2,(%a1)+
        subql   #1,%d0                  | adjust count
-       beq     Lcidone                 | count 0, all done
+       jeq     Lcidone                 | count 0, all done
 Lcieven:
        movl    %a1,%d1
        btst    #0,%d1                  | dest address odd?
-       bne     Lcibytes                | yes, must copy bytes
+       jne     Lcibytes                | yes, must copy bytes
        movl    %d0,%d1                 | OK, both even.  Get count
        lsrl    #2,%d1                  |   and convert to longwords
-       beq     Lcibytes                | count 0, skip longword loop
+       jeq     Lcibytes                | count 0, skip longword loop
        subql   #1,%d1                  | predecrement for dbf
 Lcilloop:
-       movsl   %a0@+,%d2               | copy a longword
-       movl    %d2,%a1@+
+       movsl   (%a0)+,%d2              | copy a longword
+       movl    %d2,(%a1)+
        dbf     %d1,Lcilloop            | decrement low word of count
        subil   #0x10000,%d1            | decrement high word of count
-       bcc     Lcilloop
+       jcc     Lcilloop
        andl    #3,%d0                  | what remains
-       beq     Lcidone                 | nothing, all done
+       jeq     Lcidone                 | nothing, all done
 Lcibytes:
        subql   #1,%d0                  | predecrement for dbf
 Lcibloop:
-       movsb   %a0@+,%d2               | copy a byte
-       movb    %d2,%a1@+
+       movsb   (%a0)+,%d2              | copy a byte
+       movb    %d2,(%a1)+
        dbf     %d0,Lcibloop            | decrement low word of count
        subil   #0x10000,%d0            | decrement high word of count
-       bcc     Lcibloop
+       jcc     Lcibloop
        clrl    %d0                     | no error
 Lcidone:
-       movl    _C_LABEL(curpcb),%a0    | clear fault handler
-       clrl    %a0@(PCB_ONFAULT)
-       movl    %sp@+,%d2               | restore scratch register
+       GETCURPCB(%a0)                  | clear fault handler
+       clrl    PCB_ONFAULT(%a0)
+       movl    (%sp)+,%d2              | restore scratch register
 Lciret:
        rts
 Lcifault:
-       bra     Lcidone
+       jra     Lcidone
 
 /*
  * copyout(void *from, void *to, size_t len);
@@ -179,57 +185,57 @@
  */
 ENTRY(copyout)
        CHECK_DFC
-       movl    %sp@(12),%d0            | check count
-       beq     Lcoret                  | == 0, don't do anything
+       movl    12(%sp),%d0             | check count
+       jeq     Lcoret                  | == 0, don't do anything
 #ifdef MAPPEDCOPY
        cmpl    _C_LABEL(mappedcopysize),%d0 | size >= mappedcopysize
-       bcc     _C_LABEL(mappedcopyout) | yes, go do it the new way
+       jcc     _C_LABEL(mappedcopyout) | yes, go do it the new way
 #endif
-       movl    %d2,%sp@-               | save scratch register
-       movl    _C_LABEL(curpcb),%a0    | set fault handler
-       movl    #Lcofault,%a0@(PCB_ONFAULT)
-       movl    %sp@(8),%a0             | src address
-       movl    %sp@(12),%a1            | dest address
+       movl    %d2,-(%sp)              | save scratch register
+       GETCURPCB(%a0)                  | set fault handler
+       movl    #Lcofault,PCB_ONFAULT(%a0)
+       movl    8(%sp),%a0              | src address
+       movl    12(%sp),%a1             | dest address
        movl    %a0,%d1
        btst    #0,%d1                  | src address odd?
-       beq     Lcoeven                 | no, skip alignment
-       movb    %a0@+,%d2               | yes, copy a byte
-       movsb   %d2,%a1@+
+       jeq     Lcoeven                 | no, skip alignment
+       movb    (%a0)+,%d2              | yes, copy a byte
+       movsb   %d2,(%a1)+
        subql   #1,%d0                  | adjust count
-       beq     Lcodone                 | count 0, all done
+       jeq     Lcodone                 | count 0, all done
 Lcoeven:
        movl    %a1,%d1
        btst    #0,%d1                  | dest address odd?
-       bne     Lcobytes                | yes, must copy bytes
+       jne     Lcobytes                | yes, must copy bytes
        movl    %d0,%d1                 | OK, both even.  Get count
        lsrl    #2,%d1                  |   and convert to longwords
-       beq     Lcobytes                | count 0, skip longword loop
+       jeq     Lcobytes                | count 0, skip longword loop
        subql   #1,%d1                  | predecrement for dbf
 Lcolloop:
-       movl    %a0@+,%d2                       | copy a longword
-       movsl   %d2,%a1@+
+       movl    (%a0)+,%d2                      | copy a longword
+       movsl   %d2,(%a1)+
        dbf     %d1,Lcolloop            | decrement low word of count
        subil   #0x10000,%d1            | decrement high word of count
-       bcc     Lcolloop
+       jcc     Lcolloop
        andl    #3,%d0                  | what remains
-       beq     Lcodone                 | nothing, all done
+       jeq     Lcodone                 | nothing, all done
 Lcobytes:
        subql   #1,%d0                  | predecrement for dbf
 Lcobloop:
-       movb    %a0@+,%d2               | copy a byte
-       movsb   %d2,%a1@+
+       movb    (%a0)+,%d2              | copy a byte
+       movsb   %d2,(%a1)+
        dbf     %d0,Lcobloop            | decrement low word of count
        subil   #0x10000,%d0            | decrement high word of count
-       bcc     Lcobloop
+       jcc     Lcobloop
        clrl    %d0                     | no error
 Lcodone:
-       movl    _C_LABEL(curpcb),%a0    | clear fault handler
-       clrl    %a0@(PCB_ONFAULT)
-       movl    %sp@+,%d2               | restore scratch register
+       GETCURPCB(%a0)                  | clear fault handler
+       clrl    PCB_ONFAULT(%a0)
+       movl    (%sp)+,%d2              | restore scratch register
 Lcoret:
        rts
 Lcofault:
-       bra     Lcodone
+       jra     Lcodone
 
 /*
  * copystr(void *from, void *to, size_t maxlen, size_t *lencopied);
@@ -238,26 +244,26 @@
  * string is too long, return ENAMETOOLONG; else return 0.
  */
 ENTRY(copystr)
-       movl    %sp@(4),%a0             | a0 = fromaddr
-       movl    %sp@(8),%a1             | a1 = toaddr
+       movl    4(%sp),%a0              | a0 = fromaddr
+       movl    8(%sp),%a1              | a1 = toaddr
        clrl    %d0
-       movl    %sp@(12),%d1            | count
-       beq     Lcstoolong              | nothing to copy
+       movl    12(%sp),%d1             | count
+       jeq     Lcstoolong              | nothing to copy
        subql   #1,%d1                  | predecrement for dbeq
 Lcsloop:
-       movb    %a0@+,%a1@+             | copy a byte
+       movb    (%a0)+,(%a1)+           | copy a byte
        dbeq    %d1,Lcsloop             | decrement low word of count
-       beq     Lcsdone                 | copied null, exit
+       jeq     Lcsdone                 | copied null, exit
        subil   #0x10000,%d1            | decrement high word of count
-       bcc     Lcsloop                 | more room, keep going
+       jcc     Lcsloop                 | more room, keep going
 Lcstoolong:
        moveq   #ENAMETOOLONG,%d0       | ran out of space
 Lcsdone:
-       tstl    %sp@(16)                | length desired?
-       beq     Lcsret
-       subl    %sp@(4),%a0             | yes, calculate length copied
-       movl    %sp@(16),%a1            | store at return location
-       movl    %a0,%a1@
+       tstl    16(%sp)         | length desired?
+       jeq     Lcsret
+       subl    4(%sp),%a0              | yes, calculate length copied
+       movl    16(%sp),%a1             | store at return location
+       movl    %a0,(%a1)
 Lcsret:
        rts
 
@@ -270,35 +276,35 @@
  */
 ENTRY(copyinstr)
        CHECK_SFC
-       movl    _C_LABEL(curpcb),%a0    | set fault handler
-       movl    #Lcisfault,%a0@(PCB_ONFAULT)
-       movl    %sp@(4),%a0             | a0 = fromaddr
-       movl    %sp@(8),%a1             | a1 = toaddr
+       GETCURPCB(%a0)                  | set fault handler
+       movl    #Lcisfault,PCB_ONFAULT(%a0)
+       movl    4(%sp),%a0              | a0 = fromaddr
+       movl    8(%sp),%a1              | a1 = toaddr
        clrl    %d0
-       movl    %sp@(12),%d1            | count
-       beq     Lcistoolong             | nothing to copy
+       movl    12(%sp),%d1             | count
+       jeq     Lcistoolong             | nothing to copy
        subql   #1,%d1                  | predecrement for dbeq
 Lcisloop:
-       movsb   %a0@+,%d0               | copy a byte
-       movb    %d0,%a1@+
+       movsb   (%a0)+,%d0              | copy a byte
+       movb    %d0,(%a1)+
        dbeq    %d1,Lcisloop            | decrement low word of count
-       beq     Lcisdone                | copied null, exit
+       jeq     Lcisdone                | copied null, exit
        subil   #0x10000,%d1            | decrement high word of count
-       bcc     Lcisloop                | more room, keep going
+       jcc     Lcisloop                | more room, keep going
 Lcistoolong:
        moveq   #ENAMETOOLONG,%d0       | ran out of space
 Lcisdone:
-       tstl    %sp@(16)                | length desired?
-       beq     Lcisexit
-       subl    %sp@(4),%a0             | yes, calculate length copied
-       movl    %sp@(16),%a1            | store at return location
-       movl    %a0,%a1@
+       tstl    16(%sp)         | length desired?
+       jeq     Lcisexit
+       subl    4(%sp),%a0              | yes, calculate length copied
+       movl    16(%sp),%a1             | store at return location
+       movl    %a0,(%a1)
 Lcisexit:
-       movl    _C_LABEL(curpcb),%a0    | clear fault handler
-       clrl    %a0@(PCB_ONFAULT)
+       GETCURPCB(%a0)                  | clear fault handler
+       clrl    PCB_ONFAULT(%a0)
        rts
 Lcisfault:
-       bra     Lcisdone
+       jra     Lcisdone
 
 /*
  * copyoutstr(void *from, void *to, size_t maxlen, size_t *lencopied);
@@ -309,35 +315,35 @@
  */
 ENTRY(copyoutstr)
        CHECK_DFC
-       movl    _C_LABEL(curpcb),%a0    | set fault handler
-       movl    #Lcosfault,%a0@(PCB_ONFAULT)
-       movl    %sp@(4),%a0             | a0 = fromaddr
-       movl    %sp@(8),%a1             | a1 = toaddr
+       GETCURPCB(%a0)                  | set fault handler
+       movl    #Lcosfault,PCB_ONFAULT(%a0)



Home | Main Index | Thread Index | Old Index