forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

setting the "grap_md" bit of the HID1 register

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
scorp



Joined: 09 Oct 2007
Posts: 4

PostPosted: Tue Oct 09, 2007 11:27 pm    Post subject: setting the "grap_md" bit of the HID1 register Reply with quote

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/forums/dw_thread.jsp?forum=739&thread=159326&message=13943054&cat=46&q=grap_md#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:lv1_set_vmx_graphics_mode

so tried with the following asm-code (called by c-function):
Code:
       
        .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
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu Oct 11, 2007 6:20 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
urchin



Joined: 02 Jun 2005
Posts: 121

PostPosted: Thu Oct 11, 2007 3:54 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
ralferoo



Joined: 03 Mar 2007
Posts: 122

PostPosted: Thu Oct 11, 2007 9:43 pm    Post subject: Re: setting the "grap_md" bit of the HID1 register Reply with quote

Code:
       
        li      3,H_EX
        sc      1
should be
Code:

        li 11,H_EX
        li 3,1
        sc      1


As urchin says, -3 is the normal return value from userland.
Quote:

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.
Back to top
View user's profile Send private message Visit poster's website
scorp



Joined: 09 Oct 2007
Posts: 4

PostPosted: Thu Oct 11, 2007 10:34 pm    Post subject: Reply with quote

thx for the replies.

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

        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.
Back to top
View user's profile Send private message
ralferoo



Joined: 03 Mar 2007
Posts: 122

PostPosted: Fri Oct 12, 2007 6:12 am    Post subject: Reply with quote

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/
Back to top
View user's profile Send private message Visit poster's website
scorp



Joined: 09 Oct 2007
Posts: 4

PostPosted: Fri Oct 12, 2007 6:20 am    Post subject: Reply with quote

thx for your help.

i'll check it.
Back to top
View user's profile Send private message
ralferoo



Joined: 03 Mar 2007
Posts: 122

PostPosted: Mon Oct 15, 2007 3:21 am    Post subject: Reply with quote

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/viewvc/python-ps3/bootable/patches/01-hypervisor-panic.patch?revision=479&view=markup
Back to top
View user's profile Send private message Visit poster's website
scorp



Joined: 09 Oct 2007
Posts: 4

PostPosted: Mon Oct 15, 2007 6:50 pm    Post subject: Reply with quote

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:
patch -p1 [patchfile]

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group