|
| Each IO routine checks to see if the memory write/read is to/from user
| or supervisor application space. The examples below use simple "move"
| instructions for supervisor mode applications and call _copyin()/_copyout()
| for user mode applications.
| When installing the 060SP, the _copyin()/_copyout() equivalents for a
| given operating system should be substituted.
|
| The addresses within the 060SP are guaranteed to be on the stack.
| 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():
|
| Writes to data memory while in supervisor mode.
|
| INPUTS:
| a0 - supervisor source address
| a1 - user destination address
| d0 - number of bytes to write
| 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
| OUTPUTS:
| d1 - 0 = success, !0 = failure
|
.global _060_dmem_write
_060_dmem_write:
subq.l #1,%d0
btst #0x5,0x4(%a6) | check for supervisor state
beqs user_write
super_write:
move.b (%a0)+,(%a1)+ | copy 1 byte
dbra %d0,super_write | quit if --ctr < 0 clr.l %d1 | return success
rts
user_write:
move.b (%a0)+,%d1 | copy 1 byte
copyoutae:
movs.b %d1,(%a1)+
dbra %d0,user_write | quit if --ctr < 0 clr.l %d1 | return success
rts
|
| Use these routines if your kernel doesn't have _copyout/_copyin equivalents.
| 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)
|
.global _copyout
_copyout:
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
copyoutae:
movs.b %d1,(%a1)+ | store user byte
dbra %d0,moreout | are we through yet?
moveq #0,%d0 | return success
rts
|
| _060_real_trace():
|
| This is the exit point for the 060FPSP when an instruction is being traced
| and there are no other higher priority exceptions pending for this instruction
| or they have already been processed.
|
| The sample code below simply executes an "rte".
|
.global _060_real_trace
_060_real_trace:
bral trap
|
| _060_real_access():
|
| This is the exit point for the 060FPSP when an access error exception
| is encountered. The routine below should point to the operating system
| handler for access error exceptions. The exception stack frame is an
| 8-word access error frame.
|
| The sample routine below simply executes an "rte" instruction which
| is most likely the incorrect thing to do and could put the system
| into an infinite loop.
|
.global _060_real_access
_060_real_access:
bral buserr
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.