patch-2.0.21-2.1.0 linux/arch/m68k/ifpsp060/os.S
Next file: linux/arch/m68k/kernel/Makefile
Previous file: linux/arch/m68k/ifpsp060/iskeleton.S
Back to the patch index
Back to the overall index
- Lines: 295
- Date:
Wed Sep 25 10:47:39 1996
- Orig file:
lx2.0/v2.0.21/linux/arch/m68k/ifpsp060/os.S
- Orig date:
Tue Apr 23 17:14:22 1996
diff -u --recursive --new-file lx2.0/v2.0.21/linux/arch/m68k/ifpsp060/os.S linux/arch/m68k/ifpsp060/os.S
@@ -32,6 +32,7 @@
| - example "Call-Out"s required by both the ISP and FPSP.
|
+#include <linux/linkage.h>
|################################
| EXAMPLE CALL-OUTS #
@@ -64,6 +65,10 @@
| The result is that Unix processes are allowed to sleep as a consequence
| of a page fault during a _copyout.
|
+| Linux/68k: The _060_[id]mem_{read,write}_{byte,word,long} functions
+| (i.e. all the known length <= 4) are implemented by single moves
+| statements instead of (more expensive) copy{in,out} calls, if
+| working in user space
|
| _060_dmem_write():
@@ -147,18 +152,12 @@
_060_dmem_read_byte:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmrbs | supervisor
-dmrbu: clr.l -(%sp) | clear space on stack for result
- move.l #0x1,-(%sp) | pass: # bytes to copy
- pea 0x7(%sp) | pass: dst addr (stack)
- move.l %a0,-(%sp) | pass: src addr (user mem)
- bsr.l _copyin | "copy in" the data
- move.l %d0,%d1 | return success
- add.l #0xc,%sp | delete params
- move.l (%sp)+,%d0 | put answer in d0
- rts
+dmrbu: clr.l %d0 | clear whole longword
+ movs.b (%a0),%d0 | fetch user byte
+ bras dmrbr
dmrbs: clr.l %d0 | clear whole longword
move.b (%a0),%d0 | fetch super byte
- clr.l %d1 | return success
+dmrbr: clr.l %d1 | return success
rts
|
@@ -173,22 +172,29 @@
| d0 - data word in d0
| d1 - 0 = success, !0 = failure
|
+| _060_imem_read_word():
+|
+| Read an instruction word from user memory.
+|
+| INPUTS:
+| a0 - user source address
+| 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+| OUTPUTS:
+| d0 - instruction word in d0
+| d1 - 0 = success, !0 = failure
+|
.global _060_dmem_read_word
+ .global _060_imem_read_word
_060_dmem_read_word:
+_060_imem_read_word:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmrws | supervisor
-dmrwu: clr.l -(%sp) | clear space on stack for result
- move.l #0x2,-(%sp) | pass: # bytes to copy
- pea 0x6(%sp) | pass: dst addr (stack)
- move.l %a0,-(%sp) | pass: src addr (user mem)
- bsr.l _copyin | "copy in" the data
- move.l %d0,%d1 | return success
- add.l #0xc,%sp | delete params
- move.l (%sp)+,%d0 | put answer in d0
- rts
+dmrwu: clr.l %d0 | clear whole longword
+ movs.w (%a0), %d0 | fetch user word
+ bras dmrwr
dmrws: clr.l %d0 | clear whole longword
move.w (%a0), %d0 | fetch super word
- clr.l %d1 | return success
+dmrwr: clr.l %d1 | return success
rts
|
@@ -203,21 +209,27 @@
| d0 - data longword in d0
| d1 - 0 = success, !0 = failure
|
+| _060_imem_read_long():
+|
+| Read an instruction longword from user memory.
+|
+| INPUTS:
+| a0 - user source address
+| 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+| OUTPUTS:
+| d0 - instruction longword in d0
+| d1 - 0 = success, !0 = failure
+|
.global _060_dmem_read_long
+ .global _060_imem_read_long
_060_dmem_read_long:
+_060_imem_read_long:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmrls | supervisor
-dmrlu: subq.l #0x4,%sp | clear space on stack for result
- move.l #0x4,-(%sp) | pass: # bytes to copy
- pea 0x4(%sp) | pass: dst addr (stack)
- move.l %a0,-(%sp) | pass: src addr (user mem)
- bsr.l _copyin | "copy in" the data
- move.l %d0,%d1 | return success
- add.l #0xc,%sp | delete params
- move.l (%sp)+,%d0 | put answer in d0
- rts
+dmrlu: movs.l (%a0),%d0 | fetch user longword
+ bras dmrlr
dmrls: move.l (%a0),%d0 | fetch super longword
- clr.l %d1 | return success
+dmrlr: clr.l %d1 | return success
rts
|
@@ -236,16 +248,10 @@
_060_dmem_write_byte:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmwbs | supervisor
-dmwbu: move.l %d0,-(%sp) | put src on stack
- move.l #0x1,-(%sp) | pass: # bytes to copy
- move.l %a0,-(%sp) | pass: dst addr (user mem)
- pea 0xb(%sp) | pass: src addr (stack)
- bsr.l _copyout | "copy out" the data
- move.l %d0,%d1 | return success
- add.l #0x10,%sp | delete params + src
- rts
+dmwbu: movs.b %d0,(%a0) | store user byte
+ bras dmwbr
dmwbs: move.b %d0,(%a0) | store super byte
- clr.l %d1 | return success
+dmwbr: clr.l %d1 | return success
rts
|
@@ -264,16 +270,10 @@
_060_dmem_write_word:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmwws | supervisor
-dmwwu: move.l %d0,-(%sp) | put src on stack
- move.l #0x2,-(%sp) | pass: # bytes to copy
- move.l %a0,-(%sp) | pass: dst addr (user mem)
- pea 0xa(%sp) | pass: src addr (stack)
- bsr.l _copyout | "copy out" the data
- move.l %d0,%d1 | return success
- add.l #0x10,%sp | delete params + src
- rts
+dmwwu: movs.w %d0,(%a0) | store user word
+ bras dmwwr
dmwws: move.w %d0,(%a0) | store super word
- clr.l %d1 | return success
+dmwwr: clr.l %d1 | return success
rts
|
@@ -292,75 +292,12 @@
_060_dmem_write_long:
btst #0x5,0x4(%a6) | check for supervisor state
bnes dmwls | supervisor
-dmwlu: move.l %d0,-(%sp) | put src on stack
- move.l #0x4,-(%sp) | pass: # bytes to copy
- move.l %a0,-(%sp) | pass: dst addr (user mem)
- pea 0x8(%sp) | pass: src addr (stack)
- bsr.l _copyout | "copy out" the data
- move.l %d0,%d1 | return success
- add.l #0x10,%sp | delete params + src
- rts
+dmwlu: movs.l %d0,(%a0) | store user longword
+ bra dmwlr
dmwls: move.l %d0,(%a0) | store super longword
- clr.l %d1 | return success
- rts
-
-|
-| _060_imem_read_word():
-|
-| Read an instruction word from user memory.
-|
-| INPUTS:
-| a0 - user source address
-| 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-| OUTPUTS:
-| d0 - instruction word in d0
-| d1 - 0 = success, !0 = failure
-|
- .global _060_imem_read_word
-_060_imem_read_word:
- btst #0x5,0x4(%a6) | check for supervisor state
- bnes imrws | supervisor
-imrwu: clr.l -(%sp) | clear space on stack for result
- move.l #0x2,-(%sp) | pass: # bytes to copy
- pea 0x6(%sp) | pass: dst addr (stack)
- move.l %a0,-(%sp) | pass: src addr (user mem)
- bsr.l _copyin | "copy in" the data
- move.l %d0,%d1 | return success
- add.l #0xc,%sp | delete params
- move.l (%sp)+,%d0 | put answer in d0
- rts
-imrws: move.w (%a0),%d0 | fetch super word
- clr.l %d1 | return success
+dmwlr: clr.l %d1 | return success
rts
-|
-| _060_imem_read_long():
-|
-| Read an instruction longword from user memory.
-|
-| INPUTS:
-| a0 - user source address
-| 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-| OUTPUTS:
-| d0 - instruction longword in d0
-| d1 - 0 = success, !0 = failure
-|
- .global _060_imem_read_long
-_060_imem_read_long:
- btst #0x5,0x4(%a6) | check for supervisor state
- bnes imrls | supervisor
-imrlu: subq.l #0x4,%sp | clear space on stack for result
- move.l #0x4,-(%sp) | pass: # bytes to copy
- pea 0x4(%sp) | pass: dst addr (stack)
- move.l %a0,-(%sp) | pass: src addr (user mem)
- bsr.l _copyin | "copy in" the data
- move.l %d0,%d1 | return success
- add.l #0xc,%sp | delete params
- move.l (%sp)+,%d0 | put answer in d0
- rts
-imrls: move.l (%a0),%d0 | fetch super longword
- clr.l %d1 | return success
- rts
|###############################################
@@ -369,6 +306,10 @@
| Assumes that D0/D1/A0/A1 are scratch registers. The _copyin/_copyout
| below assume that the SFC/DFC have been set previously.
|
+| Linux/68k: These are basically non-inlined versions of
+| memcpy_{to,from}fs, but without long-transfer optimization
+| Note: Assumed that SFC/DFC are pointing correctly to user data
+| space... Should be right, or are there any exceptions?
|
| int _copyout(supervisor_addr, user_addr, nbytes)
@@ -378,11 +319,12 @@
move.l 4(%sp),%a0 | source
move.l 8(%sp),%a1 | destination
move.l 12(%sp),%d0 | count
+ subq.l #1,%d0
moreout:
move.b (%a0)+,%d1 | fetch supervisor byte
movs.b %d1,(%a1)+ | store user byte
- subq.l #0x1,%d0 | are we through yet?
- bne moreout | no; so, continue
+ dbra %d0,moreout | are we through yet?
+ moveq #0,%d0 | return success
rts
|
@@ -393,11 +335,13 @@
move.l 4(%sp),%a0 | source
move.l 8(%sp),%a1 | destination
move.l 12(%sp),%d0 | count
+ subq.l #1,%d0
morein:
movs.b (%a0)+,%d1 | fetch user byte
move.b %d1,(%a1)+ | write supervisor byte
subq.l #0x1,%d0 | are we through yet?
- bne morein | no; so, continue
+ dbra %d0,morein | are we through yet?
+ moveq #0,%d0 | return success
rts
|###########################################################################
@@ -413,7 +357,7 @@
|
.global _060_real_trace
_060_real_trace:
- rte
+ bral SYMBOL_NAME(trap)
|
| _060_real_access():
@@ -429,4 +373,4 @@
|
.global _060_real_access
_060_real_access:
- rte
+ bral SYMBOL_NAME(buserr)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov