Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Real Mode, Large Model with Hardware Floating-Point Support

This chapter section describes how µC/OS-II has been ported to the Intel 80x86 series of processors that provides a Floating-Point Unit (FPU). Some of the processors that can make use of this port are the Intel 80486™, Pentiums™ (all models), Xeon™, AMD Athlon™, K6™-series, ElanSC520™ and more. The port assumes the Borland C/C++ compiler V4.51 and was setup to generate code for the large memory model. The processor is assumed to be running in real mode. The code for this port is very similar to the one presented in Chapter 14 and in some cases, I will only be presenting the differences.

...

Figure 15.1 shows the programming model of an 80x86 processor running in real mode. The integer registers are identical to those presented in Chapter 14. In fact, they are saved and restored using the same technique. The only difference between this port and the one presented in Chapter 14 is that we also need to save and restore the FPU registers which is done by using the context switch hook functions.Figure 15.1 80x86 real-mode register model.

 

Development Tools

As with Chapter 14, I used the Borland C/C++ V4.51 compiler along with the Borland Turbo Assembler for porting and testing. This compiler generates reentrant code and provides in-line assembly language instructions that can be inserted in C code. The compiler can be directed to generate code specifically to make use of the FPU. I tested the code on a 300 MHz Pentium-II-based computer running the Microsoft Windows 2000 operating system. In fact, I configured the compiler to generate a DOS executable which was run in a DOS window.

...

Table 15.1, Compiler options used to compile port and examples.

Option (i.e., setting)Description
-1Generate 80186 code
-BCompile and call assembler
-cCompiler to .OBJ
-dMerge duplicate strings
-f287Use FPU hardware instructions
-GSelect code for speed
-IPath to compiler include files is C:\BC45\INCLUDE
-k-Standard stack frame
-LPath to compiler libraries is C:\BC45\LIB
-mlLarge memory model
-N-Do not check for stack overflow
-n..\objPath where to place object files is ..\OBJ
-OOptimize jumps
-ObDead code elimination
-OeGlobal register allocation
-OgOptimize globally
-OiExpand common intrinsic functions inline
-OlLoop optimization
-OmInvariant code motion
-OpCopy propagation
-OvInduction variable
-vSource debugging ON
-viTurn inline expansion ON
-wproError reporting: call to functions with no prototype
-ZSuppress redundant loads

Table 15.2 shows the Borland Turbo Assembler V4.0 options (i.e., flags) supplied on the command line. These settings were used to assemble OS_CPU_A.ASM.

Table 15.2, Assembler options used to assemble .ASM files.

Option (i.e., setting)Description
/MXCase sensitive on globals
/ZIFull debug info
/OGenerate overlay code

Directories and Files

The installation program provided on the companion CD installs the port for the Intel 80x86 (real mode, large model with FPU support) on your hard disk. The port is found under the:

...