Am 16.11.2010 um 00:02 schrieb Segher Boessenkool:
Who's responsible for r2 setup - GCC-generated code or QEMU?
r2 contains the GOT IIRC. But for ABI questions, it's probably best to consult Segher :). Unless I'm completely mistaken, usually the loader initializes r2, so in this case the asm code needs to set it up properly.
Depends what you call "loader". Usually your crt1 equivalent sets GPR2. It is probably a good idea to set it in all exception handlers as well (if they want to call C code, or need it otherwise).
But set it to what value? :)
TOC base + 0x8000.
On an ELF binary like your Linux programs, this is actually stored in the function descriptor pointed to by e_entry.
Segher