Hi Yao,
On Fri, 2006-09-15 at 15:05 +0800, Yao Qi wrote:
It is not *always* right to get system call number from a certain
register when exit from a system call, such as rt_sigreturn. This
problem has been discussed in this thread,
http://sources.redhat.com/ml/frysk/2006-q3/msg00305.html
Andrew explained that *all* the registers have been flushed to restore
the state of that thread, so "orig_eax"(ia32), "orig_rax"(x86_64) or
"gpr0"(ppc) does not contain the value of system call number any more.
[...]
The only thing I could figure out to fix this problem is to add a
SyscallObserver to update system call number cached in
SyscallEventInfo, or some where else, when enter in a system call, and
return system call numbers to other objects that want to know system
call information. (Any other solutions, free to tell me)
SyscallObservers are all "equal", you cannot currently add one that has
preference over any of the others. But the Task or TaskState could hold
this info if needed.
What is precisely the use case? When does a SyscallObserver want to get
at the syscall number (or arguments) on exit? Can we assume that a
SyscallObserver will record Enter/Exit pairs themselves? If so then a
SyscallObserver should probably have saved the syscall number and any
arguments it is interested in on updateSyscallEnter() so it can use them
in updateSyscallExit(). Then when updateSyscallExit() is called the only
"valid" thing to query is the return value.