Comtrol eCos User Manual

Page 349

Advertising
background image

Chapter 11. Porting Guide

The i386 is currently the only architecture that supports SMP. The following CDL simply enabled the HAL SMP
support if required. Generally this will get enabled as a result of a

requires

statement in the kernel. The

requires

statement here turns off lazy FPU switching in the FPU support code, since it is inconsistent with SMP operation.

cdl_component CYGPKG_HAL_SMP_SUPPORT {

display

"SMP support"

default_value 0

requires { CYGHWR_HAL_I386_FPU_SWITCH_LAZY == 0 }

cdl_option CYGPKG_HAL_SMP_CPU_MAX {

display

"Max number of CPUs supported"

flavor

data

default_value 2

}

}

The i386 HAL has optional FPU support, which is enabled by default. It can be disabled to improve system
performance. There are two FPU support options: either to save and restore the FPU state on every context switch,
or to only switch the FPU state when necessary.

cdl_component CYGHWR_HAL_I386_FPU {

display

"Enable I386 FPU support"

default_value 1

description

"This component enables support for the

I386 floating point unit."

cdl_option CYGHWR_HAL_I386_FPU_SWITCH_LAZY {

display

"Use lazy FPU state switching"

flavor

bool

default_value 1

description "

This option enables lazy FPU state switching.

The default behaviour for eCos is to save and

restore FPU state on every thread switch, interrupt

and exception. While simple and deterministic, this

approach can be expensive if the FPU is not used by

all threads. The alternative, enabled by this option,

is to use hardware features that allow the FPU state

of a thread to be left in the FPU after it has been

descheduled, and to allow the state to be switched to

a new thread only if it actually uses the FPU. Where

only one or two threads use the FPU this can avoid a

lot of unnecessary state switching."

}

}

The i386 HAL also has support for different classes of CPU. In particular, Pentium class CPUs have extra func-
tional units, and some variants of GDB expect more registers to be reported. These options enable these features.
Generally these are enabled by

requires

statements in variant or platform packages, or in

.ecm

files.

cdl_component CYGHWR_HAL_I386_PENTIUM {

245

Advertising