GP2X Copy Register Content On The Stack


synkro

0xdeadbeef
Joined
Aug 26, 2003
Messages
823
Location
Germany
Website
Visit site
Hi!

I need a simple way to store the register content somewhere. Squidge gave me a single ARM ASM instruction but I have no fucking clue to use that. I think libc must provide something like that.

my question is: if I declare the jump buffer context inside foo it will be on the stack, wif I declare conext outside as global var it will reside in the data segment. Is that correct?

Code:
foo()
{
  jmp_buf context;
  if(setjmp(conext))
    return;
  else
  {
    // do what ever I want with the stack content
  }

}
 
How about something like:

void getregs (u32 *storage)
{
asm volatile ("stm r0, {r1-r14}");
}

don't know if it'll compile/work, but give it a go.
 
Back
Top