Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - The MSR Register in PPC405: (7 Items)
   
The MSR Register in PPC405  
I'm using the procnto400 microkernel.
1.I would like to know what is done in this kernel regarding the MSR register ?
1.How can i get/set this register after the kernel loaded (is this possible ) ?
Re: The MSR Register in PPC405  
On Thu, Jan 01, 2009 at 02:59:53AM -0500, Vadim Malenboim wrote:
> I'm using the procnto400 microkernel.
> 1.I would like to know what is done in this kernel regarding the MSR register ?
> 1.How can i get/set this register after the kernel loaded (is this possible ) ?

It's not a good idea for user code to play with this register (and the
OS prevents you from doing so for the most part) since you can bring down
the system if you're not careful. Can you explain why you want to get/set
it?

	Brian

-- 
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
Re: The MSR Register in PPC405  
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.
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
Re: The MSR Register in PPC405  
Hi Thank you for the information.
after doing the set_msr with FPU and trying to do simple calculation the systems just freezes.
No error messages or exception received.

ThreadCtl(_NTO_TCTL_IO, 0);

set_msr(get_msr() | PPC_MSR_FP);
 
    time = (float)(stop.tv_nsec-start.tv_nsec)/1e9; --> freezing point

What might be the problem ? 
Re: The MSR Register in PPC405  
I'm at a loss on this one. The only thing that I can think of is that
the FPU context is in a random state that caused an exception when
you tried to use it, but I can't see why you wouldn't get a signal
of some kind dropped on the process rather than a hang.

	Brian

On Thu, Jan 22, 2009 at 01:13:11AM -0500, Vadim Malenboim wrote:
> Hi Thank you for the information.
> after doing the set_msr with FPU and trying to do simple calculation the systems just freezes.
> No error messages or exception received.
> 
> ThreadCtl(_NTO_TCTL_IO, 0);
> 
> set_msr(get_msr() | PPC_MSR_FP);
>  
>     time = (float)(stop.tv_nsec-start.tv_nsec)/1e9; --> freezing point
> 
> What might be the problem ? 
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post20557
> 

-- 
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
Re: The MSR Register in PPC405  
Hi,

I am attempting to do the exact same thing, with the ML507 BSP & the procnto-booke microkernel.

Does the -booke micro-kernel suffer from the same limitations, or does it support FPU ?

I assume it does not support a h/w FPU, since I also found this post

http://community.qnx.com/sf/discussion/do/listPosts/projects.bsp/discussion.bsp.topc3605

that post mentions a patch '632-0438'.   where can i download this patch?