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 

Unaligned memory access

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



Joined: 02 Oct 2004
Posts: 7

PostPosted: Thu Aug 04, 2005 8:55 am    Post subject: Unaligned memory access Reply with quote

How can I tell compiler to use "lwr/lwl" and "swr/swl" pairs instead of single "lw" and "sw" operations? I'd like to force compiler to generate those instructions for specified pointers. Is it possible ?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Aug 10, 2005 8:12 am    Post subject: Reply with quote

Those are patented instructions and shouldn't be used. Use of those instructions could open you to patent license issues with MIPS (the company). They tend to be pretty pissy about the patent as well.
Back to top
View user's profile Send private message AIM Address
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed Aug 10, 2005 8:36 am    Post subject: Reply with quote

I don't understand how an opcode can be patented and unavailable for use.
Back to top
View user's profile Send private message Visit poster's website
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Wed Aug 10, 2005 3:15 pm    Post subject: Reply with quote

GCC will automatically have the assembler generate lwl, etc. for any unaligned accesses within a struct or union.

J.F.'s confused, the patent is for competing processors, not for MIPS CPUs that already support lwl and friends.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Aug 11, 2005 4:09 am    Post subject: Reply with quote

The patent covers the implementation of the instruction. As such, no third party can make similar instructions. That much is established in several court cases. Another court case established that an emulator violated the patent by having software versions of those instructions, even though the emulator didn't implement the instructions the same way as in the patent. Given the scope the courts have allowed the MIPS patent and MIPS aggressive litigation on it, I'm not about to say that simply USING the instructions doesn't also require a license. Remember that patents don't just cover the MAKING of an invention but the USAGE of the invention as well. Unlicensed use of a patented invention is a violation. In this case, the invention is the patented instructions.
Back to top
View user's profile Send private message AIM Address
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Aug 11, 2005 4:46 am    Post subject: Reply with quote

Regardless of what you are blabbering about it's perfectly legal to use lwl/swl and lwr/swr on the PS1, PS2, PSP, and any other MIPS-based CPU that supports them. A company that licenses MIPS technology wouldn't implement those instructions if developers couldn't use them. That's silly.

With all that patent nonsense you didn't even bother to answer the guy's question.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Aug 18, 2005 5:39 am    Post subject: Reply with quote

Given the flood of patent suits in the US, it's a perfectly valid line of reasoning that could only be answered for sure by a patent attourney. But MrBrown is right - it can probably be ignored by most folks.

As to the question - it's silly on the face of it. Look in ANY MIPS manual and you'll find the answer as well as example code.
Back to top
View user's profile Send private message AIM Address
Rk



Joined: 11 Aug 2005
Posts: 17

PostPosted: Thu Aug 18, 2005 11:23 am    Post subject: Reply with quote

i'm still new to PS2 programming, but can't you simply use assembly code for that patch ? (by patch i mean part of code that you need compiled differently) just write it in ASM and it should turn out ok... it's funny tho, the assembly language is the only universal language... no matter which compiler you use - it all comes to that, and even your fridge and TV and those little christmass music cards use assembly (altho embed in a single chip, but non-the-less)... isn't it cool to be a programmer or what ?:)))
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Aug 25, 2005 1:07 pm    Post subject: Reply with quote

I always preferred working in assembly language myself. You always know EXACTLY what the CPU is doing. Some things require a LITTLE more work, but I think it's worth the trade off.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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