<To: rtlinux [EMAIL PROTECTED]>
<Subject: Floating point in "restricted" code>
Thank you, Victor, for the speedy answer!
>> >Can anyone describe a case where it is a good idea to use FP in an init module?
>> >[snip]
>>
>> I observed the following message in the RTLinux list that may help to address
>> this question. I don't know if what Daniela is doing is a "good idea" but
>> there is a reference to a floating point value in the init_module() code below.
>>
>> Daniela: could the floating point reference ("10.0") in your init_module()
>> code be causing the crash? It sounds to me that floating point is not supposed
>> to be used in the init_module() function.
>
>Right. This is a violation of Linux kernel code conventions. Linux assumes that
>FP is _not_ used in kernel mode. RTLinux allows use in RT threads that have asked
>for FP. So moving FP code into a FP enabled thread is fine, doing FP in user mode
>is fine, but FP in Linux kernel mode is not fine. We could make it work, but my
>preference is to not put things into the common code unless there is a demonstrated
>need. So the question is whether it's better to change the application or the
>RTkernel.
To summarize, floating point must not be used in init_module() and
cleanup_module() because these functions are considered "kernel
code".
Under what circumstance is it acceptable to use floating point (FPU) in:
. a interrupt service routine?
. a RT-FIFO handler that is called when a FIFO has data added to it?
(e.g., a FIFO handler function specified rtf_create_handler())
Would it make some sense to provide functions that save/restore the
FPU state so that an RTLinux application developer could use the FPU
in "restricted" places:
init_module() // FPU can't normally be used here
{
FPP_STATE state;
rtl_save_fpp_state(&state); // Preserve FPU state
// Use floating point here
rtl_restore_fpp_state(&state); // Restore FPU state
}
This might make everyone happy:
. RTLinux developers don't need to modify the common RTLinux code
. application developers can use the floating point whereever they want to
(they just need to know when it is important to save/restore the FPU state)
. people not interested in the FPU don't have any additional burden in their
code.
------------------------
Shel Hoffman
Reflective Computing
917 Alanson Dr
St.Louis, MO 63132
(314) 993-6132 voice
(314) 993-3316 fax
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/