Add register prefixes.

This commit is contained in:
thorpej 1999-11-10 00:13:59 +00:00
parent e9e011443c
commit c718a7c548
1 changed files with 179 additions and 179 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: copy.s,v 1.35 1999/11/07 17:31:37 chs Exp $ */
/* $NetBSD: copy.s,v 1.36 1999/11/10 00:13:59 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -100,8 +100,8 @@
Lbadfc:
PANIC("copy.s: bad sfc or dfc")
bra 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
#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 */
#define CHECK_SFC
#define CHECK_DFC
@ -120,57 +120,57 @@ Lbadfc:
*/
ENTRY(copyin)
CHECK_SFC
movl sp@(12),d0 | check count
movl %sp@(12),%d0 | check count
beq Lciret | == 0, don't do anything
#ifdef MAPPEDCOPY
cmpl _C_LABEL(mappedcopysize),d0 | size >= mappedcopysize
cmpl _C_LABEL(mappedcopysize),%d0 | size >= mappedcopysize
bcc _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 a0,d1
btst #0,d1 | src address odd?
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 %a0,%d1
btst #0,%d1 | src address odd?
beq Lcieven | no, skip alignment
movsb a0@+,d2 | yes, copy a byte
movb d2,a1@+
subql #1,d0 | adjust count
movsb %a0@+,%d2 | yes, copy a byte
movb %d2,%a1@+
subql #1,%d0 | adjust count
beq Lcidone | count 0, all done
Lcieven:
movl a1,d1
btst #0,d1 | dest address odd?
movl %a1,%d1
btst #0,%d1 | dest address odd?
bne Lcibytes | yes, must copy bytes
movl d0,d1 | OK, both even. Get count
lsrl #2,d1 | and convert to longwords
movl %d0,%d1 | OK, both even. Get count
lsrl #2,%d1 | and convert to longwords
beq Lcibytes | count 0, skip longword loop
subql #1,d1 | predecrement for dbf
subql #1,%d1 | predecrement for dbf
Lcilloop:
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
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
andl #3,d0 | what remains
andl #3,%d0 | what remains
beq Lcidone | nothing, all done
Lcibytes:
subql #1,d0 | predecrement for dbf
subql #1,%d0 | predecrement for dbf
Lcibloop:
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
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
clrl d0 | no error
clrl %d0 | no error
Lcidone:
movl _C_LABEL(curpcb),a0 | clear fault handler
clrl a0@(PCB_ONFAULT)
movl sp@+,d2 | restore scratch register
movl _C_LABEL(curpcb),%a0 | clear fault handler
clrl %a0@(PCB_ONFAULT)
movl %sp@+,%d2 | restore scratch register
Lciret:
rts
Lcifault:
moveq #EFAULT,d0 | got a fault
moveq #EFAULT,%d0 | got a fault
bra Lcidone
/*
@ -186,57 +186,57 @@ Lcifault:
*/
ENTRY(copyout)
CHECK_DFC
movl sp@(12),d0 | check count
movl %sp@(12),%d0 | check count
beq Lcoret | == 0, don't do anything
#ifdef MAPPEDCOPY
cmpl _C_LABEL(mappedcopysize),d0 | size >= mappedcopysize
cmpl _C_LABEL(mappedcopysize),%d0 | size >= mappedcopysize
bcc _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 a0,d1
btst #0,d1 | src address odd?
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 %a0,%d1
btst #0,%d1 | src address odd?
beq Lcoeven | no, skip alignment
movb a0@+,d2 | yes, copy a byte
movsb d2,a1@+
subql #1,d0 | adjust count
movb %a0@+,%d2 | yes, copy a byte
movsb %d2,%a1@+
subql #1,%d0 | adjust count
beq Lcodone | count 0, all done
Lcoeven:
movl a1,d1
btst #0,d1 | dest address odd?
movl %a1,%d1
btst #0,%d1 | dest address odd?
bne Lcobytes | yes, must copy bytes
movl d0,d1 | OK, both even. Get count
lsrl #2,d1 | and convert to longwords
movl %d0,%d1 | OK, both even. Get count
lsrl #2,%d1 | and convert to longwords
beq Lcobytes | count 0, skip longword loop
subql #1,d1 | predecrement for dbf
subql #1,%d1 | predecrement for dbf
Lcolloop:
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
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
andl #3,d0 | what remains
andl #3,%d0 | what remains
beq Lcodone | nothing, all done
Lcobytes:
subql #1,d0 | predecrement for dbf
subql #1,%d0 | predecrement for dbf
Lcobloop:
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
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
clrl d0 | no error
clrl %d0 | no error
Lcodone:
movl _C_LABEL(curpcb),a0 | clear fault handler
clrl a0@(PCB_ONFAULT)
movl sp@+,d2 | restore scratch register
movl _C_LABEL(curpcb),%a0 | clear fault handler
clrl %a0@(PCB_ONFAULT)
movl %sp@+,%d2 | restore scratch register
Lcoret:
rts
Lcofault:
moveq #EFAULT,d0
moveq #EFAULT,%d0
bra Lcodone
/*
@ -246,26 +246,26 @@ Lcofault:
* string is too long, return ENAMETOOLONG; else return 0.
*/
ENTRY(copystr)
movl sp@(4),a0 | a0 = fromaddr
movl sp@(8),a1 | a1 = toaddr
clrl d0
movl sp@(12),d1 | count
movl %sp@(4),%a0 | a0 = fromaddr
movl %sp@(8),%a1 | a1 = toaddr
clrl %d0
movl %sp@(12),%d1 | count
beq Lcstoolong | nothing to copy
subql #1,d1 | predecrement for dbeq
subql #1,%d1 | predecrement for dbeq
Lcsloop:
movb a0@+,a1@+ | copy a byte
dbeq d1,Lcsloop | decrement low word of count
movb %a0@+,%a1@+ | copy a byte
dbeq %d1,Lcsloop | decrement low word of count
beq Lcsdone | copied null, exit
subil #0x10000,d1 | decrement high word of count
subil #0x10000,%d1 | decrement high word of count
bcc Lcsloop | more room, keep going
Lcstoolong:
moveq #ENAMETOOLONG,d0 | ran out of space
moveq #ENAMETOOLONG,%d0 | ran out of space
Lcsdone:
tstl sp@(16) | length desired?
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@
subl %sp@(4),%a0 | yes, calculate length copied
movl %sp@(16),%a1 | store at return location
movl %a0,%a1@
Lcsret:
rts
@ -278,35 +278,35 @@ Lcsret:
*/
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
clrl d0
movl sp@(12),d1 | count
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
clrl %d0
movl %sp@(12),%d1 | count
beq Lcistoolong | nothing to copy
subql #1,d1 | predecrement for dbeq
subql #1,%d1 | predecrement for dbeq
Lcisloop:
movsb a0@+,d0 | copy a byte
movb d0,a1@+
dbeq d1,Lcisloop | decrement low word of count
movsb %a0@+,%d0 | copy a byte
movb %d0,%a1@+
dbeq %d1,Lcisloop | decrement low word of count
beq Lcisdone | copied null, exit
subil #0x10000,d1 | decrement high word of count
subil #0x10000,%d1 | decrement high word of count
bcc Lcisloop | more room, keep going
Lcistoolong:
moveq #ENAMETOOLONG,d0 | ran out of space
moveq #ENAMETOOLONG,%d0 | ran out of space
Lcisdone:
tstl sp@(16) | length desired?
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@
subl %sp@(4),%a0 | yes, calculate length copied
movl %sp@(16),%a1 | store at return location
movl %a0,%a1@
Lcisexit:
movl _C_LABEL(curpcb),a0 | clear fault handler
clrl a0@(PCB_ONFAULT)
movl _C_LABEL(curpcb),%a0 | clear fault handler
clrl %a0@(PCB_ONFAULT)
rts
Lcisfault:
moveq #EFAULT,d0
moveq #EFAULT,%d0
bra Lcisdone
/*
@ -318,35 +318,35 @@ Lcisfault:
*/
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
clrl d0
movl sp@(12),d1 | count
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
clrl %d0
movl %sp@(12),%d1 | count
beq Lcostoolong | nothing to copy
subql #1,d1 | predecrement for dbeq
subql #1,%d1 | predecrement for dbeq
Lcosloop:
movb a0@+,d0 | copy a byte
movsb d0,a1@+
dbeq d1,Lcosloop | decrement low word of count
movb %a0@+,%d0 | copy a byte
movsb %d0,%a1@+
dbeq %d1,Lcosloop | decrement low word of count
beq Lcosdone | copied null, exit
subil #0x10000,d1 | decrement high word of count
subil #0x10000,%d1 | decrement high word of count
bcc Lcosloop | more room, keep going
Lcostoolong:
moveq #ENAMETOOLONG,d0 | ran out of space
moveq #ENAMETOOLONG,%d0 | ran out of space
Lcosdone:
tstl sp@(16) | length desired?
tstl %sp@(16) | length desired?
beq Lcosexit
subl sp@(4),a0 | yes, calculate length copied
movl sp@(16),a1 | store at return location
movl a0,a1@
subl %sp@(4),%a0 | yes, calculate length copied
movl %sp@(16),%a1 | store at return location
movl %a0,%a1@
Lcosexit:
movl _C_LABEL(curpcb),a0 | clear fault handler
clrl a0@(PCB_ONFAULT)
movl _C_LABEL(curpcb),%a0 | clear fault handler
clrl %a0@(PCB_ONFAULT)
rts
Lcosfault:
moveq #EFAULT,d0
moveq #EFAULT,%d0
bra Lcosdone
/*
@ -360,24 +360,24 @@ Lcosfault:
* page fault.
*/
ENTRY(kcopy)
link a6,#-4
movl _C_LABEL(curpcb),a0 | set fault handler
movl a0@(PCB_ONFAULT),a6@(-4) | save old handler first
movl #Lkcfault,a0@(PCB_ONFAULT)
movl a6@(16),sp@- | push len
movl a6@(12),sp@- | push dst
movl a6@(8),sp@- | push src
link %a6,#-4
movl _C_LABEL(curpcb),%a0 | set fault handler
movl %a0@(PCB_ONFAULT),%a6@(-4) | save old handler first
movl #Lkcfault,%a0@(PCB_ONFAULT)
movl %a6@(16),%sp@- | push len
movl %a6@(12),%sp@- | push dst
movl %a6@(8),%sp@- | push src
jbsr _C_LABEL(bcopy) | copy it
addl #12,sp | pop args
clrl d0 | success!
addl #12,%sp | pop args
clrl %d0 | success!
Lkcdone:
movl _C_LABEL(curpcb),a0 | restore fault handler
movl a6@(-4),a0@(PCB_ONFAULT)
unlk a6
movl _C_LABEL(curpcb),%a0 | restore fault handler
movl %a6@(-4),%a0@(PCB_ONFAULT)
unlk %a6
rts
Lkcfault:
addl #16,sp | pop args and return address
moveq #EFAULT,d0 | indicate a fault
addl #16,%sp | pop args and return address
moveq #EFAULT,%d0 | indicate a fault
bra Lkcdone
/*
@ -386,10 +386,10 @@ Lkcfault:
*/
ENTRY(fuword)
CHECK_SFC
movl sp@(4),a0 | address to read
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lferr,a1@(PCB_ONFAULT)
movsl a0@,d0 | do read from user space
movl %sp@(4),%a0 | address to read
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lferr,%a1@(PCB_ONFAULT)
movsl %a0@,%d0 | do read from user space
bra Lfdone
/*
@ -398,11 +398,11 @@ ENTRY(fuword)
*/
ENTRY(fusword)
CHECK_SFC
movl sp@(4),a0 | address to read
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lferr,a1@(PCB_ONFAULT)
moveq #0,d0
movsw a0@,d0 | do read from user space
movl %sp@(4),%a0 | address to read
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lferr,%a1@(PCB_ONFAULT)
moveq #0,%d0
movsw %a0@,%d0 | do read from user space
bra Lfdone
/*
@ -412,11 +412,11 @@ ENTRY(fusword)
*/
ENTRY(fuswintr)
CHECK_SFC
movl sp@(4),a0 | address to read
movl _C_LABEL(curpcb),a1 | set fault handler
movl #_C_LABEL(fubail),a1@(PCB_ONFAULT)
moveq #0,d0
movsw a0@,d0 | do read from user space
movl %sp@(4),%a0 | address to read
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #_C_LABEL(fubail),%a1@(PCB_ONFAULT)
moveq #0,%d0
movsw %a0@,%d0 | do read from user space
bra Lfdone
/*
@ -425,11 +425,11 @@ ENTRY(fuswintr)
*/
ENTRY(fubyte)
CHECK_SFC
movl sp@(4),a0 | address to read
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lferr,a1@(PCB_ONFAULT)
moveq #0,d0
movsb a0@,d0 | do read from user space
movl %sp@(4),%a0 | address to read
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lferr,%a1@(PCB_ONFAULT)
moveq #0,%d0
movsb %a0@,%d0 | do read from user space
bra Lfdone
/*
@ -442,9 +442,9 @@ ENTRY(fubyte)
ENTRY(fubail)
nop
Lferr:
moveq #-1,d0 | error indicator
moveq #-1,%d0 | error indicator
Lfdone:
clrl a1@(PCB_ONFAULT) | clear fault handler
clrl %a1@(PCB_ONFAULT) | clear fault handler
rts
/*
@ -453,12 +453,12 @@ Lfdone:
*/
ENTRY(suword)
CHECK_DFC
movl sp@(4),a0 | address to write
movl sp@(8),d0 | value to put there
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lserr,a1@(PCB_ONFAULT)
movsl d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
movl %sp@(4),%a0 | address to write
movl %sp@(8),%d0 | value to put there
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lserr,%a1@(PCB_ONFAULT)
movsl %d0,%a0@ | do write to user space
moveq #0,%d0 | indicate no fault
bra Lsdone
/*
@ -467,12 +467,12 @@ ENTRY(suword)
*/
ENTRY(susword)
CHECK_DFC
movl sp@(4),a0 | address to write
movw sp@(10),d0 | value to put there
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lserr,a1@(PCB_ONFAULT)
movsw d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
movl %sp@(4),%a0 | address to write
movw %sp@(10),%d0 | value to put there
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lserr,%a1@(PCB_ONFAULT)
movsw %d0,%a0@ | do write to user space
moveq #0,%d0 | indicate no fault
bra Lsdone
/*
@ -482,12 +482,12 @@ ENTRY(susword)
*/
ENTRY(suswintr)
CHECK_DFC
movl sp@(4),a0 | address to write
movw sp@(10),d0 | value to put there
movl _C_LABEL(curpcb),a1 | set fault handler
movl #_C_LABEL(subail),a1@(PCB_ONFAULT)
movsw d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
movl %sp@(4),%a0 | address to write
movw %sp@(10),%d0 | value to put there
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #_C_LABEL(subail),%a1@(PCB_ONFAULT)
movsw %d0,%a0@ | do write to user space
moveq #0,%d0 | indicate no fault
bra Lsdone
/*
@ -496,12 +496,12 @@ ENTRY(suswintr)
*/
ENTRY(subyte)
CHECK_DFC
movl sp@(4),a0 | address to write
movb sp@(11),d0 | value to put there
movl _C_LABEL(curpcb),a1 | set fault handler
movl #Lserr,a1@(PCB_ONFAULT)
movsb d0,a0@ | do write to user space
moveq #0,d0 | indicate no fault
movl %sp@(4),%a0 | address to write
movb %sp@(11),%d0 | value to put there
movl _C_LABEL(curpcb),%a1 | set fault handler
movl #Lserr,%a1@(PCB_ONFAULT)
movsb %d0,%a0@ | do write to user space
moveq #0,%d0 | indicate no fault
bra Lsdone
/*
@ -514,7 +514,7 @@ ENTRY(subyte)
ENTRY(subail)
nop
Lserr:
moveq #-1,d0 | error indicator
moveq #-1,%d0 | error indicator
Lsdone:
clrl a1@(PCB_ONFAULT) | clear fault handler
clrl %a1@(PCB_ONFAULT) | clear fault handler
rts