setting the "grap_md" bit of the HID1 register

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
scorp
Posts: 4
Joined: Tue Oct 09, 2007 10:52 pm

setting the "grap_md" bit of the HID1 register

Post by scorp »

hi

I do a scientific work with the ps3.
For this reason i have to enable the "graphics rounding mode" that configures the VMX unit to produce results equivalent in precision to the SPE.

see: http://www-128.ibm.com/developerworks/f ... d#13943054

So i tried to do this with the example of the Programming Handbook page 349 and the wiki http://wiki.ps2dev.org/ps3:hypervisor:l ... phics_mode

so tried with the following asm-code (called by c-function):

Code: Select all

        
        .set        H_EX, 97
        .align      3
        .globl      hcall_graph_mode
        
hcall_graph_mode:
        std     3,-8(1)
        li      3,H_EX
        sc      1
        ld      12,-8(1)
        cmpi    0,12,0
        std     4,(0 * 8)(12)
        blr
but i get as return-value: -20 = LV1_NOT_IMPLEMENTED

could anyone help me or post a asm-function that will set graphics rounding mode?

thx
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I'm confused... why are you using inline asm rather than just calling lv1_set_vmx_graphics_mode directly? Are you trying to do this from userspace? I don't think that will work.
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

Trying to call hypervisor functions from userspace should result in a return code of LV1_NO_PRIVILEGE (-3). You'll need to call the hypervisor function from a kernel module (called by your userspace program) for the call to be allowed.
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Re: setting the "grap_md" bit of the HID1 register

Post by ralferoo »

Code: Select all

        
        li      3,H_EX
        sc      1
should be

Code: Select all

        li 11,H_EX
        li 3,1
        sc      1
As urchin says, -3 is the normal return value from userland.
but i get as return-value: -20 = LV1_NOT_IMPLEMENTED
Probably because r11 is set to some random value and that function isn't implemented.
scorp
Posts: 4
Joined: Tue Oct 09, 2007 10:52 pm

Post by scorp »

thx for the replies.

yes,i tried to call the hypervisor from userland and got with correct call

Code: Select all

        li 11,H_EX
        li 3,1
        sc      1 
also the return value: -3

So i think i have to do it from a kernel module like you said.

I've never wrote such a kernel module. Does anyone have one, which a can use / rewrite to my function?

I will try to find out myself also.
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

scorp wrote:I've never wrote such a kernel module. Does anyone have one, which a can use / rewrite to my function?
A good example of adding a pseudo-file to /proc is at http://www.captain.at/programming/kernel-2.6/
scorp
Posts: 4
Joined: Tue Oct 09, 2007 10:52 pm

Post by scorp »

thx for your help.

i'll check it.
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

scorp wrote:I've never wrote such a kernel module. Does anyone have one, which a can use / rewrite to my function?
I know I sent you an example before, but to solve a similar problem I knocked up a quick module module as a patch. I've commented out the vmx_graphics stuff in this example because you'll need to add it to lv1call.h, and I didn't actually need it for what I was doing. But, it's pretty much a case of uncommenting and adding the appropriate definition to lv1call.h.
http://python-ps3.svn.sourceforge.net/v ... iew=markup
scorp
Posts: 4
Joined: Tue Oct 09, 2007 10:52 pm

Post by scorp »

I have the Kernelversion: 2.6.16-20061110.ydl.2ps3, but if i include <lv1call.h> the compiler use the header from the version /2.6.16-20070425.ydl.3ps3.

Do i have to update the kernel first to use your patch?

How do i install such a kernel patch ? I think you have to run

Code: Select all

patch -p1 &#91;patchfile&#93;

in /usr/scr/linux -> ydl: /usr/src/yellowdog ?

Sorry, my linux knowledge isn't very good, cause i had to use it only to develop some c-code. I don't want to do things which crash or detroy the system due to my unexperience.
Post Reply