Brian Stecher
|
Re: The MSR Register in PPC405
|
Brian Stecher
01/12/2009 8:54 AM
post19836
|
Re: The MSR Register in PPC405
Sorry about the tardiness in responding, but I've needed to think
about this one.
The problem is that the MSR register is part of the thread context
and is saved/restored with every thread switch. The bit for controlling
access to the FPU registers is also known the the OS and is manipulated
by it, so you've got the potential for conflict there.
The upside is that you definitely can't set the bit in the BSP code.
Looking at the code, you _may_ be able to get away with creating *one*
thread in the system that uses the FPU. You have to do something like:
#include <ppc/inline.h>
#include <ppc/cpu.h>
// This next call gives you the ability to read/write the MSR.
// You have to be running as userid zero to use it.
ThreadCtl(_NTO_TCTL_IO, 0);
set_msr(get_msr() | PPC_MSR_FP);
... load FP data from static or heap allocated memory and
... do the floating point operations before storing them
... back to static/heap memory. NO loading/storing from locals
... allowed (though you can use them during the operations).
set_msr(get_msr() & ~PPC_MSR_FP);
You also have to make sure that you don't do anything that will cause
a floating point exception or the system will crash.
I haven't tried this, so there maybe a gotcha that I've missed that will
cause it not to work.
Brian
On Mon, Jan 05, 2009 at 08:58:42AM -0500, Vadim Malenboim wrote:
> Brian Hello ,
> I'm modifying the ml410 bsp to work with my customized hardware.
>
> I want to set the FPU Related bits in the register and do it only once at the bsp level not in application.
>
> Because I'm using a kernel that does not support hardware FPU (procnto400) but i do have hardware customized with FPU
support in it.
>
> Hence i want to set the related bits regarding the presence of FPU and the exceptions .
>
> 1.can i do it ?
> 2.do i need to do it in an ISR only ?
> 3.there are functions RDMSR and WRMSR how do i use them ?
>
> Thank you.
> Vadim.
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post19345
>
--
Brian Stecher (bstecher@qnx.com) QNX Software Systems
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8
|
|
|