Page 1 of 2
Official GCC support?
Posted: Sat Nov 13, 2004 5:15 pm
by soks
Just wondering, the PS2 ELF patches that are applied to GCC, are they comparable to simply adding more support for GCC (the thing goes on like 16 platforms), I mean, if it's all stable and nice, would it be add-onable to the stable or something...
...maybe it's late and I'm drunk, wait I don't drink...
Posted: Sat Nov 13, 2004 11:44 pm
by mharris
Has anyone ever submitted the patches to the GCC Steering Committee?
I'm sure they'll want to make sure the patches apply to the latest version of GCC (currently 3.4.3). And they're apparently working on GCC 4.0 now, for release in early 2005, so we'll need to make sure the patches work with this release too...
There's some information at the
Contributing to GCC page.
Posted: Sun Nov 14, 2004 12:43 am
by pixel
Actually.... the EE can run plain bare 32 bits mips. That is, if you set up gcc as a r3000 compiler (the same processor as the IOP), and ask it to produce code for the EE, it should work (theorically). The r5900 specific patches are (not exhaustive): (correct me if I am wrong, there's so much mess in the gcc... :P )
-) support for the weired cop1 (fpu)
-) support for the mult1 instruction second mult pipeline
-) adding nops to loops, in order to avoid debugging problems with "loops too short"
-) support for 128 bits (mode TI) and maybe other "int size"
-) support for some mmi instructions to help some int computations.
Now, apart of the 128 bits issue, if you are using plain "int code", a standard r3000 compiler should work. That's like having a 386 compiler that generates code that runs on a brand new athlon XP processor. It will run, but won't really be optimised for the processor you're using. gcc will add code to simulate floats for example, since it will think there's no float support, etc...
Well, I'd need to give it a try. That is, to take the latest gcc, make it target the r3000 processor, and compile some code, just to see what happens ;)
Posted: Sun Nov 14, 2004 2:35 am
by Drakonite
Woo! Way to dodge the question pixel!
Posted: Sun Nov 14, 2004 3:16 am
by mrbrown
The patches are very far from being "clean enough" for inclusion into GCC.
But it's not so bad, because even though Sony's GCC 3.2 patches are better than ours, theirs would stand even less a chance of being included, as they completely hacked up their tree from what Redhat gave them.
Posted: Sun Nov 14, 2004 3:23 am
by ooPo
I used to pester people about this. The answer I got mainly is that gnu has many hoops to jump through and was generally uninterested. I may be wrong, though... I was just glad to finally have a working gcc-3.x port so I didn't push it too much. :)
Don't let their unofficial status fool you, though. Compared to other unofficial ports the PS2 patches are very top notch and full of good work.
Posted: Sun Nov 14, 2004 3:24 am
by ooPo
I knew when I stepped away in mid-post for a few minutes you'd sneak in and do that!
Posted: Sun Nov 14, 2004 3:35 am
by mharris
ooPo wrote:Don't let their unofficial status fool you, though. Compared to other unofficial ports the PS2 patches are very top notch and full of good work.
True -- an outstanding job by all.
Not sure what 'official' status would buy us anyhow, other than the additional support headaches of making sure that future versions of GCC still worked...
Posted: Sun Nov 14, 2004 4:11 am
by mrbrown
Our patches are very good, don't get me wrong - but Sony has pipelining tricks, MMI and VU0 instrinsics and a lots of other niceties. I would love to integrate them into our stuff, but I can never find the time to work on them, *sigh*.
Posted: Sun Nov 14, 2004 12:45 pm
by soks
I never thought about Sony and GCC, they had to release their own version didn't they... so that generates ELF's that can only be run through PS2 Linux right? I'm completely lost on this one, wait... now I'm really lost... compilers make code... and that's machine code for the platform... so the OS does what? it interperets something in the executable, what is it? like what keeps DOS executable from linux, is it that the files ... umm... can't we just use Sony's GCC to make PS2 ELF's?
I'm sorry, please explain because I got lost... oh dear.
Let me rephrase something here, how does GCC generate code? I mean if I run GCC to make a executable on Linux it uses i386 (or some 86), so... what if I want to make GCC generate netBSD executable, it's the same architecture, so... how would I do this on a Linux box? (make BSD code)... hey... umm.. maybe I'm asking too much... but I just realized that I DON'T in anyway understand something very important in code compiling.
"and ask it to produce code for the EE," O_O I thought you said EE can run mips code, so what you mean by that statement, how can GCC "" do that?[/quote]
Posted: Sun Nov 14, 2004 10:22 pm
by pixel
You seem to be a little bit overheating there. Okay, so...
A "toolchain" is composed of several parts. Two big parts have to be noted: the "binutils" package, and the "gcc" package. "gcc" is responsible for turning C code to ASM code. "binutils" is responsible for turning the ASM code into ".o" files (or "relocatable files") AND for linking the .o files into a final file, called "binary". So, roughly, (I really say roughly, because there are details which are actually differing in reality) if you take a linux-i386-gcc and a mingw32-i386-gcc (that is, a windows-gcc), they will both generate the same "ASM" code. What WILL differ is the final linking stage, that is, the "linux-i386-ld" will produce elf files, and the "mingw32-i386-ld" will produce exe files. And that comes from binutils.
Now, about execution. What an OS provide is something easy: syscalls. Any OS around will provide syscalls to binaries, that is, a way to call kernel's functions. That's for example like this that you can ask the PS2 to initialise the graphical synthesizer, or ask windows to format your harddrive. And the PS2 kernel handles ELF files. (you have to understand that an ELF file contains flags and info telling which is the targetted processor-type) Now, the file format isn't quite important here. What's important is the syscall list. That is, when you are coding, you will do some C-calls, like ResetEE(), or SetGsCrt(). These functions are actually syscalls. They resides into the library libsyscall.a into the ps2sdk. So, when you link your ELF file, these functions will get linked into your binary. And, basicallly, they are doing the difference between the PS2-Linux kernel, and the native-PS2 kernel: syscalls between the two are NOT the same. Even if both are using ELF files, they are not exchangables.
Posted: Sun Nov 14, 2004 11:00 pm
by soks
Oh, fuck, so there is a kernel on the hardware... I didn't know that... I thought the libraries compiled to something that directly controls the hardware.
Now what you say is this, the ASM really means nothing then, it's just code ready to be done by a processor and the linker handles that info and turns it into something the OS (kernel... eheh) can understand, so this means GCC does NOT come with a linker? it is MY job to provide it correct? (can't believe I didn't realize this, I setup LFS and didn't realize this). So... when someone said compiled MIPS should run on EE he meant GCC MIPS but PS2'ed-ld right (binutils+ps2dev patch)? Please say I'm right... (#2)
Anyways my main misunderstanding was ASM->linker->syscalls, I thought it was "wierd something"->linker->ASM and then the kernel interpreted it somehow... so thank you for clearing that up. Umm.. if someone can just read that second paragraph and reply with "#2, correct" I would be so happy I might just crap my pants.
As for a syscalls comment... yeah, I learned about those plenty w/ linux drivers and sysmap and all sorts of pooye, if only I memorized cool stuff like pulling our elf info w/ stuff and stuff... anyways. THANK YOU! ONE MORE REPLY AND I'LL BE COMPLETE AS A PERSON!
Posted: Sun Nov 14, 2004 11:01 pm
by soks
Oh crap, I came up with another question... if someone can say yes to the above one I have another thing to ask...
Posted: Mon Nov 15, 2004 1:01 am
by pixel
To be really honest, the ELF format the PS2 uses is really plain normal. In other words, you should be able to take the latest gcc and binutils, target it to produce code and binaries that ough to run on mips r3000 platform, and use the ps2sdk as "support library" (in order to provide the syscalls and stuff) instead of a classic "libc". Then, a dumb "Hello World" should compile and run more or less straight. That is, thanks to all the (precompiled) ps2sdk, you should be able to compile and link an ELF that runs on the EE with bare, unpatched gcc and binutils.
The actual patches against binutils are mostly to add support for the additionnal instructions introduced by sony into the mips series, and add support for the weired IRX format (the special "elf" format that runs on the IOP). But there's nothing special for the EE-elf-fileformat.
So your answer is more or less a yes, even if ee-ld isn't really modified whatsoever. Once again, code generation and linking isn't the problem. Problem is the support libraries (syscalls, libc, and lots of other PS2-specific stuff) which gives ground support for any (basic) C-code. That is what ps2sdk provides, and that is completely unrelated to binutils or gcc. But you won't be able to compile really specific C code, such as 128 bits support, nor have "fast" optimized code.
Posted: Mon Nov 15, 2004 4:34 am
by J.F.
The PS2 has two main processors in it: the IOP - the IO processor which is an r3000-ish 32bit MIPS CPU that interfaces to most of the hardware; and the EE processor which is an r5000-ish 64bit MIPS CPU that does the bulk of the processing. The IOP runs "normal" 32bit MIPS little-endian code. The EE runs "normal" 64bit MIPS little-endian code, plus it has an extension very similar to MMX or SSE on the PC. Sony calls it MMI. In addition, the EE also has two vector processing units referred to as VU0 and VU1, but they don't need to be used at all to make working PS2 programs. They can help speed things up. Generally, the VU0 is linked to the EE and is used to help the EE do calculations for ai, physics, and collisions. The VU1 is hooked to the GS and is used for geometry and lighting calculations.
As far as I know, the patches to gcc for the EE let you use MMI instructions and access VU0 in "macro" mode. Otherwise it just uses the standard MIPS5900 compiler. Compilers also do one very important thing - they handle the Application Binary Interface (ABI). This interface specifies how data is placed on the stack and what the CPU registers hold when calling functions. This is the REAL difference between using the x86 compiler in Linux and using the mingw32 compiler - they produce completely different ABIs. Linux uses a more "standard" x86 ABI, while Windows has it's own ABI which is different.
Additionally, Windows 32bit code can have two different ABIs: the normal ABI, and a special ABI when the FASTCALL keyword is used in a function definition. The FASTCALL keyword changes the ABI for function calling so that some parameters are passed in registers instead of on the stack for greater speed.
Posted: Mon Nov 15, 2004 5:41 am
by pixel
J.F. wrote:The EE runs "normal" 64bit MIPS little-endian code
I have to disagree with that :) The CPU is running in full 32 bits mode. That is, unlike "true" mips64 cpus, all operations are 32 bits. When you do "add $a0, $a1, $a2" under r3000 and r5900, they both will work with the 32 lower bits of the registers. The r5900 has some "d" instructions though, to work in 64 bits mode. But true mips64 processors should natively behave in 64 bits, and have a "compatibility mode" that switches them back to 32 bits mode.
To get more clues about that, here's an extract from the current binutils code:
Code: Select all
/* An array describing how BFD machines relate to one another. The entries
are ordered topologically with MIPS I extensions listed last. */
static const struct mips_mach_extension mips_mach_extensions[] = {
[...]
{ bfd_mach_mips5900, bfd_mach_mips4000 },
that is, the 5900 is considered as a r4000 processor, which is a mips32:
http://www.mips.com/content/Products/Co ... oductBrief
Posted: Mon Nov 15, 2004 7:03 am
by J.F.
Sorry, but you are definitely wrong here. The EE overview clearly states that the EE implements the MIPS III instruction set and partly implements the MIPS IV instruction set. If you read MIPS64 Vol1 - Introduction to the MIPS64 Architecture, it clearly states in the beginning of chapter 2 that MIPS 32bit architecture is MIPS I and MIPS II, while 64bit architecture is MIPS III and MIPS IV.
Now the MIPS III architecture only does 32bit ADDRESSING, but it does full 64bit data operations. You are confusing the fact that all MIPS instruction sets are designed to be backwards compatible to retain code compatibility. A MIPS III chip can handle MIPS II code, i.e., the 64bit EE can handle 32bit code for backwards compatibility. It's just like the Pentium 4 can execute code that was meant for the 8086. That in no way means the Pentium 4 is a 16bit CPU, it just has special provisions for handling 16bit code. The MIPS 64bit chips are the same way.
Posted: Mon Nov 15, 2004 8:12 am
by pixel
Hum, I won't argue really more on this, since the documentation and the sources are not agreeing together. On the code point of view, r4k series is mips64 (that is, is on the mips3 abi), but all the other mips docs says it sits on the mips2 abi, and thus, is mips32. I was confused by seeing that, on the code point of view, the r5900 is considered as a r4k, which is (in the official docs) a mips32.
Something's wrong here :) Does r4k processors really support 64-bits operations ? Or is binutils plain wrong putting r4k processors on level 3 abis, since the official mips docs says r4k is on level 2 ? Anyway, binutils says r4k is level 3, and we are placing r5900 on the same level as r4k.
Well, anyway, for me, this is getting commercial-talk-bullshit :)
Posted: Mon Nov 15, 2004 9:03 am
by mharris
Just to throw my 2c in, since soks, and probably others, are a little confused about a lot of basics (no offense intended, soks)... Sometimes we take for granted a lot of "computer science 101" topics that may not be understood by everyone, especially (though not exclusively) newcomers.
Here's how it all works, in the most abstract of terms:
- You (the developer) write source code in your favorite high-level language. This can be C, C++, Prolog, whatever. High level languages are nice because it's easy to say something like "x = r * cos(theta)" -- which usually turns into a lot of machine code -- in a machine-independent fashion. The same *source* code will work on a i386, mips5900, whatever.
- The compiler takes your high-level source code, and generates a machine-specific object file. So the compiler is by definition, specific to a specific language (C) and architecture (mips5900). (Some compilers emit assembly language as a separate step, then feed that through an assembler.) In any event, the result is a relocatable object file, in the PS2 world, these are .o files. It is not an executable file, as there are unresolved symbols: the startup code, all of the standard library functions (e.g., printf), etc.
- The linker takes your object files, combines them together with any needed library files (libraries are really just collections of object files), and generates an executable object file, sometimes called a binary file. In PS2DEV vernacular, this is an "ELF file" for the EE (this is a misnomer, since the .o files are also ELF files, just not executables); the executable for the IOP is an "IRX file." Note that on some platforms (e.g., Win32 and Linux), there can still be unresolved symbols here that get resolved at run-time by shared object libraries or DLLs, but we don't have that wrinkle on the PS2.
- Somehow, your binary gets loaded into the computer's memory via a loader -- this is ps2link, naplink, etc. on the PS2; it's a shell or similar on most other OSs. The loader passes control off to the whatever location in memory your binary says is the start location, and away it goes.
As far as system calls, kernels, etc. go, here is the hierarchy:
(This is for a unix system)
- your program calls printf()
- printf() is in the standard C library, which does a bunch of things, but eventually calls the write() system call. (A system call is the interface between a user-mode program and the OS kernel).
- The OS kernel gets the write() system call, and determines what kind of device you're writing to. It passes the data you're writing to the appropriate device driver, which may be built into the kernel, or a loadable module
- The device driver does whatever it needs to do for the underlying hardware. For example, the console device driver displays output on the screen.
The PS2 is similar, but the "kernel" is in the PS2's firmware, and the device drivers run on the IOP, and float somewhere between kenel mode and user mode.
Posted: Mon Nov 15, 2004 10:31 am
by J.F.
pixel wrote:Hum, I won't argue really more on this, since the documentation and the sources are not agreeing together. On the code point of view, r4k series is mips64 (that is, is on the mips3 abi), but all the other mips docs says it sits on the mips2 abi, and thus, is mips32. I was confused by seeing that, on the code point of view, the r5900 is considered as a r4k, which is (in the official docs) a mips32.
Something's wrong here :) Does r4k processors really support 64-bits operations ? Or is binutils plain wrong putting r4k processors on level 3 abis, since the official mips docs says r4k is on level 2 ? Anyway, binutils says r4k is level 3, and we are placing r5900 on the same level as r4k.
Well, anyway, for me, this is getting commercial-talk-bullshit :)
You're confusing MIPS324K series with the R4000. They are not the same thing. The R4K and R5K series have nothing to do with the MIPS324K or MIPS645K lines of CPU from MIPS. Here's a link that talks about the R series MIPS.
http://www.mips.com/content/PressRoom/T ... processors
Oh, and I was mistaken on one thing, the 64bit MIPS does support 64bit addressing. It's just certain models of the 64bit series that only have 32bit address buses.
Posted: Mon Nov 15, 2004 10:46 am
by mrbrown
You guys are both wrong. What you forget is that for all of the MIPS ABIs and instruction sets, there is no "standard" standard MIPS. Once implementors license it, they are pretty much free to do whatever they want. Toshiba bastardized the **** out of the R5900 to the point where it doesn't fit in any cookie cutter MIPS category. The FPU is non-standard, the MMI stuff is nonstandard, and MIPSIII instructions are hacked out (why did they get rid of ll/sc and 64-bit multiply and divide?).
The R5900 doesn't fit in any one MIPS category, it's not "like" any other MIPS MIPS (e.g. R4K, R3K). I don't even know what you guys were arguing about anyway :P.
Posted: Mon Nov 15, 2004 10:59 am
by pixel
Aaah, okay, my bad then :)
Well, when I did quick searches around about the EE, I searched infos about r4000 series, and thought the r4k was the "code name" of it.
Posted: Mon Nov 15, 2004 11:30 am
by Guest
Mrbrown beat me to the punch!
Except, I was going to start out by saying "you both are right, sorta kinda!" :P
The r5900 implements NEARLY all of the MIPSIII ISA. It is missing the double-word multiply/divide instructions, as well as the semaphore instructions. In exchange, it implements a mere 3 instructions of the MIPS IV ISA - 2 move conditionals and the cache prefetch. I am not sure it as a fair trade, but I don't design cpu cores for a living.
However, what I am still wondering is why we need two separate toolchains ? Is it not possible to have one base r5900 gcc compiler toolchain, and then do a -mcpu=r3000 or -march=mips2 or something like that to get stuff for the IOP ? Perhaps following up an elf2irx on the resulting binary ?
If it is a desire to not have to type those flags for quick command line access to the utilities outside of a makefile, one could easily just write wrapper shell scripts prefixed with "iop-".
In this way, one only needs to build one toolchain for everything.
Posted: Mon Nov 15, 2004 11:38 am
by pixel
Well.... the actual toolchain DOES that, really. But there were bugs around that at the moment it was introduced, so we reverted back to two different gccs. But ee-gcc has a -miop option which should turn it into an r3000 compiler. Links has to be done with iop-ld though, but ee-ld should also have a -miop or -mirx option which should produce irx files. Can't remember.
Posted: Mon Nov 15, 2004 12:05 pm
by Guest
For the IOP, should it really be correct behavior that the linking stage produces an IRX file by default rather than a normal ELF ?
I fully understand that in most ps2dev situations what we want is IRX, but if this can be done as a separate independant action performed after linking, then this oddity can be separated out and make the toolchain more generic, and removes an implicit assumption. Someone might want to run a normal elf rather than IRX on the iop. :)
I just think IRX is too (iop kernel) OS specific to be a default part of the gnu portion of the toolchain. The more that stuff is separated out, if it can be easily done so, the more the whole gnu toolchain can be in a state that it isn't considered "hacked up" and could potentially be a candidate for inclusion into the main GCC/binutils distribution.
And within a makefile, its not difficult to run elf2irx after a build.
I realize that arguments about this can go both ways, but my point of view is geared towards simplifying the whole operation. I.e. not hacking up the gnu portion to do things that it does not need to do, making long term maintenance much easily, especially when philosophically a case can be made that it is something that really should be done separately.
Posted: Mon Nov 15, 2004 12:59 pm
by soks
*blink*
Now I wonder what would be going on had I not posted a word about this, would we all still think the R5900 is a MIPS324k or a MIPS645k. But anyways...
Dorks. =P
That was a splendid conversation and I'm glad that I'm slowly understanding a whole friggin' lot more.
Thanks a lot to mrharris for that last step by step explanation, yes I try not to feel offended but I understand it helps to assume I know nothing rather than guess what I know. I'll say this, I've been using C/C++ for 6 years and am a very high-level (not skills, I mean, yeah, high-level language...) programmer, so this low level stuff is new to me (i got the .o ideas but I never knew what exacly was in a .o).
So... that was interesting. Thanks a lot for the help.
Question about the ld's, did those need a lot of patching or not? because at this point it sounds like gcc supported R5900 and R4000 without patching really but the binutils had to be changed or no go.
Crap, I wish I was in a hardware school now and not software... oh well.
And a question on firmware-ish stuff, I was told parts of processors are programmable just like those programmable-IC's, any clerification as to whether this is normal and why it's used?
Hell while I'm at it, on a PC the OS uses the BIOS to get stuff going correct? Is the PS2-hardware-kernel thingy comparable to a BIOS?
Posted: Mon Nov 15, 2004 1:20 pm
by Guest
Soks, you should really consider setting up irc and hopping on the Efnet #ps2dev channel to ask many of your questions. Its actually good to get some forum throughput the way we have been lately, but it seems you have way many questions ;) Hop onto irc, and I suggest Nagra being the first person to pester.
Anyhow, to answer just the BIOS question: it is similar to a PC. Essentially it is a mini-os stored in a PROM that gets loaded into memory at system start in order to provide the system an initial state. It usually provides basic interrupt processing, threading/scheduling interface, basic i/o capability, and a set of system calls in order to access those functions. One additional important function it provides from all of that is a way to load additional applications software, whether it be a full-fledged operating system in the case of Windows OS on a PC, or a game in the typical PS2 situation.
The bios, depending on the architecture, may or may not load some graphical way of interacting with it. Again in the case of a PC, you are already familiar with how to interact with the typical bios there. On the PS2, the "browser" screen that shows the inserted memcards, game/movie disc, and hdd (if sony hdd and software present), and other basically configuration things like timezone, date/time, etc... The key point is, every system is different. Some systems have less things implemented in bios.
For example, the typical PC bios I think does NOT implement threading - it lets you tweak hardware settings, provide a minimal way to access i/o, and go straight to booting something more capabile of handling any situation. The OpenBoot bios of Sun and Apple is textual/commandline oriented, and again, primarily geared towards initial device identification and OS booting. This is because those systems ship with OS's intended to boot and take care of everything.
The PS2, on the other hand, is more properly called an "embedded system". Embedded systems typically are configured to do everything they will ever need to do from its BIOS program. Of course, its good to have some means of updating the software to run a system. So there might be a flash area to store additional newer programs. Whenever you need to download a firmware for something, that is usually an example of an embedded system. Your WIFI access point is a good example of an embedded system, as well as your cell phone. The PS2 is in a class of embedded systems that are fairly close to being a computer, could be expanded/configured to act like one, but generally wasn't originally nor primarily intended to be one, but its still an embedded system all the same, rather than a PC.
Now, everything we have talked about here really doesn't go to the level of hardware. If you are in any decent computer science program, all of this stuff should be discussed at some point or another - Assembly and hardware archtecture, compilers, etc... as a software level issue. They can't teach you everything, but they can teach you where the differences will generally be from architecture to architecture, so you know what to look for when you need to. Not all CS programs do this, some want to make everything so abstract that one might still be clueless at graduation, but thats a different topic.
However, it does help to have documentation of what was implemented into hardware in order to guide what one does in software. This includes the available instructions, cache organization, important I/O addresses, pipelining issues, addressing modes, buses, etc... but one doesn't need to be a hardware person to understand all that, unless of course, you are going to design your own computer, or get into the nitty details of real embedded systems development.
And no, there wasn't too much terrible confusion about whether the r5900 was this or that. Yes, ok there was a little, but that wasn't an issue, because whether it was at a conscious level or not, everyone understood that r5900 was special and the gcc/binutils toolchain needed patches in order to make full use of the r5900. Mrbrown stated it the most eloquently about no MIPS implementation ever being truly the same as any other, so it is inevitable that you need to make your toolchain accommodate those differences.
Edit: clarify a few things, mention embedded systems a bit more.
Posted: Mon Nov 15, 2004 1:40 pm
by mharris
soks wrote:And a question on firmware-ish stuff, I was told parts of processors are programmable just like those programmable-IC's, any clerification as to whether this is normal and why it's used?
Hell while I'm at it, on a PC the OS uses the BIOS to get stuff going correct? Is the PS2-hardware-kernel thingy comparable to a BIOS?
Yes and no.
In the old days, there was software, and hardware. And then came firmware, which is software encoded in hardware. This was typically on a ROM; nowadays it's on a more modern variant, such as flash.
A PC has a BIOS (Basic I/O System) in firmware to do the most primitive low-level stuff -- put a character on a screen, read a sector from disk, etc. But then a PC is expected to load its OS (DOS, Windows, Linux, whatever) from disk, so it doesn't need much in ROM. The BIOS is really just a boot loader these days. I'm pretty sure most modern OSs don't use the BIOS at all once they've booted up, and interface with the devices directly.
Now the PS2 is a different matter entirely. Keep in mind the basic differences between a PC and a PS2: the PS2 is much more closed (limited expansion capabilities), and less general purpose (it's a game console first and foremost). Since there is no externally-loadable OS (no HDD in most PS2s), the firmware is much closer to a kernel than it is a BIOS. It handles many "kernel-type" things, like threads, that a PC's BIOS doesn't. But I wouldn't consider it to be a full OS.
(This is a little like the kernel vs. OS argument that causes some people to declare "Linux" should really be called "GNU/Linux," citing that Linux is only the kernel, and that the rest of the OS is from the GNU project.)
As far as "parts of processors are programmable just like those programmable-IC's," I guess you're talking about FPGAs or CPLDs or something like that. Some CPU families have their microcode in flash, which can be overwritten or updated, but I have no idea if the EE works like this -- I kinda doubt it. I've heard you can re-flash the PS2's ROM (don't know if this is true or not); I expect this is more of a modchip thing, though.
Posted: Mon Nov 15, 2004 3:00 pm
by soks
But I thought IRC was only for piracy...
No just kidding, seriously, don't ban me for that please <=D
About efnet... I believe I'm banned from efnet... although that might have been afternet... hrm... IRC eh... but that's closer to human contact outside of... err.. that lady laying in my bed there, and those guys who live in the rooms next to me... my god... other people exist! yes I need sleep, havn't slept in like 40 hours... other than while driving.
Wow. I do ask A LOT of questions... it's a problem really... I learn and then don't do things with the knowledge. Eheh... heh... lets not get into the fact I've read more programming books than I've written programs (if you count ONLY OpenGL stuff it MIGHT be a tie...). Hrm... considering I'm first year and going game development major... i have NO CLUE what this school covers, especially after hearing a student say "you kinda have to learn ASM on your own if you want anything decent out of it"... eheh... right... there goes $30,000....
OKOK! I'll go on IRC... later... first sleep, then finals, then maybe plugging in my fucking PS2 finally.
Yeah but thanks A LOT for those explanations, mrharris and gorim, makes a lot of sense, more sense than the jumper mess this fucking cdrom drive just put me through... anyways. Thanks a lot once again I'll go read some more ars technica (eheh...) and maybe setup that toolchain now that i've given up on reiser4.
For tonight... *poof*
Posted: Mon Nov 15, 2004 3:23 pm
by mrbrown
gorim wrote:For the IOP, should it really be correct behavior that the linking stage produces an IRX file by default rather than a normal ELF ?
I fully understand that in most ps2dev situations what we want is IRX, but if this can be done as a separate independant action performed after linking, then this oddity can be separated out and make the toolchain more generic, and removes an implicit assumption. Someone might want to run a normal elf rather than IRX on the iop. :)
I just think IRX is too (iop kernel) OS specific to be a default part of the gnu portion of the toolchain. The more that stuff is separated out, if it can be easily done so, the more the whole gnu toolchain can be in a state that it isn't considered "hacked up" and could potentially be a candidate for inclusion into the main GCC/binutils distribution.
And within a makefile, its not difficult to run elf2irx after a build.
....
Make up your mind :). First you talk about adding an option to GCC so that one "gcc" will compile IOP and EE code. Then you talk about seperating out the IOP linking phase into a seperate step. It already is a seperate step, in the linker. The linker already supports multiple executable formats and their variants (called emulations - the IRX format is just a variant of MIPS ELF). You tell it what emulation you want it to use and there you go. The linker is not the issue when it comes to toolchain seperation :P. Binutils can actually support *every* target executable format in a single toolchain.
Also, GCC was already written to support multiple MIPS targets from a single executable. It's mostly our R5900 patches to blame for why things aren't working. Unfortunately they assume too much control over the MIPS backend - they don't conditionalize the special R5900 features like they should. As pixel will tell you, it takes a fair amount of effort to get those patches integrated properly.
In any case we have toolchains for both processors that just work, so there hasn't been a huge push when we could be working on other things. At one point we were trying to make sure ps2lib didn't require one or the other compiler, so if you only wanted to work on EE code you'd only need an EE compiler installed. I think we should try to get back to that point, so we need to be vigilant in making sure IRX binaries are up to date.