Re: syscall semantics question

Jeff Moyer USG (jmoyer@zk3.dec.com)
Thu, 30 Sep 1999 13:24:46 -0400 (EDT)


==> Regarding Re: syscall semantics question ; Philip Blundell <pb@nexus.co.uk> adds:

>> A system call is defined as:
>>
>> static inline _syscall1 (int, restart, char*, filename);

pb> That defines a routine to actually perform the syscall; look at
>> asm/unistd.h>. It's not a declaration for...

ok

>> Is it correct to assume on all architectures that one could cast the
>> first arg to a syscall as a 'struct pt_regs'?

pb> Not in general. Why do you want to do this?

I found the answer to my question (args a0-a5 are in registers,
then pt_regs magically appears on the stack).

This is a checkpoint/restart system. I need to port it from x86 to alpha.
So, I need to save the regs, and need to know what else to save. I have
tried saving the switch_stack, and getting the usp (via rdusp()). However,
when I restart the app, replace the struct pt_regs on the stack with the
regs from the image, as well as the switch_stack, and issue wrusp(), I
manage to set the pc someplace not within the app's stack. I get a core
dump and gdb reports:

warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x200001930f4
.
.
.
Otherwise, you told GDB there
was a function where there isn't one...

So, I was wondering if I am missing something obvious?

-Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/