hal-i386-pc-19991028.html
Release notes for hal-i386-pc-19991028.tgz
Patrick O'Grady
patrick@plasticgrape.com
Introduction
This release includes much better interrupt handling code, fixes problems preempting threads running at the same priorities, and includes support for multithreaded floating point. As before, this code is for use with the 'current' eCos source tree. The release is in ftp://sourceware.cygnus.com/pub/ecos/contrib/hal/i386/hal-i386-pc-19991028.tgz. Be sure to look at ftp://sourceware.cygnus.com/pub/ecos/contrib/hal/i386/hal-i386-pc-19991022.html for installation instructions.
Enhancements and fixes
- Interrupt handling code The current version of the interrupt handling code supports a much simpler interrupt handler stub and calls the ISR and DSR (via interrupt_end) directly in the assembly code itself. That code has been moved from hal_intr.c to vectors.S. The interrupt handler automatically handles EOI messages to the interrupt controller, so HAL_ACKNOWLEGE_INTERRUPT is now defined as blank. I did this so that an interrupt handler doesn't have to include whatever file defines HAL_ACKNOWLEGE_INTERRUPT, allowing a slightly more generic interrupt service routine. If anyone disagrees with this, I'm open to changing it back.
- Thread preemption The new interrupt service routine fixes a problem when preempting threads--I didn't really understand exactly how eCos switches contexts within the ISR until now. All of the kernel thread test programs now work--thread2 didn't work before.
- Multithreaded floating point
The code implements the 'lazy' floating point switching, but is only tested
on a '486 system which has math hardware--this may not work on systems where
the floating point is emulated. Anyone interested in testing this?
The code works by setting the TS bit in CR0 during every task switch--when this
bit (the 'task switched' bit) is set, any floating point instruction will generate
a 'device not available' interrupt (IRQ7). The HAL keeps track of the task ID
for whoever had the last math coprocessor context, if the thread context is
changed, then the math state is saved at the *beginning* (lowest address) of that
task's stack. Finally, the current task's math state is loaded into the
coprocessor, and everything continues as though nothing really happened...
Each floating point context requires 108 bytes.
Note that floating point is therefore supported in threads, but not in ISRs or
DSRs. We could add the support to save in a special buffer for DSRs, but I'm
pretty certian that supporting it in ISRs won't ever happen.
File list
Here are the components in the archive, representing those files changed from the current eCos source tree:
packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_ram.ldi packages/hal/i386/pc/current/include/pkgconf/hal_i386_pc.h packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_floppy.ldi packages/hal/i386/pc/current/include/pkgconf/mlt_i386_pc_ram.mlt packages/hal/i386/pc/current/include/hal_diag.h packages/hal/i386/pc/current/include/var_intr.h packages/hal/i386/pc/current/include/plf_intr.h packages/hal/i386/pc/current/include/plf_stub.h packages/hal/i386/pc/current/include/variant.inc packages/hal/i386/pc/current/include/plf_misc.h packages/hal/i386/pc/current/include/platform.inc packages/hal/i386/pc/current/ChangeLog packages/hal/i386/pc/current/src/PKGconf.mak packages/hal/i386/pc/current/src/hal_diag.c packages/hal/i386/pc/current/src/hal_startup.c packages/hal/i386/pc/current/src/var_misc.c packages/hal/i386/pc/current/src/plf_misc.c packages/hal/i386/pc/current/src/plf_stub.c packages/hal/i386/arch/current/include/arch.inc packages/hal/i386/arch/current/include/i386_stub.h packages/hal/i386/arch/current/src/i386_stub.c packages/hal/i386/arch/current/src/hal_intr.c packages/packages packages/targets packages/hal/common/current/src/stubrom/PKGconf.mak packages/hal/common/current/tests/intr.c packages/hal/i386/arch/current/include/hal_arch.h packages/hal/i386/arch/current/include/hal_intr.h packages/hal/i386/arch/current/src/PKGconf.mak packages/hal/i386/arch/current/src/context.S packages/hal/i386/arch/current/src/hal_misc.c packages/hal/i386/arch/current/src/vectors.S packages/pkgconf/makevarsKnown problems/Stuff to do
- See ftp://sourceware.cygnus.com/pub/ecos/contrib/hal/i386/hal-i386-pc-19991022.html for known problems from last time--this update really only fixes the floating point context problem.
- I crash when running 'tm_basic', during mutex operations. Since it doesn't crash the same way every time, I'm guessing that there is some kind of bug in the interrupt handler. However, I've been running several tests where I get interrupted continuously from an analog input board, use several tasks with floating point, and a couple other threads--this test program ran all last week with no problems. kinda can't wait to post the tm_basic results--it's very telling about the performance differences between the various CPU archetectures...