This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch review] Syscall for multi-arch support


Some items are listed here to present what I did,

1. Move syscallList from  Syscall.java to Linux<ISA>.java.
syscallList is relative to OS+ISA, so I put this array in
Linux<ISA>.java .  However, I do not change the spec in syscallList.
It would take me a whole day to look up system call numbers for
different architectures. :)

2. New methods to Syscall.
Tom submitted a patch about part of this, and I integrate his patch in
my changes.  Add equals() in Syscall.

3. New methods in SyscallEventInfo.
a) getSyscall (Task task) return a Syscall object when a syscall happens.
b) getSyscallList() and getUnknownSyscalls() return the
architecture-dependent syscallList and unknown syscall hash map from
Linux<ISA>.java
c) syscallByNum() and syscallByName() are also from Tom's patch.

4. Setup three syscallList for Ia32 to index syscall object by syscall
number and first argument directly.
I discussed this with Mark here,
http://sources.redhat.com/ml/frysk/2006-q3/msg00409.html

One syscallList is for common syscalls.(indexed by syscall number)
One syscalLList is for socket "subcall".(indexed by first argument)
One syscallList is for ipc "subcall".(indexed by first argument)

This patch could setup a framework for multi-arch syscall list, and now
ftrace could recognize syscall "bind" or "send" as a standard system
call, but there are something we could go on if this patch is on a
right track.
1) Code syscallList spec for every architecture except Ia32.  I did not
code syscall spec for ipc "subcalls".
2) fill in argument for these "subcalls" on ia32.
On ia32, these "subcalls" share the same system call number, but with
different name, and these "subcalls" could be distinguished by %ebx,
and their arguments are in memory addressed by %ecx.

In my patch, I just let it return 0 now, so the output from ftrace is
0 or NULL.


Any comments are welcome!

Here is an output from ftrace on x86,
(I input Ctrl-C to kill accept)

[qiyao@GreenHouse frysk-core]$ ./frysk/bindir/ftrace
frysk/pkglibexecdir/funit-syscall-running
ftrace.main() Proc.getPid() 1601
ftrace.main() Proc.getPid()
/home/qiyao/source/cvs/build-frysk/frysk-core/frysk/pkglibexecdir/funit-syscall-running
1601.1601 <SYSCALL> brk (NULL) = 142249984
1601.1601 <SYSCALL> mmap (NULL,4096,3,34,-1,-38) = 0xb7fa1000
1601.1601 <SYSCALL> access ("/etc/ld.so.preload",4) = -1 ERRNO=2
1601.1601 <SYSCALL> open ("/etc/ld.so.cache",0,0) = 3
1601.1601 <SYSCALL> fstat64 (3,0xbfe1648c) = 0
1601.1601 <SYSCALL> mmap (NULL,67623,1,2,3,-38) = 0xb7f90000
1601.1601 <SYSCALL> close (3) = 0
1601.1601 <SYSCALL> open ("/lib/libc.so.6",0,699) = 3
1601.1601 <SYSCALL> read (3,0xbfe165dc,512) = 512
1601.1601 <SYSCALL> fstat64 (3,0xbfe164ec) = 0
1601.1601 <SYSCALL> mmap (0x743000,1295780,5,2050,3,-38) = 0x743000
1601.1601 <SYSCALL> mmap (0x87a000,12288,3,2066,3,-38) = 0x87a000
1601.1601 <SYSCALL> mmap (0x87d000,9636,3,50,-1,-38) = 0x87d000
1601.1601 <SYSCALL> close (3) = 0
1601.1601 <SYSCALL> mmap (NULL,4096,3,34,-1,-38) = 0xb7f8f000
1601.1601 <SYSCALL> set_thread_area (0xbfe169d0) = 0
1601.1601 <SYSCALL> mprotect (0x87a000,8192,1) = 0
1601.1601 <SYSCALL> mprotect (0x73f000,4096,1) = 0
1601.1601 <SYSCALL> munmap (0xb7f90000,67623) = 0
1601.1601 <SYSCALL> socket (0,0,0) = 3
1601.1601 <SYSCALL> bind (0,NULL,0) = 0
1601.1601 <SYSCALL> getsockname (0,NULL,NULL) = 0
1601.1601 <SYSCALL> listen (0,0) = 0
1601.1601 <SYSCALL> fstat64 (1,0xbfe16644) = 0
1601.1601 <SYSCALL> mmap (NULL,4096,3,34,-1,-38) = 0xb7fa0000
1601.1601 <SYSCALL> write (1,0xb7fa0000,6)48815  = 6
1601.1601 <SYSCALL> accept (0,NULL,NULL)

-- 
Yao Qi

Attachment: Syscall.patch
Description: Text document

Attachment: Syscall.gui.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]