|
From: Adam G. <ar...@cy...> - 2004-10-18 15:37:48
|
At 04:11 PM 10/18/2004 +0100, Nicholas Nethercote wrote: >>I would guess that if argc is a register, and you ask for &argc, the >>compiler will generate a temporary on the stack which you can mess with (but >>it wouldn't be what you want.. it would be somewhere in the local variables) > >I should have been clearer. The value of argc will definitely be on the stack, because the ABI requires it. However, the argument argc to main() may be in a register (ie. there could be two copies of argc floating around, one on the stack, one in a register). In which case a temporary will be generated as you say, which is not what we want. Does that make sense? yeah. that's what I thought. >>could be wrong though... try writing a five line program on PPC and seeing >>what assembler you get (I know that's not portable) > >I don't have access to a PPC at the moment, unfortunately... not sure I have either... have you thought of trying QEMU/PPC? there's a Linux/PPC image on freeoszoo.org which might be of some use: http://www.freeoszoo.org/download.php >>you know that GCC has some builtins that return things like this? >> >>http://ou800doc.caldera.com/cgi-bin/info2html?(gcc.info)Return%2520Address&lang=en > >I don't see how either of those really help? I was thinking of using __builtin_frame_pointer() to find the start address, but that actually gets the point between the arguments and the locals. damn. maybe there's another builtin? Seeya, Adam -- Real Programmers don't comment their code. If it was hard to write, it should be hard to read, and even harder to modify. These are all my own opinions. |