MC68060 Software Package
MOTOROLA
M68060 USER’S MANUAL
C-23
appropriately upon subroutine return. The floating-point address register (FPIAR) is unde-
fined.
This module contains no operating system dependencies. There is no call-out dispatch
table. To report an exception, the emulation routine uses the FPCR exception enable byte
to determine whether or not to report an exception. If the exception is enabled, the exception
is forced using implemented floating-point instructions.
For instance, if the instruction being emulated should cause a floating-point OPERR excep-
tion, then the library routine, as its last instruction, executes an FMUL of a zero and infinity
to force an OPERR exception. Although the exception stack frame will not point to the cor-
rect instruction, the user can record that such an event occurred.
C.4 OPERATING SYSTEM DEPENDENCIES
When porting the unimplemented integer, full or partial floating-point kernel modules, some
routines need to be written outside and are not provided by the M68060SP.
C.4.1 Instruction and Data Fetches
In traditional UNIX systems, portability is promoted by the abstracting of reads/writes from
and to user space into calls to the routines _copyin and _copyout see Table C-5. The
MC68040FPSP provided one higher level of abstraction with the routines _mem_read and
_mem_write. These routines were a superset of the UNIX routines in that they handled both
user and supervisor accesses Figure C-10.
This approach provided a high degree of portability for the MC68040FPSP. The installer
simply had to replace the references to _copy{in,out} in _mem_{read,write} with the host
operating system’s (UNIX or non-UNIX) corresponding calls. In addition, any pre-processing
necessary before a potential read/write fault (user or supervisor) was confined to these rou-
tines. As a result, several operating system types could be supported with only minor mod-
ifications.
Table C-5. UNIX Operating System Calls
Function Call
Parameters
copyin
(user_addr, super_addr, nbytes)
copyout
(super_addr, user_addr, nbytes)
void mem_read(src_addr, dst_addr, nbytes) {
if (SR[supervisor_bit]) {
/* supervisor mode */
while (nbytes--) {
mem[dst_addr+nbytes] = mem[src_addr+nbytes];
}
}
else /* user mode */
_copyin(src_addr, dst_addr, nbytes);
Figure C-10. _mem_read Pseudo-Code