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)
This commit is contained in:
parent
c5563e5ccb
commit
cb0d6358fc
@ -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.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
@ -80,6 +80,12 @@
|
|||||||
.file "copy.s"
|
.file "copy.s"
|
||||||
.text
|
.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
|
#ifdef DIAGNOSTIC
|
||||||
/*
|
/*
|
||||||
* The following routines all use the "moves" instruction to access
|
* The following routines all use the "moves" instruction to access
|
||||||
@ -93,7 +99,7 @@
|
|||||||
*/
|
*/
|
||||||
Lbadfc:
|
Lbadfc:
|
||||||
PANIC("copy.s: bad sfc or dfc")
|
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_SFC movec %sfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
|
||||||
#define CHECK_DFC movec %dfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
|
#define CHECK_DFC movec %dfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
|
||||||
#else /* DIAGNOSTIC */
|
#else /* DIAGNOSTIC */
|
||||||
@ -114,57 +120,57 @@ Lbadfc:
|
|||||||
*/
|
*/
|
||||||
ENTRY(copyin)
|
ENTRY(copyin)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl %sp@(12),%d0 | check count
|
movl 12(%sp),%d0 | check count
|
||||||
beq Lciret | == 0, don't do anything
|
jeq Lciret | == 0, don't do anything
|
||||||
#ifdef MAPPEDCOPY
|
#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
|
jcc _C_LABEL(mappedcopyin) | yes, go do it the new way
|
||||||
#endif
|
#endif
|
||||||
movl %d2,%sp@- | save scratch register
|
movl %d2,-(%sp) | save scratch register
|
||||||
movl _C_LABEL(curpcb),%a0 | set fault handler
|
GETCURPCB(%a0) | set fault handler
|
||||||
movl #Lcifault,%a0@(PCB_ONFAULT)
|
movl #Lcifault,PCB_ONFAULT(%a0)
|
||||||
movl %sp@(8),%a0 | src address
|
movl 8(%sp),%a0 | src address
|
||||||
movl %sp@(12),%a1 | dest address
|
movl 12(%sp),%a1 | dest address
|
||||||
movl %a0,%d1
|
movl %a0,%d1
|
||||||
btst #0,%d1 | src address odd?
|
btst #0,%d1 | src address odd?
|
||||||
beq Lcieven | no, skip alignment
|
jeq Lcieven | no, skip alignment
|
||||||
movsb %a0@+,%d2 | yes, copy a byte
|
movsb (%a0)+,%d2 | yes, copy a byte
|
||||||
movb %d2,%a1@+
|
movb %d2,(%a1)+
|
||||||
subql #1,%d0 | adjust count
|
subql #1,%d0 | adjust count
|
||||||
beq Lcidone | count 0, all done
|
jeq Lcidone | count 0, all done
|
||||||
Lcieven:
|
Lcieven:
|
||||||
movl %a1,%d1
|
movl %a1,%d1
|
||||||
btst #0,%d1 | dest address odd?
|
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
|
movl %d0,%d1 | OK, both even. Get count
|
||||||
lsrl #2,%d1 | and convert to longwords
|
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
|
subql #1,%d1 | predecrement for dbf
|
||||||
Lcilloop:
|
Lcilloop:
|
||||||
movsl %a0@+,%d2 | copy a longword
|
movsl (%a0)+,%d2 | copy a longword
|
||||||
movl %d2,%a1@+
|
movl %d2,(%a1)+
|
||||||
dbf %d1,Lcilloop | decrement low word of count
|
dbf %d1,Lcilloop | decrement low word of count
|
||||||
subil #0x10000,%d1 | decrement high word of count
|
subil #0x10000,%d1 | decrement high word of count
|
||||||
bcc Lcilloop
|
jcc Lcilloop
|
||||||
andl #3,%d0 | what remains
|
andl #3,%d0 | what remains
|
||||||
beq Lcidone | nothing, all done
|
jeq Lcidone | nothing, all done
|
||||||
Lcibytes:
|
Lcibytes:
|
||||||
subql #1,%d0 | predecrement for dbf
|
subql #1,%d0 | predecrement for dbf
|
||||||
Lcibloop:
|
Lcibloop:
|
||||||
movsb %a0@+,%d2 | copy a byte
|
movsb (%a0)+,%d2 | copy a byte
|
||||||
movb %d2,%a1@+
|
movb %d2,(%a1)+
|
||||||
dbf %d0,Lcibloop | decrement low word of count
|
dbf %d0,Lcibloop | decrement low word of count
|
||||||
subil #0x10000,%d0 | decrement high word of count
|
subil #0x10000,%d0 | decrement high word of count
|
||||||
bcc Lcibloop
|
jcc Lcibloop
|
||||||
clrl %d0 | no error
|
clrl %d0 | no error
|
||||||
Lcidone:
|
Lcidone:
|
||||||
movl _C_LABEL(curpcb),%a0 | clear fault handler
|
GETCURPCB(%a0) | clear fault handler
|
||||||
clrl %a0@(PCB_ONFAULT)
|
clrl PCB_ONFAULT(%a0)
|
||||||
movl %sp@+,%d2 | restore scratch register
|
movl (%sp)+,%d2 | restore scratch register
|
||||||
Lciret:
|
Lciret:
|
||||||
rts
|
rts
|
||||||
Lcifault:
|
Lcifault:
|
||||||
bra Lcidone
|
jra Lcidone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copyout(void *from, void *to, size_t len);
|
* copyout(void *from, void *to, size_t len);
|
||||||
@ -179,57 +185,57 @@ Lcifault:
|
|||||||
*/
|
*/
|
||||||
ENTRY(copyout)
|
ENTRY(copyout)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl %sp@(12),%d0 | check count
|
movl 12(%sp),%d0 | check count
|
||||||
beq Lcoret | == 0, don't do anything
|
jeq Lcoret | == 0, don't do anything
|
||||||
#ifdef MAPPEDCOPY
|
#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
|
jcc _C_LABEL(mappedcopyout) | yes, go do it the new way
|
||||||
#endif
|
#endif
|
||||||
movl %d2,%sp@- | save scratch register
|
movl %d2,-(%sp) | save scratch register
|
||||||
movl _C_LABEL(curpcb),%a0 | set fault handler
|
GETCURPCB(%a0) | set fault handler
|
||||||
movl #Lcofault,%a0@(PCB_ONFAULT)
|
movl #Lcofault,PCB_ONFAULT(%a0)
|
||||||
movl %sp@(8),%a0 | src address
|
movl 8(%sp),%a0 | src address
|
||||||
movl %sp@(12),%a1 | dest address
|
movl 12(%sp),%a1 | dest address
|
||||||
movl %a0,%d1
|
movl %a0,%d1
|
||||||
btst #0,%d1 | src address odd?
|
btst #0,%d1 | src address odd?
|
||||||
beq Lcoeven | no, skip alignment
|
jeq Lcoeven | no, skip alignment
|
||||||
movb %a0@+,%d2 | yes, copy a byte
|
movb (%a0)+,%d2 | yes, copy a byte
|
||||||
movsb %d2,%a1@+
|
movsb %d2,(%a1)+
|
||||||
subql #1,%d0 | adjust count
|
subql #1,%d0 | adjust count
|
||||||
beq Lcodone | count 0, all done
|
jeq Lcodone | count 0, all done
|
||||||
Lcoeven:
|
Lcoeven:
|
||||||
movl %a1,%d1
|
movl %a1,%d1
|
||||||
btst #0,%d1 | dest address odd?
|
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
|
movl %d0,%d1 | OK, both even. Get count
|
||||||
lsrl #2,%d1 | and convert to longwords
|
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
|
subql #1,%d1 | predecrement for dbf
|
||||||
Lcolloop:
|
Lcolloop:
|
||||||
movl %a0@+,%d2 | copy a longword
|
movl (%a0)+,%d2 | copy a longword
|
||||||
movsl %d2,%a1@+
|
movsl %d2,(%a1)+
|
||||||
dbf %d1,Lcolloop | decrement low word of count
|
dbf %d1,Lcolloop | decrement low word of count
|
||||||
subil #0x10000,%d1 | decrement high word of count
|
subil #0x10000,%d1 | decrement high word of count
|
||||||
bcc Lcolloop
|
jcc Lcolloop
|
||||||
andl #3,%d0 | what remains
|
andl #3,%d0 | what remains
|
||||||
beq Lcodone | nothing, all done
|
jeq Lcodone | nothing, all done
|
||||||
Lcobytes:
|
Lcobytes:
|
||||||
subql #1,%d0 | predecrement for dbf
|
subql #1,%d0 | predecrement for dbf
|
||||||
Lcobloop:
|
Lcobloop:
|
||||||
movb %a0@+,%d2 | copy a byte
|
movb (%a0)+,%d2 | copy a byte
|
||||||
movsb %d2,%a1@+
|
movsb %d2,(%a1)+
|
||||||
dbf %d0,Lcobloop | decrement low word of count
|
dbf %d0,Lcobloop | decrement low word of count
|
||||||
subil #0x10000,%d0 | decrement high word of count
|
subil #0x10000,%d0 | decrement high word of count
|
||||||
bcc Lcobloop
|
jcc Lcobloop
|
||||||
clrl %d0 | no error
|
clrl %d0 | no error
|
||||||
Lcodone:
|
Lcodone:
|
||||||
movl _C_LABEL(curpcb),%a0 | clear fault handler
|
GETCURPCB(%a0) | clear fault handler
|
||||||
clrl %a0@(PCB_ONFAULT)
|
clrl PCB_ONFAULT(%a0)
|
||||||
movl %sp@+,%d2 | restore scratch register
|
movl (%sp)+,%d2 | restore scratch register
|
||||||
Lcoret:
|
Lcoret:
|
||||||
rts
|
rts
|
||||||
Lcofault:
|
Lcofault:
|
||||||
bra Lcodone
|
jra Lcodone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copystr(void *from, void *to, size_t maxlen, size_t *lencopied);
|
* copystr(void *from, void *to, size_t maxlen, size_t *lencopied);
|
||||||
@ -238,26 +244,26 @@ Lcofault:
|
|||||||
* string is too long, return ENAMETOOLONG; else return 0.
|
* string is too long, return ENAMETOOLONG; else return 0.
|
||||||
*/
|
*/
|
||||||
ENTRY(copystr)
|
ENTRY(copystr)
|
||||||
movl %sp@(4),%a0 | a0 = fromaddr
|
movl 4(%sp),%a0 | a0 = fromaddr
|
||||||
movl %sp@(8),%a1 | a1 = toaddr
|
movl 8(%sp),%a1 | a1 = toaddr
|
||||||
clrl %d0
|
clrl %d0
|
||||||
movl %sp@(12),%d1 | count
|
movl 12(%sp),%d1 | count
|
||||||
beq Lcstoolong | nothing to copy
|
jeq Lcstoolong | nothing to copy
|
||||||
subql #1,%d1 | predecrement for dbeq
|
subql #1,%d1 | predecrement for dbeq
|
||||||
Lcsloop:
|
Lcsloop:
|
||||||
movb %a0@+,%a1@+ | copy a byte
|
movb (%a0)+,(%a1)+ | copy a byte
|
||||||
dbeq %d1,Lcsloop | decrement low word of count
|
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
|
subil #0x10000,%d1 | decrement high word of count
|
||||||
bcc Lcsloop | more room, keep going
|
jcc Lcsloop | more room, keep going
|
||||||
Lcstoolong:
|
Lcstoolong:
|
||||||
moveq #ENAMETOOLONG,%d0 | ran out of space
|
moveq #ENAMETOOLONG,%d0 | ran out of space
|
||||||
Lcsdone:
|
Lcsdone:
|
||||||
tstl %sp@(16) | length desired?
|
tstl 16(%sp) | length desired?
|
||||||
beq Lcsret
|
jeq Lcsret
|
||||||
subl %sp@(4),%a0 | yes, calculate length copied
|
subl 4(%sp),%a0 | yes, calculate length copied
|
||||||
movl %sp@(16),%a1 | store at return location
|
movl 16(%sp),%a1 | store at return location
|
||||||
movl %a0,%a1@
|
movl %a0,(%a1)
|
||||||
Lcsret:
|
Lcsret:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -270,35 +276,35 @@ Lcsret:
|
|||||||
*/
|
*/
|
||||||
ENTRY(copyinstr)
|
ENTRY(copyinstr)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl _C_LABEL(curpcb),%a0 | set fault handler
|
GETCURPCB(%a0) | set fault handler
|
||||||
movl #Lcisfault,%a0@(PCB_ONFAULT)
|
movl #Lcisfault,PCB_ONFAULT(%a0)
|
||||||
movl %sp@(4),%a0 | a0 = fromaddr
|
movl 4(%sp),%a0 | a0 = fromaddr
|
||||||
movl %sp@(8),%a1 | a1 = toaddr
|
movl 8(%sp),%a1 | a1 = toaddr
|
||||||
clrl %d0
|
clrl %d0
|
||||||
movl %sp@(12),%d1 | count
|
movl 12(%sp),%d1 | count
|
||||||
beq Lcistoolong | nothing to copy
|
jeq Lcistoolong | nothing to copy
|
||||||
subql #1,%d1 | predecrement for dbeq
|
subql #1,%d1 | predecrement for dbeq
|
||||||
Lcisloop:
|
Lcisloop:
|
||||||
movsb %a0@+,%d0 | copy a byte
|
movsb (%a0)+,%d0 | copy a byte
|
||||||
movb %d0,%a1@+
|
movb %d0,(%a1)+
|
||||||
dbeq %d1,Lcisloop | decrement low word of count
|
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
|
subil #0x10000,%d1 | decrement high word of count
|
||||||
bcc Lcisloop | more room, keep going
|
jcc Lcisloop | more room, keep going
|
||||||
Lcistoolong:
|
Lcistoolong:
|
||||||
moveq #ENAMETOOLONG,%d0 | ran out of space
|
moveq #ENAMETOOLONG,%d0 | ran out of space
|
||||||
Lcisdone:
|
Lcisdone:
|
||||||
tstl %sp@(16) | length desired?
|
tstl 16(%sp) | length desired?
|
||||||
beq Lcisexit
|
jeq Lcisexit
|
||||||
subl %sp@(4),%a0 | yes, calculate length copied
|
subl 4(%sp),%a0 | yes, calculate length copied
|
||||||
movl %sp@(16),%a1 | store at return location
|
movl 16(%sp),%a1 | store at return location
|
||||||
movl %a0,%a1@
|
movl %a0,(%a1)
|
||||||
Lcisexit:
|
Lcisexit:
|
||||||
movl _C_LABEL(curpcb),%a0 | clear fault handler
|
GETCURPCB(%a0) | clear fault handler
|
||||||
clrl %a0@(PCB_ONFAULT)
|
clrl PCB_ONFAULT(%a0)
|
||||||
rts
|
rts
|
||||||
Lcisfault:
|
Lcisfault:
|
||||||
bra Lcisdone
|
jra Lcisdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copyoutstr(void *from, void *to, size_t maxlen, size_t *lencopied);
|
* copyoutstr(void *from, void *to, size_t maxlen, size_t *lencopied);
|
||||||
@ -309,35 +315,35 @@ Lcisfault:
|
|||||||
*/
|
*/
|
||||||
ENTRY(copyoutstr)
|
ENTRY(copyoutstr)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl _C_LABEL(curpcb),%a0 | set fault handler
|
GETCURPCB(%a0) | set fault handler
|
||||||
movl #Lcosfault,%a0@(PCB_ONFAULT)
|
movl #Lcosfault,PCB_ONFAULT(%a0)
|
||||||
movl %sp@(4),%a0 | a0 = fromaddr
|
movl 4(%sp),%a0 | a0 = fromaddr
|
||||||
movl %sp@(8),%a1 | a1 = toaddr
|
movl 8(%sp),%a1 | a1 = toaddr
|
||||||
clrl %d0
|
clrl %d0
|
||||||
movl %sp@(12),%d1 | count
|
movl 12(%sp),%d1 | count
|
||||||
beq Lcostoolong | nothing to copy
|
jeq Lcostoolong | nothing to copy
|
||||||
subql #1,%d1 | predecrement for dbeq
|
subql #1,%d1 | predecrement for dbeq
|
||||||
Lcosloop:
|
Lcosloop:
|
||||||
movb %a0@+,%d0 | copy a byte
|
movb (%a0)+,%d0 | copy a byte
|
||||||
movsb %d0,%a1@+
|
movsb %d0,(%a1)+
|
||||||
dbeq %d1,Lcosloop | decrement low word of count
|
dbeq %d1,Lcosloop | decrement low word of count
|
||||||
beq Lcosdone | copied null, exit
|
jeq 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
|
jcc Lcosloop | more room, keep going
|
||||||
Lcostoolong:
|
Lcostoolong:
|
||||||
moveq #ENAMETOOLONG,%d0 | ran out of space
|
moveq #ENAMETOOLONG,%d0 | ran out of space
|
||||||
Lcosdone:
|
Lcosdone:
|
||||||
tstl %sp@(16) | length desired?
|
tstl 16(%sp) | length desired?
|
||||||
beq Lcosexit
|
jeq Lcosexit
|
||||||
subl %sp@(4),%a0 | yes, calculate length copied
|
subl 4(%sp),%a0 | yes, calculate length copied
|
||||||
movl %sp@(16),%a1 | store at return location
|
movl 16(%sp),%a1 | store at return location
|
||||||
movl %a0,%a1@
|
movl %a0,(%a1)
|
||||||
Lcosexit:
|
Lcosexit:
|
||||||
movl _C_LABEL(curpcb),%a0 | clear fault handler
|
GETCURPCB(%a0) | clear fault handler
|
||||||
clrl %a0@(PCB_ONFAULT)
|
clrl PCB_ONFAULT(%a0)
|
||||||
rts
|
rts
|
||||||
Lcosfault:
|
Lcosfault:
|
||||||
bra Lcosdone
|
jra Lcosdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kcopy(const void *src, void *dst, size_t len);
|
* kcopy(const void *src, void *dst, size_t len);
|
||||||
@ -351,23 +357,23 @@ Lcosfault:
|
|||||||
*/
|
*/
|
||||||
ENTRY(kcopy)
|
ENTRY(kcopy)
|
||||||
link %a6,#-4
|
link %a6,#-4
|
||||||
movl _C_LABEL(curpcb),%a0 | set fault handler
|
GETCURPCB(%a0) | set fault handler
|
||||||
movl %a0@(PCB_ONFAULT),%a6@(-4) | save old handler first
|
movl PCB_ONFAULT(%a0),-4(%a6) | save old handler first
|
||||||
movl #Lkcfault,%a0@(PCB_ONFAULT)
|
movl #Lkcfault,PCB_ONFAULT(%a0)
|
||||||
movl %a6@(16),%sp@- | push len
|
movl 16(%a6),-(%sp) | push len
|
||||||
movl %a6@(8),%sp@- | push src
|
movl 8(%a6),-(%sp) | push src
|
||||||
movl %a6@(12),%sp@- | push dst
|
movl 12(%a6),-(%sp) | push dst
|
||||||
jbsr _C_LABEL(memcpy) | copy it
|
jbsr _C_LABEL(memcpy) | copy it
|
||||||
addl #12,%sp | pop args
|
addl #12,%sp | pop args
|
||||||
clrl %d0 | success!
|
clrl %d0 | success!
|
||||||
Lkcdone:
|
Lkcdone:
|
||||||
movl _C_LABEL(curpcb),%a0 | restore fault handler
|
GETCURPCB(%a0) | restore fault handler
|
||||||
movl %a6@(-4),%a0@(PCB_ONFAULT)
|
movl -4(%a6),PCB_ONFAULT(%a0)
|
||||||
unlk %a6
|
unlk %a6
|
||||||
rts
|
rts
|
||||||
Lkcfault:
|
Lkcfault:
|
||||||
addl #16,%sp | pop args and return address
|
addl #16,%sp | pop args and return address
|
||||||
bra Lkcdone
|
jra Lkcdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fuword(void *uaddr);
|
* fuword(void *uaddr);
|
||||||
@ -375,11 +381,11 @@ Lkcfault:
|
|||||||
*/
|
*/
|
||||||
ENTRY(fuword)
|
ENTRY(fuword)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl %sp@(4),%a0 | address to read
|
movl 4(%sp),%a0 | address to read
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lferr,%a1@(PCB_ONFAULT)
|
movl #Lferr,PCB_ONFAULT(%a1)
|
||||||
movsl %a0@,%d0 | do read from user space
|
movsl (%a0),%d0 | do read from user space
|
||||||
bra Lfdone
|
jra Lfdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fusword(void *uaddr);
|
* fusword(void *uaddr);
|
||||||
@ -387,12 +393,12 @@ ENTRY(fuword)
|
|||||||
*/
|
*/
|
||||||
ENTRY(fusword)
|
ENTRY(fusword)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl %sp@(4),%a0 | address to read
|
movl 4(%sp),%a0 | address to read
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lferr,%a1@(PCB_ONFAULT)
|
movl #Lferr,PCB_ONFAULT(%a1)
|
||||||
moveq #0,%d0
|
moveq #0,%d0
|
||||||
movsw %a0@,%d0 | do read from user space
|
movsw (%a0),%d0 | do read from user space
|
||||||
bra Lfdone
|
jra Lfdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fuswintr(void *uaddr);
|
* fuswintr(void *uaddr);
|
||||||
@ -401,12 +407,12 @@ ENTRY(fusword)
|
|||||||
*/
|
*/
|
||||||
ENTRY(fuswintr)
|
ENTRY(fuswintr)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl %sp@(4),%a0 | address to read
|
movl 4(%sp),%a0 | address to read
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #_C_LABEL(fubail),%a1@(PCB_ONFAULT)
|
movl #_C_LABEL(fubail),PCB_ONFAULT(%a1)
|
||||||
moveq #0,%d0
|
moveq #0,%d0
|
||||||
movsw %a0@,%d0 | do read from user space
|
movsw (%a0),%d0 | do read from user space
|
||||||
bra Lfdone
|
jra Lfdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fubyte(void *uaddr);
|
* fubyte(void *uaddr);
|
||||||
@ -414,12 +420,12 @@ ENTRY(fuswintr)
|
|||||||
*/
|
*/
|
||||||
ENTRY(fubyte)
|
ENTRY(fubyte)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
movl %sp@(4),%a0 | address to read
|
movl 4(%sp),%a0 | address to read
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lferr,%a1@(PCB_ONFAULT)
|
movl #Lferr,PCB_ONFAULT(%a1)
|
||||||
moveq #0,%d0
|
moveq #0,%d0
|
||||||
movsb %a0@,%d0 | do read from user space
|
movsb (%a0),%d0 | do read from user space
|
||||||
bra Lfdone
|
jra Lfdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error routine for fuswintr. The fault handler in trap.c
|
* Error routine for fuswintr. The fault handler in trap.c
|
||||||
@ -433,7 +439,7 @@ ENTRY(fubail)
|
|||||||
Lferr:
|
Lferr:
|
||||||
moveq #-1,%d0 | error indicator
|
moveq #-1,%d0 | error indicator
|
||||||
Lfdone:
|
Lfdone:
|
||||||
clrl %a1@(PCB_ONFAULT) | clear fault handler
|
clrl PCB_ONFAULT(%a1) | clear fault handler
|
||||||
rts
|
rts
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -442,13 +448,13 @@ Lfdone:
|
|||||||
*/
|
*/
|
||||||
ENTRY(suword)
|
ENTRY(suword)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl %sp@(4),%a0 | address to write
|
movl 4(%sp),%a0 | address to write
|
||||||
movl %sp@(8),%d0 | value to put there
|
movl 8(%sp),%d0 | value to put there
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lserr,%a1@(PCB_ONFAULT)
|
movl #Lserr,PCB_ONFAULT(%a1)
|
||||||
movsl %d0,%a0@ | do write to user space
|
movsl %d0,(%a0) | do write to user space
|
||||||
moveq #0,%d0 | indicate no fault
|
moveq #0,%d0 | indicate no fault
|
||||||
bra Lsdone
|
jra Lsdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* susword(void *uaddr, short x);
|
* susword(void *uaddr, short x);
|
||||||
@ -456,13 +462,13 @@ ENTRY(suword)
|
|||||||
*/
|
*/
|
||||||
ENTRY(susword)
|
ENTRY(susword)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl %sp@(4),%a0 | address to write
|
movl 4(%sp),%a0 | address to write
|
||||||
movw %sp@(10),%d0 | value to put there
|
movw 10(%sp),%d0 | value to put there
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lserr,%a1@(PCB_ONFAULT)
|
movl #Lserr,PCB_ONFAULT(%a1)
|
||||||
movsw %d0,%a0@ | do write to user space
|
movsw %d0,(%a0) | do write to user space
|
||||||
moveq #0,%d0 | indicate no fault
|
moveq #0,%d0 | indicate no fault
|
||||||
bra Lsdone
|
jra Lsdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* suswintr(void *uaddr, short x);
|
* suswintr(void *uaddr, short x);
|
||||||
@ -471,13 +477,13 @@ ENTRY(susword)
|
|||||||
*/
|
*/
|
||||||
ENTRY(suswintr)
|
ENTRY(suswintr)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl %sp@(4),%a0 | address to write
|
movl 4(%sp),%a0 | address to write
|
||||||
movw %sp@(10),%d0 | value to put there
|
movw 10(%sp),%d0 | value to put there
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #_C_LABEL(subail),%a1@(PCB_ONFAULT)
|
movl #_C_LABEL(subail),PCB_ONFAULT(%a1)
|
||||||
movsw %d0,%a0@ | do write to user space
|
movsw %d0,(%a0) | do write to user space
|
||||||
moveq #0,%d0 | indicate no fault
|
moveq #0,%d0 | indicate no fault
|
||||||
bra Lsdone
|
jra Lsdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* subyte(void *uaddr, char x);
|
* subyte(void *uaddr, char x);
|
||||||
@ -485,13 +491,13 @@ ENTRY(suswintr)
|
|||||||
*/
|
*/
|
||||||
ENTRY(subyte)
|
ENTRY(subyte)
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl %sp@(4),%a0 | address to write
|
movl 4(%sp),%a0 | address to write
|
||||||
movb %sp@(11),%d0 | value to put there
|
movb 11(%sp),%d0 | value to put there
|
||||||
movl _C_LABEL(curpcb),%a1 | set fault handler
|
GETCURPCB(%a1) | set fault handler
|
||||||
movl #Lserr,%a1@(PCB_ONFAULT)
|
movl #Lserr,PCB_ONFAULT(%a1)
|
||||||
movsb %d0,%a0@ | do write to user space
|
movsb %d0,(%a0) | do write to user space
|
||||||
moveq #0,%d0 | indicate no fault
|
moveq #0,%d0 | indicate no fault
|
||||||
bra Lsdone
|
jra Lsdone
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error routine for suswintr. The fault handler in trap.c
|
* Error routine for suswintr. The fault handler in trap.c
|
||||||
@ -505,7 +511,7 @@ ENTRY(subail)
|
|||||||
Lserr:
|
Lserr:
|
||||||
moveq #-1,%d0 | error indicator
|
moveq #-1,%d0 | error indicator
|
||||||
Lsdone:
|
Lsdone:
|
||||||
clrl %a1@(PCB_ONFAULT) | clear fault handler
|
clrl PCB_ONFAULT(%a1) | clear fault handler
|
||||||
rts
|
rts
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -517,25 +523,25 @@ Lsdone:
|
|||||||
ENTRY(ucas_32)
|
ENTRY(ucas_32)
|
||||||
CHECK_SFC
|
CHECK_SFC
|
||||||
CHECK_DFC
|
CHECK_DFC
|
||||||
movl _C_LABEL(curpcb),%a1
|
GETCURPCB(%a1)
|
||||||
movl #Lucasfault,%a1@(PCB_ONFAULT) | set fault handler
|
movl #Lucasfault,PCB_ONFAULT(%a1) | set fault handler
|
||||||
movl %sp@(4),%a0 | a0 = uptr
|
movl 4(%sp),%a0 | a0 = uptr
|
||||||
_C_LABEL(ucas_32_ras_start):
|
_C_LABEL(ucas_32_ras_start):
|
||||||
movl %sp@(8),%d0 | d0 = old
|
movl 8(%sp),%d0 | d0 = old
|
||||||
movsl %a0@,%d1 | d1 = *uptr
|
movsl (%a0),%d1 | d1 = *uptr
|
||||||
cmpl %d0,%d1 | does *uptr == old?
|
cmpl %d0,%d1 | does *uptr == old?
|
||||||
bne Lucasdiff | if not, don't change it
|
jne Lucasdiff | if not, don't change it
|
||||||
movl %sp@(12),%d0 | d0 = new
|
movl 12(%sp),%d0 | d0 = new
|
||||||
movsl %d0,%a0@ | *uptr = new
|
movsl %d0,(%a0) | *uptr = new
|
||||||
nop | pipeline sync
|
nop | pipeline sync
|
||||||
_C_LABEL(ucas_32_ras_end):
|
_C_LABEL(ucas_32_ras_end):
|
||||||
Lucasdiff:
|
Lucasdiff:
|
||||||
movl %sp@(16),%a0 | a0 = ret
|
movl 16(%sp),%a0 | a0 = ret
|
||||||
movl %d1,%a0@ | *ret = d1 (old *uptr)
|
movl %d1,(%a0) | *ret = d1 (old *uptr)
|
||||||
clrl %d0 | return 0
|
clrl %d0 | return 0
|
||||||
|
|
||||||
Lucasfault:
|
Lucasfault:
|
||||||
clrl %a1@(PCB_ONFAULT) | clear fault handler
|
clrl PCB_ONFAULT(%a1) | clear fault handler
|
||||||
rts
|
rts
|
||||||
|
|
||||||
STRONG_ALIAS(ucas_int,ucas_32)
|
STRONG_ALIAS(ucas_int,ucas_32)
|
||||||
|
Loading…
Reference in New Issue
Block a user