![]() |
||
CF68KLib Technical Overview |
||
|
|
How CF68KLib handles Unimplemented 680x0 InstructionsMany 680x0 instructions also exist in ColdFire and use the same opcodes. However, certain opcodes corresponding to legal 680x0 instructions are not valid for ColdFire. A 680x0 opcode may be invalid in ColdFire because it corresponds to an instruction which does not exist - for example ADD.B or RTD. Such opcodes will cause the ColdFire processor to take an 'Illegal Instruction' exception. (A few unimplemented instructions such as MOVE16 cause a line-F exception). Other 680x0 opcodes are invalid because they correspond to instructions which exist in ColdFire but for which the addressing mode specified is invalid. For example the instruction "NEG.L (A0)" would be illegal because the ColdFire version of the NEG instruction only allows a data register as its operand. Such opcodes will cause the ColdFire processor to take an 'Address Error' exception. CF68KLib installs its own routines to handle these exceptions. When an unimplemented 680x0 instruction causes an exception the handler will decode the opcode of the instruction and dispatch to a small subroutine where a series of legal ColdFire instructions achieve an equivalent effect. In the example of "NEG.L (A0)" above, CF68KLib would first decode the opcode to determine that it was a NEG.L instruction. It would then decode the addressing mode to determine that it was (A0). Finally, it would read the operand from (A0), negate it, and write it back, setting the condition bits appropriately before returning to the instruction following the NEG.
How CF68KLib handles Supervisor-Level CodeThe ColdFire supervisor-level architecture is simpler than that of the 680x0 family. For example, ColdFire only has a single stack pointer instead of two for the 68000, (and three for the 68020). Exception stack frames have a different format, and the stack pointer is always aligned to a four-byte boundary before an exception frame is created. These differences mean that without the aid of CF68KLib you could not simply take a 680x0 Operating System - even if it contains only legal ColdFire instructions - and expect it to run on a ColdFire board. The Supervisor Mode form of CF68KLib allows you to run a whole 680x0 operating system under emulation. To do this it surrounds the 680x0 code with an entire 'virtual machine' which hides the differences in architecture. To achieve this CF68KLib uses a number of techniques:
|
Copyright © 1996-2005 MicroAPL Ltd