Index: frysk-core/frysk/bindir/ftrace.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/bindir/ftrace.java,v retrieving revision 1.18 diff -u -r1.18 ftrace.java --- frysk-core/frysk/bindir/ftrace.java 7 Aug 2006 20:22:15 -0000 1.18 +++ frysk-core/frysk/bindir/ftrace.java 8 Sep 2006 10:55:49 -0000 @@ -144,7 +144,9 @@ System.out.println("Got task exception " + e); return Action.CONTINUE; } - frysk.proc.Syscall syscall = frysk.proc.Syscall.syscallByNum(syscallEventInfo.number(task)); + + frysk.proc.Syscall syscall = syscallEventInfo.getSyscall(task); + PrintWriter printWriter = new PrintWriter(System.out); printWriter.print(task.getProc().getPid() + "." + task.getTid() + " "); syscall.printCall(printWriter, task, syscallEventInfo); @@ -165,7 +167,8 @@ System.out.println("Got task exception " + e); return Action.CONTINUE; } - frysk.proc.Syscall syscall = frysk.proc.Syscall.syscallByNum(syscallEventInfo.number(task)); + frysk.proc.Syscall syscall = syscallEventInfo.getSyscall(task); + PrintWriter printWriter = new PrintWriter(System.out); syscall.printReturn(printWriter, task, syscallEventInfo); printWriter.flush(); Index: frysk-core/frysk/proc/Isa.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/Isa.java,v retrieving revision 1.11 diff -u -r1.11 Isa.java --- frysk-core/frysk/proc/Isa.java 23 Aug 2006 04:04:19 -0000 1.11 +++ frysk-core/frysk/proc/Isa.java 8 Sep 2006 10:55:50 -0000 @@ -49,6 +49,9 @@ public interface Isa { + + String toString(); + Iterator RegisterIterator(); Register getRegisterByName(String name); Index: frysk-core/frysk/proc/IsaEMT64.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/IsaEMT64.java,v retrieving revision 1.4 diff -u -r1.4 IsaEMT64.java --- frysk-core/frysk/proc/IsaEMT64.java 29 Aug 2006 05:35:43 -0000 1.4 +++ frysk-core/frysk/proc/IsaEMT64.java 8 Sep 2006 10:55:50 -0000 @@ -117,6 +117,10 @@ return (Register)registerMap.get(name); } + public String toString () + { + return "x86-64"; + } public long pc(Task task) { return getRegisterByName("rip").get(task); Index: frysk-core/frysk/proc/IsaIA32.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/IsaIA32.java,v retrieving revision 1.4 diff -u -r1.4 IsaIA32.java --- frysk-core/frysk/proc/IsaIA32.java 29 Aug 2006 05:35:43 -0000 1.4 +++ frysk-core/frysk/proc/IsaIA32.java 8 Sep 2006 10:55:50 -0000 @@ -124,6 +124,10 @@ return (Register)registerMap.get(name); } + public String toString() + { + return "ia32"; + } public long pc(Task task) { return getRegisterByName("eip").get(task); Index: frysk-core/frysk/proc/IsaPPC.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/IsaPPC.java,v retrieving revision 1.2 diff -u -r1.2 IsaPPC.java --- frysk-core/frysk/proc/IsaPPC.java 23 Aug 2006 04:04:19 -0000 1.2 +++ frysk-core/frysk/proc/IsaPPC.java 8 Sep 2006 10:55:50 -0000 @@ -82,6 +82,11 @@ return getRegisterByName("nip").get(task); } + public String toString() + { + return "ppc"; + } + public int getWordSize () { return 4; Index: frysk-core/frysk/proc/IsaPPC64.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/IsaPPC64.java,v retrieving revision 1.5 diff -u -r1.5 IsaPPC64.java --- frysk-core/frysk/proc/IsaPPC64.java 29 Aug 2006 05:35:43 -0000 1.5 +++ frysk-core/frysk/proc/IsaPPC64.java 8 Sep 2006 10:55:50 -0000 @@ -99,6 +99,11 @@ return getRegisterByName("nip").get(task); } + public String toString () + { + return "ppc64"; + } + public int getWordSize () { return 8; Index: frysk-core/frysk/proc/LinuxEMT64.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxEMT64.java,v retrieving revision 1.2 diff -u -r1.2 LinuxEMT64.java --- frysk-core/frysk/proc/LinuxEMT64.java 11 Jul 2006 21:25:25 -0000 1.2 +++ frysk-core/frysk/proc/LinuxEMT64.java 8 Sep 2006 10:55:50 -0000 @@ -39,6 +39,8 @@ package frysk.proc; +import java.util.HashMap; + class LinuxEMT64 extends IsaEMT64 implements SyscallEventDecoder { @@ -50,6 +52,10 @@ return isa; } + // This is used to keep track of syscalls whose number we do not + // know. + static HashMap unknownSyscalls; + private SyscallEventInfo info; public SyscallEventInfo getSyscallEventInfo () { @@ -85,7 +91,285 @@ throw new RuntimeException ("unknown syscall arg"); } } + }; return info; } + + /** FIXME: This syscallList is i386 specific. */ + static Syscall[] syscallList = { + new Syscall (0), + new Syscall ("exit", 1, 1), + new Syscall ("fork", 2, 0, "i: "), + new Syscall ("read", 3, 3, "i:ibn "), + new Syscall ("write", 4, 3, "i:ibn "), + new Syscall ("open", 5, 3, "i:siv "), + new Syscall ("close", 6, 1, "i:i "), + new Syscall ("waitpid", 7, 3, "i:ipi "), + new Syscall ("creat", 8, 2, "i:sv"), + new Syscall ("link", 9, 2, "i:ss "), + new Syscall ("unlink", 10, 1, "i:s "), + new Syscall ("execve", 11, 3, "i:ppp "), + new Syscall ("chdir", 12, 1, "i:s "), + new Syscall ("time", 13, 1, "i:P "), + new Syscall ("sys_mknod", 14, 3, "i:sii "), + new Syscall ("chmod", 15, 2, "i:si "), + new Syscall ("lchown", 16, 3, "i:sii "), + new Syscall ("break", 17), + new Syscall ("old_stat", 18, 3, "i:pp "), + new Syscall ("lseek", 19, 3, "i:iii "), + new Syscall ("getpid", 20, 0, "i: "), + new Syscall ("mount", 21, 5, "i:sssip "), + new Syscall ("umount", 22, 1, "i:s "), + new Syscall ("setuid", 23, 1, "i:i "), + new Syscall ("getuid", 24, 0, "i: "), + new Syscall ("stime", 25, 1, "i:p "), + new Syscall ("ptrace", 26, 4, "i:iiii "), + new Syscall ("alarm", 27, 1, "i:i "), + new Syscall ("old_fstat", 28, 2, "i:ip "), + new Syscall ("pause", 29, 0, "i: "), + new Syscall ("utime", 30, 2, "i:sP "), + new Syscall ("stty", 31), + new Syscall ("gtty", 32), + new Syscall ("access", 33, 2, "i:si "), + new Syscall ("nice", 34, 1, "i:i "), + new Syscall ("ftime", 35, 1, "i:p "), + new Syscall ("sync", 36, 0, "i: "), + new Syscall ("kill", 37, 2, "i:ii "), + new Syscall ("rename", 38, 2, "i:ss "), + new Syscall ("mkdir", 39, 2, "i:si "), + new Syscall ("rmdir", 40, 1, "i:s "), + new Syscall ("dup", 41, 1, "i:i "), + new Syscall ("pipe", 42, 1, "i:f "), + new Syscall ("times", 43, 1, "i:p "), + new Syscall ("prof", 44), + new Syscall ("brk", 45, 1, "i:p "), + new Syscall ("setgid", 46, 1, "i:i "), + new Syscall ("getgid", 47, 0, "i: "), + new Syscall ("signal", 48, 2, "i:ii "), + new Syscall ("geteuid", 49, 0, "i: "), + new Syscall ("getegid", 50, 0, "i: "), + new Syscall ("acct", 51, 1, "i:S "), + new Syscall ("umount2", 52, 2, "i:si "), + new Syscall ("lock", 53), + new Syscall ("ioctl", 54, 3, "i:iiI "), + new Syscall ("fcntl", 55, 3, "i:iiF "), + new Syscall ("mpx", 56), + new Syscall ("setpgid", 57, 2, "i:ii "), + new Syscall ("ulimit", 58, 2, "i:ii "), + new Syscall ("oldolduname", 59), + new Syscall ("umask", 60, 1, "i:i "), + new Syscall ("chroot", 61, 1, "i:s "), + new Syscall ("ustat", 62, 2, "i:ip "), + new Syscall ("dup2", 63, 2, "i:ii "), + new Syscall ("getppid", 64, 0, "i: "), + new Syscall ("getpgrp", 65, 0, "i: "), + new Syscall ("setsid", 66, 0, "i: "), + new Syscall ("sigaction", 67, 3, "i:ipp "), + new Syscall ("sgetmask", 68), + new Syscall ("ssetmask", 69), + new Syscall ("setreuid", 70, 2, "i:ii "), + new Syscall ("setregid", 71, 2, "i:ii "), + new Syscall ("sigsuspend", 72, 1, "i:p "), + new Syscall ("sigpending", 73, 1, "i:p "), + new Syscall ("sethostname", 74, 2, "i:pi "), + new Syscall ("setrlimit", 75, 2, "i:ip "), + new Syscall ("getrlimit", 76, 2, "i:ip "), + new Syscall ("getrusage", 77, 2, "i:ip "), + new Syscall ("gettimeofday", 78, 2, "i:PP "), + new Syscall ("settimeofday", 79, 2, "i:PP "), + new Syscall ("getgroups", 80, 2, "i:ip "), + new Syscall ("setgroups", 81, 2, "i:ip "), + new Syscall ("select", 82, 5, "i:iPPPP "), + new Syscall ("symlink", 83, 2, "i:ss "), + new Syscall ("oldlstat", 84, 2, "i:pp "), + new Syscall ("readlink", 85, 3, "i:spi "), + new Syscall ("uselib", 86, 1, "i:s "), + new Syscall ("swapon", 87, 2, "i:si "), + new Syscall ("reboot", 88, 1, "i:i "), + new Syscall (89), + new Syscall ("mmap", 90, 6, "b:aniiii "), + new Syscall ("munmap", 91, 2, "i:ai "), + new Syscall ("truncate", 92, 2, "i:si "), + new Syscall ("ftruncate", 93, 2, "i:ii "), + new Syscall ("fchmod", 94, 2, "i:ii "), + new Syscall ("fchown", 95, 3, "i:iii "), + new Syscall ("getpriority", 96, 2, "i:ii "), + new Syscall ("setpriority", 97, 3, "i:iii "), + new Syscall ("profil", 98, 4, "i:piii "), + new Syscall ("statfs", 99, 2, "i:sp "), + new Syscall ("fstatfs", 100, 2, "i:ip "), + new Syscall ("ioperm", 101, 3, "i:iii "), + new Syscall ("socketcall", 102, 2, "i:ip "), + new Syscall ("klogctl", 103, 3, "i:isi "), + new Syscall ("setitimer", 104, 3, "i:ipp "), + new Syscall ("getitimer", 105, 2, "i:ip "), + new Syscall ("sys_stat", 106, 2, "i:sp "), + new Syscall ("sys_lstat", 107, 2, "i:sp "), + new Syscall ("sys_fstat", 108, 2, "i:ip "), + new Syscall ("old_uname", 109, 1, "i:p "), + new Syscall ("iopl", 110, 1, "i:i "), + new Syscall ("vhangup", 111, 1, "i:i "), + new Syscall ("idle", 112, 0, "i: "), + new Syscall (113), + new Syscall ("wait4", 114, 4, "i:iWiP "), + new Syscall ("swapoff", 115, 1, "i:s "), + new Syscall ("sysinfo", 116, 1, "i:p "), + new Syscall ("ipc", 117, 6, "i:iiiipi "), + new Syscall ("fsync", 118, 1, "i:i "), + new Syscall ("sigreturn", 119), + new Syscall ("clone", 120, 2, "i:ip "), + new Syscall ("setdomain", 121, 2, "i:si "), + new Syscall ("uname", 122, 1, "i:p "), + new Syscall ("modify_ldt", 123, 3, "i:ipi "), + new Syscall ("adjtimex", 124, 1, "i:p "), + new Syscall ("mprotect", 125, 3, "i:aii "), + new Syscall ("sigprocmask", 126, 3, "i:ipp "), + new Syscall ("create_module", 127, 3), + new Syscall ("init_module", 128, 5), + new Syscall ("delete_module", 129, 3), + new Syscall ("get_kernel_syms", 130, 1, "i:p "), + new Syscall ("quotactl", 131, 4, "i:isip "), + new Syscall ("getpgid", 132, 1, "i:i "), + new Syscall ("fchdir", 133, 1, "i:i "), + new Syscall ("bdflush", 134, 2, "i:ii "), + new Syscall ("sysfs", 135, 1, "i:i "), + new Syscall ("personality", 136, 1, "i:i "), + new Syscall ("afs_syscall", 137), + new Syscall ("setfsuid", 138, 1, "i:i "), + new Syscall ("setfsgid", 139, 1, "i:i "), + new Syscall ("llseek", 140, 5, "i:iuupi "), + new Syscall ("s_getdents", 141, 3, "i:ipi "), + new Syscall ("select", 142, 5, "i:iPPPP "), + new Syscall ("flock", 143, 2, "i:ii "), + new Syscall ("msync", 144, 3, "i:aii "), + new Syscall ("readv", 145, 3, "i:ipi "), + new Syscall ("writev", 146, 3, "i:ipi "), + new Syscall ("getsid", 147, 1, "i:i "), + new Syscall ("fdatasync", 148, 1, "i:i "), + new Syscall ("sysctl", 149, 1, "i:p "), + new Syscall ("mlock", 150, 2, "i:bn "), + new Syscall ("munlock", 151, 2, "i:ai "), + new Syscall ("mlockall", 152, 1, "i:i "), + new Syscall ("munlockall", 153, 0, "i: "), + new Syscall ("sched_setp", 154, 2, "i:ip "), + new Syscall ("sched_getp", 155, 2, "i:ip "), + new Syscall ("sched_sets", 156, 3, "i:iip "), + new Syscall ("sched_gets", 157, 1, "i:i "), + new Syscall ("sched_yield", 158, 0, "i: "), + new Syscall ("sched_primax", 159, 1, "i:i "), + new Syscall ("sched_primin", 160, 1, "i:i "), + new Syscall ("sched_rr_gi", 161, 2, "i:ip "), + new Syscall ("nanosleep", 162, 2, "i:pp "), + new Syscall ("mremap", 163, 4, "b:aini "), + new Syscall ("setresuid", 164, 3, "i:iii "), + new Syscall ("getresuid", 165, 3, "i:ppp "), + new Syscall ("vm86", 166, 1, "i:p "), + new Syscall ("query_module", 167, 5, "i:sipip "), + new Syscall ("poll", 168, 3, "i:pii "), + new Syscall ("nfsservctl", 169, 3, "i:ipp "), + new Syscall ("setresgid", 170, 3, "i:iii "), + new Syscall ("getresgid", 171, 3, "i:ppp "), + new Syscall ("prctl", 172, 5, "i:iiiii "), + new Syscall ("rt_sigreturn", 173), + new Syscall ("rt_sigaction", 174), + new Syscall ("rt_sigprocmask", 175), + new Syscall ("rt_sigpending", 176), + new Syscall ("rt_sigtimedwait", 177), + new Syscall ("rt_sigqueueinfo", 178), + new Syscall ("rt_sigsuspend", 179), + new Syscall ("pread64", 180), + new Syscall ("pwrite64", 181), + new Syscall ("chown", 182, 3, "i:sii "), + new Syscall ("getcwd", 183, 2, "i:bi "), + new Syscall ("capget", 184, 2, "i:pp "), + new Syscall ("capset", 185, 2, "i:pp "), + new Syscall ("sigaltstack", 186, 2, "i:PP "), + new Syscall ("sendfile", 187, 4, "i:iipi "), + new Syscall ("getpmsg", 188), + new Syscall ("putpmsg", 189), + new Syscall ("vfork", 190, 0, "i: "), + new Syscall ("ugetrlimit", 191), + new Syscall ("mmap", 192, 6, "b:aniiii "), + new Syscall ("truncate64", 193, 3, "i:shl "), + new Syscall ("ftruncate64", 194, 3, "i:ihl "), + new Syscall ("stat64", 195, 2, "i:sp "), + new Syscall ("lstat64", 196, 2, "i:sp "), + new Syscall ("fstat64", 197, 2, "i:ip "), + new Syscall ("lchown32", 198, 3, "i:sii "), + new Syscall ("getuid32", 199), + new Syscall ("getgid32", 200), + new Syscall ("geteuid32", 201), + new Syscall ("getegid32", 202), + new Syscall ("setreuid32", 203, 2, "i:ii "), + new Syscall ("setregid32", 204, 2, "i:ii "), + new Syscall ("getgroups32", 205, 2, "i:ip "), + new Syscall ("setgroups32", 206, 2, "i:ip "), + new Syscall ("fchown32", 207, 3, "i:iii "), + new Syscall ("setresuid32", 208, 3, "i:iii "), + new Syscall ("getresuid32", 209, 3, "i:ppp "), + new Syscall ("setresgid32", 210, 3, "i:iii "), + new Syscall ("getresgid32", 211, 3, "i:ppp "), + new Syscall ("chown32", 212, 3, "i:sii "), + new Syscall ("setuid32", 213, 1, "i:i "), + new Syscall ("setgid32", 214, 1, "i:i "), + new Syscall ("setfsuid32", 215, 1, "i:i "), + new Syscall ("setfsgid32", 216, 1, "i:i "), + new Syscall ("pivot_root", 217, 2, "i:ss "), + new Syscall ("mincore", 218, 3, "i:anV "), + new Syscall ("madvise", 219, 3, "i:pii "), + new Syscall ("getdents64", 220, 3, "i:ipi "), + new Syscall ("fcntl64", 221, 3, "i:iip "), + new Syscall (222), + new Syscall (223), + new Syscall ("gettid", 224, 0), + new Syscall ("readahead", 225, 4, "i:ihli "), + new Syscall ("setxattr", 226), + new Syscall ("lsetxattr", 227), + new Syscall ("fsetxattr", 228), + new Syscall ("getxattr", 229), + new Syscall ("lgetxattr", 230), + new Syscall ("fgetxattr", 231), + new Syscall ("listxattr", 232), + new Syscall ("llistxattr", 233), + new Syscall ("flistxattr", 234), + new Syscall ("removexattr", 235), + new Syscall ("lremovexattr", 236), + new Syscall ("fremovexattr", 237), + new Syscall ("tkill", 238, 2, "i:ii "), + new Syscall ("sendfile64", 239, 4, "i:iipi "), + new Syscall ("futex", 240, 4, "i:piip "), + new Syscall ("sched_setaffinity", 241), + new Syscall ("sched_getaffinity", 242), + new Syscall ("set_thread_area", 243, 1, "i:p "), + new Syscall ("get_thread_area", 244, 1, "i:p "), + new Syscall ("io_setup", 245, 2, "i:ip "), + new Syscall ("io_destroy", 246, 1, "i:i "), + new Syscall ("io_getevents", 247, 5, "i:iiipp "), + new Syscall ("io_submit", 248, 3, "i:iip "), + new Syscall ("io_cancel", 249, 3, "i:ipp "), + new Syscall ("fadvise64", 250), + new Syscall (251), + new Syscall ("exit_group", 252, 1, " :i ", true), + new Syscall ("lookup_dcookie", 253), + new Syscall ("epoll_create", 254), + new Syscall ("epoll_ctl", 255), + new Syscall ("epoll_wait", 256), + new Syscall ("remap_file_pages", 257), + new Syscall ("set_tid_address", 258), + new Syscall ("timer_create", 259), + new Syscall ("timer_settime", 260), + new Syscall ("timer_gettime", 261), + new Syscall ("timer_getoverrun", 262), + new Syscall ("timer_delete", 263), + new Syscall ("clock_settime", 264), + new Syscall ("clock_gettime", 265), + new Syscall ("clock_getres", 266), + new Syscall ("clock_nanosleep", 267), + new Syscall ("statfs64", 268), + new Syscall ("fstatfs64", 269), + new Syscall ("tgkill", 270), + new Syscall ("utimes", 271), + new Syscall ("fadvise64_64", 272), + }; } Index: frysk-core/frysk/proc/LinuxIa32.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxIa32.java,v retrieving revision 1.8 diff -u -r1.8 LinuxIa32.java --- frysk-core/frysk/proc/LinuxIa32.java 11 Jul 2006 21:25:25 -0000 1.8 +++ frysk-core/frysk/proc/LinuxIa32.java 8 Sep 2006 10:55:50 -0000 @@ -39,53 +39,435 @@ package frysk.proc; +import java.util.HashMap; + class LinuxIa32 - extends IsaIA32 implements SyscallEventDecoder + extends IsaIA32 implements SyscallEventDecoder { - private static LinuxIa32 isa; - static LinuxIa32 isaSingleton () + private static LinuxIa32 isa; + static LinuxIa32 isaSingleton () + { + if (isa == null) + isa = new LinuxIa32 (); + return isa; + } + + private static final int SOCKET_NUM = 102; + private static final int IPC_NUM = 117; + + // This is used to keep track of syscalls whose number we do not + // know. + static HashMap unknownSyscalls; + + private SyscallEventInfo info; + public SyscallEventInfo getSyscallEventInfo () + { + if (info == null) + info = new SyscallEventInfo () + { + public int number (Task task) + { + return (int)getRegisterByName ("orig_eax").get (task); + } + public long returnCode (Task task) + { + return getRegisterByName ("eax").get (task); + } + public long arg (Task task, int n) + { + int num = number (task); + + if (n == 0) + return num; + + /** For socket_syscall and ipc_syscall*/ + if (num == SOCKET_NUM || num == IPC_NUM) + { + /** FIXME: Get arguments from memory via PTRACE_PEEKDATA. */ + return 0; + } + else + { + switch (n) + { + case 1: + return getRegisterByName("ebx").get (task); + case 2: + return getRegisterByName("ecx").get (task); + case 3: + return getRegisterByName("edx").get (task); + case 4: + return getRegisterByName("esi").get (task); + case 5: + return getRegisterByName("edi").get (task); + case 6: + return getRegisterByName("eax").get (task); + default: + throw new RuntimeException ("unknown syscall arg"); + } + } + } + + public Syscall getSyscall(Task task) + { + int number = this.number(task); + + if (number != SOCKET_NUM && number != IPC_NUM) + return syscallByNum (number, task); + else + { + /** sub syscall number is in %ebx. */ + int subSyscallNumber = (int) getRegisterByName("ebx").get (task); + + if (number == SOCKET_NUM) + { + return socketSubcallList[subSyscallNumber]; + } + else + { + return ipcSubcallList[subSyscallNumber]; + } + } + } + + }; + return info; + } + + static Syscall[] syscallList = { + new Syscall (0), + new Syscall ("exit", 1, 1), + new Syscall ("fork", 2, 0, "i: "), + new Syscall ("read", 3, 3, "i:ibn "), + new Syscall ("write", 4, 3, "i:ibn "), + new Syscall ("open", 5, 3, "i:siv "), + new Syscall ("close", 6, 1, "i:i "), + new Syscall ("waitpid", 7, 3, "i:ipi "), + new Syscall ("creat", 8, 2, "i:sv"), + new Syscall ("link", 9, 2, "i:ss "), + new Syscall ("unlink", 10, 1, "i:s "), + new Syscall ("execve", 11, 3, "i:ppp "), + new Syscall ("chdir", 12, 1, "i:s "), + new Syscall ("time", 13, 1, "i:P "), + new Syscall ("sys_mknod", 14, 3, "i:sii "), + new Syscall ("chmod", 15, 2, "i:si "), + new Syscall ("lchown", 16, 3, "i:sii "), + new Syscall ("break", 17), + new Syscall ("old_stat", 18, 3, "i:pp "), + new Syscall ("lseek", 19, 3, "i:iii "), + new Syscall ("getpid", 20, 0, "i: "), + new Syscall ("mount", 21, 5, "i:sssip "), + new Syscall ("umount", 22, 1, "i:s "), + new Syscall ("setuid", 23, 1, "i:i "), + new Syscall ("getuid", 24, 0, "i: "), + new Syscall ("stime", 25, 1, "i:p "), + new Syscall ("ptrace", 26, 4, "i:iiii "), + new Syscall ("alarm", 27, 1, "i:i "), + new Syscall ("old_fstat", 28, 2, "i:ip "), + new Syscall ("pause", 29, 0, "i: "), + new Syscall ("utime", 30, 2, "i:sP "), + new Syscall ("stty", 31), + new Syscall ("gtty", 32), + new Syscall ("access", 33, 2, "i:si "), + new Syscall ("nice", 34, 1, "i:i "), + new Syscall ("ftime", 35, 1, "i:p "), + new Syscall ("sync", 36, 0, "i: "), + new Syscall ("kill", 37, 2, "i:ii "), + new Syscall ("rename", 38, 2, "i:ss "), + new Syscall ("mkdir", 39, 2, "i:si "), + new Syscall ("rmdir", 40, 1, "i:s "), + new Syscall ("dup", 41, 1, "i:i "), + new Syscall ("pipe", 42, 1, "i:f "), + new Syscall ("times", 43, 1, "i:p "), + new Syscall ("prof", 44), + new Syscall ("brk", 45, 1, "i:p "), + new Syscall ("setgid", 46, 1, "i:i "), + new Syscall ("getgid", 47, 0, "i: "), + new Syscall ("signal", 48, 2, "i:ii "), + new Syscall ("geteuid", 49, 0, "i: "), + new Syscall ("getegid", 50, 0, "i: "), + new Syscall ("acct", 51, 1, "i:S "), + new Syscall ("umount2", 52, 2, "i:si "), + new Syscall ("lock", 53), + new Syscall ("ioctl", 54, 3, "i:iiI "), + new Syscall ("fcntl", 55, 3, "i:iiF "), + new Syscall ("mpx", 56), + new Syscall ("setpgid", 57, 2, "i:ii "), + new Syscall ("ulimit", 58, 2, "i:ii "), + new Syscall ("oldolduname", 59), + new Syscall ("umask", 60, 1, "i:i "), + new Syscall ("chroot", 61, 1, "i:s "), + new Syscall ("ustat", 62, 2, "i:ip "), + new Syscall ("dup2", 63, 2, "i:ii "), + new Syscall ("getppid", 64, 0, "i: "), + new Syscall ("getpgrp", 65, 0, "i: "), + new Syscall ("setsid", 66, 0, "i: "), + new Syscall ("sigaction", 67, 3, "i:ipp "), + new Syscall ("sgetmask", 68), + new Syscall ("ssetmask", 69), + new Syscall ("setreuid", 70, 2, "i:ii "), + new Syscall ("setregid", 71, 2, "i:ii "), + new Syscall ("sigsuspend", 72, 1, "i:p "), + new Syscall ("sigpending", 73, 1, "i:p "), + new Syscall ("sethostname", 74, 2, "i:pi "), + new Syscall ("setrlimit", 75, 2, "i:ip "), + new Syscall ("getrlimit", 76, 2, "i:ip "), + new Syscall ("getrusage", 77, 2, "i:ip "), + new Syscall ("gettimeofday", 78, 2, "i:PP "), + new Syscall ("settimeofday", 79, 2, "i:PP "), + new Syscall ("getgroups", 80, 2, "i:ip "), + new Syscall ("setgroups", 81, 2, "i:ip "), + new Syscall ("select", 82, 5, "i:iPPPP "), + new Syscall ("symlink", 83, 2, "i:ss "), + new Syscall ("oldlstat", 84, 2, "i:pp "), + new Syscall ("readlink", 85, 3, "i:spi "), + new Syscall ("uselib", 86, 1, "i:s "), + new Syscall ("swapon", 87, 2, "i:si "), + new Syscall ("reboot", 88, 1, "i:i "), + new Syscall (89), + new Syscall ("mmap", 90, 6, "b:aniiii "), + new Syscall ("munmap", 91, 2, "i:ai "), + new Syscall ("truncate", 92, 2, "i:si "), + new Syscall ("ftruncate", 93, 2, "i:ii "), + new Syscall ("fchmod", 94, 2, "i:ii "), + new Syscall ("fchown", 95, 3, "i:iii "), + new Syscall ("getpriority", 96, 2, "i:ii "), + new Syscall ("setpriority", 97, 3, "i:iii "), + new Syscall ("profil", 98, 4, "i:piii "), + new Syscall ("statfs", 99, 2, "i:sp "), + new Syscall ("fstatfs", 100, 2, "i:ip "), + new Syscall ("ioperm", 101, 3, "i:iii "), + new Syscall ("socketcall", 102, 2, "i:ip "), + new Syscall ("klogctl", 103, 3, "i:isi "), + new Syscall ("setitimer", 104, 3, "i:ipp "), + new Syscall ("getitimer", 105, 2, "i:ip "), + new Syscall ("sys_stat", 106, 2, "i:sp "), + new Syscall ("sys_lstat", 107, 2, "i:sp "), + new Syscall ("sys_fstat", 108, 2, "i:ip "), + new Syscall ("old_uname", 109, 1, "i:p "), + new Syscall ("iopl", 110, 1, "i:i "), + new Syscall ("vhangup", 111, 1, "i:i "), + new Syscall ("idle", 112, 0, "i: "), + new Syscall (113), + new Syscall ("wait4", 114, 4, "i:iWiP "), + new Syscall ("swapoff", 115, 1, "i:s "), + new Syscall ("sysinfo", 116, 1, "i:p "), + new Syscall ("ipc", 117, 6, "i:iiiipi "), + new Syscall ("fsync", 118, 1, "i:i "), + new Syscall ("sigreturn", 119), + new Syscall ("clone", 120, 2, "i:ip "), + new Syscall ("setdomain", 121, 2, "i:si "), + new Syscall ("uname", 122, 1, "i:p "), + new Syscall ("modify_ldt", 123, 3, "i:ipi "), + new Syscall ("adjtimex", 124, 1, "i:p "), + new Syscall ("mprotect", 125, 3, "i:aii "), + new Syscall ("sigprocmask", 126, 3, "i:ipp "), + new Syscall ("create_module", 127, 3), + new Syscall ("init_module", 128, 5), + new Syscall ("delete_module", 129, 3), + new Syscall ("get_kernel_syms", 130, 1, "i:p "), + new Syscall ("quotactl", 131, 4, "i:isip "), + new Syscall ("getpgid", 132, 1, "i:i "), + new Syscall ("fchdir", 133, 1, "i:i "), + new Syscall ("bdflush", 134, 2, "i:ii "), + new Syscall ("sysfs", 135, 1, "i:i "), + new Syscall ("personality", 136, 1, "i:i "), + new Syscall ("afs_syscall", 137), + new Syscall ("setfsuid", 138, 1, "i:i "), + new Syscall ("setfsgid", 139, 1, "i:i "), + new Syscall ("llseek", 140, 5, "i:iuupi "), + new Syscall ("s_getdents", 141, 3, "i:ipi "), + new Syscall ("select", 142, 5, "i:iPPPP "), + new Syscall ("flock", 143, 2, "i:ii "), + new Syscall ("msync", 144, 3, "i:aii "), + new Syscall ("readv", 145, 3, "i:ipi "), + new Syscall ("writev", 146, 3, "i:ipi "), + new Syscall ("getsid", 147, 1, "i:i "), + new Syscall ("fdatasync", 148, 1, "i:i "), + new Syscall ("sysctl", 149, 1, "i:p "), + new Syscall ("mlock", 150, 2, "i:bn "), + new Syscall ("munlock", 151, 2, "i:ai "), + new Syscall ("mlockall", 152, 1, "i:i "), + new Syscall ("munlockall", 153, 0, "i: "), + new Syscall ("sched_setp", 154, 2, "i:ip "), + new Syscall ("sched_getp", 155, 2, "i:ip "), + new Syscall ("sched_sets", 156, 3, "i:iip "), + new Syscall ("sched_gets", 157, 1, "i:i "), + new Syscall ("sched_yield", 158, 0, "i: "), + new Syscall ("sched_primax", 159, 1, "i:i "), + new Syscall ("sched_primin", 160, 1, "i:i "), + new Syscall ("sched_rr_gi", 161, 2, "i:ip "), + new Syscall ("nanosleep", 162, 2, "i:pp "), + new Syscall ("mremap", 163, 4, "b:aini "), + new Syscall ("setresuid", 164, 3, "i:iii "), + new Syscall ("getresuid", 165, 3, "i:ppp "), + new Syscall ("vm86", 166, 1, "i:p "), + new Syscall ("query_module", 167, 5, "i:sipip "), + new Syscall ("poll", 168, 3, "i:pii "), + new Syscall ("nfsservctl", 169, 3, "i:ipp "), + new Syscall ("setresgid", 170, 3, "i:iii "), + new Syscall ("getresgid", 171, 3, "i:ppp "), + new Syscall ("prctl", 172, 5, "i:iiiii "), + new Syscall ("rt_sigreturn", 173), + new Syscall ("rt_sigaction", 174), + new Syscall ("rt_sigprocmask", 175), + new Syscall ("rt_sigpending", 176), + new Syscall ("rt_sigtimedwait", 177), + new Syscall ("rt_sigqueueinfo", 178), + new Syscall ("rt_sigsuspend", 179), + new Syscall ("pread64", 180), + new Syscall ("pwrite64", 181), + new Syscall ("chown", 182, 3, "i:sii "), + new Syscall ("getcwd", 183, 2, "i:bi "), + new Syscall ("capget", 184, 2, "i:pp "), + new Syscall ("capset", 185, 2, "i:pp "), + new Syscall ("sigaltstack", 186, 2, "i:PP "), + new Syscall ("sendfile", 187, 4, "i:iipi "), + new Syscall ("getpmsg", 188), + new Syscall ("putpmsg", 189), + new Syscall ("vfork", 190, 0, "i: "), + new Syscall ("ugetrlimit", 191), + new Syscall ("mmap", 192, 6, "b:aniiii "), + new Syscall ("truncate64", 193, 3, "i:shl "), + new Syscall ("ftruncate64", 194, 3, "i:ihl "), + new Syscall ("stat64", 195, 2, "i:sp "), + new Syscall ("lstat64", 196, 2, "i:sp "), + new Syscall ("fstat64", 197, 2, "i:ip "), + new Syscall ("lchown32", 198, 3, "i:sii "), + new Syscall ("getuid32", 199), + new Syscall ("getgid32", 200), + new Syscall ("geteuid32", 201), + new Syscall ("getegid32", 202), + new Syscall ("setreuid32", 203, 2, "i:ii "), + new Syscall ("setregid32", 204, 2, "i:ii "), + new Syscall ("getgroups32", 205, 2, "i:ip "), + new Syscall ("setgroups32", 206, 2, "i:ip "), + new Syscall ("fchown32", 207, 3, "i:iii "), + new Syscall ("setresuid32", 208, 3, "i:iii "), + new Syscall ("getresuid32", 209, 3, "i:ppp "), + new Syscall ("setresgid32", 210, 3, "i:iii "), + new Syscall ("getresgid32", 211, 3, "i:ppp "), + new Syscall ("chown32", 212, 3, "i:sii "), + new Syscall ("setuid32", 213, 1, "i:i "), + new Syscall ("setgid32", 214, 1, "i:i "), + new Syscall ("setfsuid32", 215, 1, "i:i "), + new Syscall ("setfsgid32", 216, 1, "i:i "), + new Syscall ("pivot_root", 217, 2, "i:ss "), + new Syscall ("mincore", 218, 3, "i:anV "), + new Syscall ("madvise", 219, 3, "i:pii "), + new Syscall ("getdents64", 220, 3, "i:ipi "), + new Syscall ("fcntl64", 221, 3, "i:iip "), + new Syscall (222), + new Syscall (223), + new Syscall ("gettid", 224, 0), + new Syscall ("readahead", 225, 4, "i:ihli "), + new Syscall ("setxattr", 226), + new Syscall ("lsetxattr", 227), + new Syscall ("fsetxattr", 228), + new Syscall ("getxattr", 229), + new Syscall ("lgetxattr", 230), + new Syscall ("fgetxattr", 231), + new Syscall ("listxattr", 232), + new Syscall ("llistxattr", 233), + new Syscall ("flistxattr", 234), + new Syscall ("removexattr", 235), + new Syscall ("lremovexattr", 236), + new Syscall ("fremovexattr", 237), + new Syscall ("tkill", 238, 2, "i:ii "), + new Syscall ("sendfile64", 239, 4, "i:iipi "), + new Syscall ("futex", 240, 4, "i:piip "), + new Syscall ("sched_setaffinity", 241), + new Syscall ("sched_getaffinity", 242), + new Syscall ("set_thread_area", 243, 1, "i:p "), + new Syscall ("get_thread_area", 244, 1, "i:p "), + new Syscall ("io_setup", 245, 2, "i:ip "), + new Syscall ("io_destroy", 246, 1, "i:i "), + new Syscall ("io_getevents", 247, 5, "i:iiipp "), + new Syscall ("io_submit", 248, 3, "i:iip "), + new Syscall ("io_cancel", 249, 3, "i:ipp "), + new Syscall ("fadvise64", 250), + new Syscall (251), + new Syscall ("exit_group", 252, 1, " :i ", true), + new Syscall ("lookup_dcookie", 253), + new Syscall ("epoll_create", 254), + new Syscall ("epoll_ctl", 255), + new Syscall ("epoll_wait", 256), + new Syscall ("remap_file_pages", 257), + new Syscall ("set_tid_address", 258), + new Syscall ("timer_create", 259), + new Syscall ("timer_settime", 260), + new Syscall ("timer_gettime", 261), + new Syscall ("timer_getoverrun", 262), + new Syscall ("timer_delete", 263), + new Syscall ("clock_settime", 264), + new Syscall ("clock_gettime", 265), + new Syscall ("clock_getres", 266), + new Syscall ("clock_nanosleep", 267), + new Syscall ("statfs64", 268), + new Syscall ("fstatfs64", 269), + new Syscall ("tgkill", 270), + new Syscall ("utimes", 271), + new Syscall ("fadvise64_64", 272) + }; + + + static class SubSyscall + extends Syscall + { + SubSyscall (String name, int number) { - if (isa == null) - isa = new LinuxIa32 (); - return isa; + super (name, number); } - - private SyscallEventInfo info; - public SyscallEventInfo getSyscallEventInfo () + SubSyscall (String name, int number, int numArgs, String argList) { - if (info == null) - info = new SyscallEventInfo () - { - public int number (Task task) - { - return (int)getRegisterByName ("orig_eax").get (task); - } - public long returnCode (Task task) - { - return getRegisterByName ("eax").get (task); - } - public long arg (Task task, int n) - { - switch (n) { - case 0: - return (long)number (task); - case 1: - return getRegisterByName("ebx").get (task); - case 2: - return getRegisterByName("ecx").get (task); - case 3: - return getRegisterByName("edx").get (task); - case 4: - return getRegisterByName("esi").get (task); - case 5: - return getRegisterByName("edi").get (task); - case 6: - return getRegisterByName("eax").get (task); - default: - throw new RuntimeException ("unknown syscall arg"); - } - } - }; - return info; + super (name, number, numArgs, argList); } + } + + static Syscall[] socketSubcallList = { + new SubSyscall ("", SOCKET_NUM), + new SubSyscall ("socket", SOCKET_NUM, 3, "i:iii"), + new SubSyscall ("bind", SOCKET_NUM, 3, "i:ipi "), + new SubSyscall ("connect", SOCKET_NUM, 3, "i:ipi "), + new SubSyscall ("listen", SOCKET_NUM, 2, "i:ii "), + new SubSyscall ("accept", SOCKET_NUM, 3, "i:ipp "), + new SubSyscall ("getsockname",SOCKET_NUM, 3, "i:ipp "), + new SubSyscall ("getpeername",SOCKET_NUM, 4, "i:iiip "), + new SubSyscall ("socketpair", SOCKET_NUM, 4, "i:iiip "), + new SubSyscall ("send", SOCKET_NUM, 4, "i:ipii "), + new SubSyscall ("recv", SOCKET_NUM, 4, "i:ipii "), + new SubSyscall ("sendto", SOCKET_NUM, 6, "i:ipiipi"), + new SubSyscall ("recvfrom", SOCKET_NUM, 6, "i:ipiipp "), + new SubSyscall ("shutdown", SOCKET_NUM, 2, "i:ii "), + new SubSyscall ("setsockopt", SOCKET_NUM, 5, "i:iiipp ") + }; + + static Syscall[] ipcSubcallList = { + new SubSyscall ("semop", IPC_NUM), + new SubSyscall ("semget", IPC_NUM), + new SubSyscall ("semctl", IPC_NUM), + new SubSyscall ("semtimedop", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("msgsnd", IPC_NUM), + new SubSyscall ("msgrcv", IPC_NUM), + new SubSyscall ("msgget", IPC_NUM), + new SubSyscall ("msgctl", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("", IPC_NUM), + new SubSyscall ("shmat", IPC_NUM), + new SubSyscall ("shmdt", IPC_NUM), + new SubSyscall ("shmget", IPC_NUM), + new SubSyscall ("shmctl", IPC_NUM) + }; + + } Index: frysk-core/frysk/proc/LinuxPPC.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxPPC.java,v retrieving revision 1.3 diff -u -r1.3 LinuxPPC.java --- frysk-core/frysk/proc/LinuxPPC.java 4 Sep 2006 07:40:06 -0000 1.3 +++ frysk-core/frysk/proc/LinuxPPC.java 8 Sep 2006 10:55:50 -0000 @@ -2,6 +2,8 @@ package frysk.proc; +import java.util.HashMap; + import java.util.logging.Level; import java.util.logging.Logger; @@ -18,6 +20,10 @@ return isa; } + // This is used to keep track of syscalls whose number we do not + // know. + static HashMap unknownSyscalls; + private SyscallEventInfo info; public SyscallEventInfo getSyscallEventInfo () @@ -61,7 +67,284 @@ throw new RuntimeException ("unknown syscall arg"); } } + }; return info; } -} \ No newline at end of file + /** FIXME: This syscallList is i386 specific. */ + static Syscall[] syscallList = { + new Syscall (0), + new Syscall ("exit", 1, 1), + new Syscall ("fork", 2, 0, "i: "), + new Syscall ("read", 3, 3, "i:ibn "), + new Syscall ("write", 4, 3, "i:ibn "), + new Syscall ("open", 5, 3, "i:siv "), + new Syscall ("close", 6, 1, "i:i "), + new Syscall ("waitpid", 7, 3, "i:ipi "), + new Syscall ("creat", 8, 2, "i:sv"), + new Syscall ("link", 9, 2, "i:ss "), + new Syscall ("unlink", 10, 1, "i:s "), + new Syscall ("execve", 11, 3, "i:ppp "), + new Syscall ("chdir", 12, 1, "i:s "), + new Syscall ("time", 13, 1, "i:P "), + new Syscall ("sys_mknod", 14, 3, "i:sii "), + new Syscall ("chmod", 15, 2, "i:si "), + new Syscall ("lchown", 16, 3, "i:sii "), + new Syscall ("break", 17), + new Syscall ("old_stat", 18, 3, "i:pp "), + new Syscall ("lseek", 19, 3, "i:iii "), + new Syscall ("getpid", 20, 0, "i: "), + new Syscall ("mount", 21, 5, "i:sssip "), + new Syscall ("umount", 22, 1, "i:s "), + new Syscall ("setuid", 23, 1, "i:i "), + new Syscall ("getuid", 24, 0, "i: "), + new Syscall ("stime", 25, 1, "i:p "), + new Syscall ("ptrace", 26, 4, "i:iiii "), + new Syscall ("alarm", 27, 1, "i:i "), + new Syscall ("old_fstat", 28, 2, "i:ip "), + new Syscall ("pause", 29, 0, "i: "), + new Syscall ("utime", 30, 2, "i:sP "), + new Syscall ("stty", 31), + new Syscall ("gtty", 32), + new Syscall ("access", 33, 2, "i:si "), + new Syscall ("nice", 34, 1, "i:i "), + new Syscall ("ftime", 35, 1, "i:p "), + new Syscall ("sync", 36, 0, "i: "), + new Syscall ("kill", 37, 2, "i:ii "), + new Syscall ("rename", 38, 2, "i:ss "), + new Syscall ("mkdir", 39, 2, "i:si "), + new Syscall ("rmdir", 40, 1, "i:s "), + new Syscall ("dup", 41, 1, "i:i "), + new Syscall ("pipe", 42, 1, "i:f "), + new Syscall ("times", 43, 1, "i:p "), + new Syscall ("prof", 44), + new Syscall ("brk", 45, 1, "i:p "), + new Syscall ("setgid", 46, 1, "i:i "), + new Syscall ("getgid", 47, 0, "i: "), + new Syscall ("signal", 48, 2, "i:ii "), + new Syscall ("geteuid", 49, 0, "i: "), + new Syscall ("getegid", 50, 0, "i: "), + new Syscall ("acct", 51, 1, "i:S "), + new Syscall ("umount2", 52, 2, "i:si "), + new Syscall ("lock", 53), + new Syscall ("ioctl", 54, 3, "i:iiI "), + new Syscall ("fcntl", 55, 3, "i:iiF "), + new Syscall ("mpx", 56), + new Syscall ("setpgid", 57, 2, "i:ii "), + new Syscall ("ulimit", 58, 2, "i:ii "), + new Syscall ("oldolduname", 59), + new Syscall ("umask", 60, 1, "i:i "), + new Syscall ("chroot", 61, 1, "i:s "), + new Syscall ("ustat", 62, 2, "i:ip "), + new Syscall ("dup2", 63, 2, "i:ii "), + new Syscall ("getppid", 64, 0, "i: "), + new Syscall ("getpgrp", 65, 0, "i: "), + new Syscall ("setsid", 66, 0, "i: "), + new Syscall ("sigaction", 67, 3, "i:ipp "), + new Syscall ("sgetmask", 68), + new Syscall ("ssetmask", 69), + new Syscall ("setreuid", 70, 2, "i:ii "), + new Syscall ("setregid", 71, 2, "i:ii "), + new Syscall ("sigsuspend", 72, 1, "i:p "), + new Syscall ("sigpending", 73, 1, "i:p "), + new Syscall ("sethostname", 74, 2, "i:pi "), + new Syscall ("setrlimit", 75, 2, "i:ip "), + new Syscall ("getrlimit", 76, 2, "i:ip "), + new Syscall ("getrusage", 77, 2, "i:ip "), + new Syscall ("gettimeofday", 78, 2, "i:PP "), + new Syscall ("settimeofday", 79, 2, "i:PP "), + new Syscall ("getgroups", 80, 2, "i:ip "), + new Syscall ("setgroups", 81, 2, "i:ip "), + new Syscall ("select", 82, 5, "i:iPPPP "), + new Syscall ("symlink", 83, 2, "i:ss "), + new Syscall ("oldlstat", 84, 2, "i:pp "), + new Syscall ("readlink", 85, 3, "i:spi "), + new Syscall ("uselib", 86, 1, "i:s "), + new Syscall ("swapon", 87, 2, "i:si "), + new Syscall ("reboot", 88, 1, "i:i "), + new Syscall (89), + new Syscall ("mmap", 90, 6, "b:aniiii "), + new Syscall ("munmap", 91, 2, "i:ai "), + new Syscall ("truncate", 92, 2, "i:si "), + new Syscall ("ftruncate", 93, 2, "i:ii "), + new Syscall ("fchmod", 94, 2, "i:ii "), + new Syscall ("fchown", 95, 3, "i:iii "), + new Syscall ("getpriority", 96, 2, "i:ii "), + new Syscall ("setpriority", 97, 3, "i:iii "), + new Syscall ("profil", 98, 4, "i:piii "), + new Syscall ("statfs", 99, 2, "i:sp "), + new Syscall ("fstatfs", 100, 2, "i:ip "), + new Syscall ("ioperm", 101, 3, "i:iii "), + new Syscall ("socketcall", 102, 2, "i:ip "), + new Syscall ("klogctl", 103, 3, "i:isi "), + new Syscall ("setitimer", 104, 3, "i:ipp "), + new Syscall ("getitimer", 105, 2, "i:ip "), + new Syscall ("sys_stat", 106, 2, "i:sp "), + new Syscall ("sys_lstat", 107, 2, "i:sp "), + new Syscall ("sys_fstat", 108, 2, "i:ip "), + new Syscall ("old_uname", 109, 1, "i:p "), + new Syscall ("iopl", 110, 1, "i:i "), + new Syscall ("vhangup", 111, 1, "i:i "), + new Syscall ("idle", 112, 0, "i: "), + new Syscall (113), + new Syscall ("wait4", 114, 4, "i:iWiP "), + new Syscall ("swapoff", 115, 1, "i:s "), + new Syscall ("sysinfo", 116, 1, "i:p "), + new Syscall ("ipc", 117, 6, "i:iiiipi "), + new Syscall ("fsync", 118, 1, "i:i "), + new Syscall ("sigreturn", 119), + new Syscall ("clone", 120, 2, "i:ip "), + new Syscall ("setdomain", 121, 2, "i:si "), + new Syscall ("uname", 122, 1, "i:p "), + new Syscall ("modify_ldt", 123, 3, "i:ipi "), + new Syscall ("adjtimex", 124, 1, "i:p "), + new Syscall ("mprotect", 125, 3, "i:aii "), + new Syscall ("sigprocmask", 126, 3, "i:ipp "), + new Syscall ("create_module", 127, 3), + new Syscall ("init_module", 128, 5), + new Syscall ("delete_module", 129, 3), + new Syscall ("get_kernel_syms", 130, 1, "i:p "), + new Syscall ("quotactl", 131, 4, "i:isip "), + new Syscall ("getpgid", 132, 1, "i:i "), + new Syscall ("fchdir", 133, 1, "i:i "), + new Syscall ("bdflush", 134, 2, "i:ii "), + new Syscall ("sysfs", 135, 1, "i:i "), + new Syscall ("personality", 136, 1, "i:i "), + new Syscall ("afs_syscall", 137), + new Syscall ("setfsuid", 138, 1, "i:i "), + new Syscall ("setfsgid", 139, 1, "i:i "), + new Syscall ("llseek", 140, 5, "i:iuupi "), + new Syscall ("s_getdents", 141, 3, "i:ipi "), + new Syscall ("select", 142, 5, "i:iPPPP "), + new Syscall ("flock", 143, 2, "i:ii "), + new Syscall ("msync", 144, 3, "i:aii "), + new Syscall ("readv", 145, 3, "i:ipi "), + new Syscall ("writev", 146, 3, "i:ipi "), + new Syscall ("getsid", 147, 1, "i:i "), + new Syscall ("fdatasync", 148, 1, "i:i "), + new Syscall ("sysctl", 149, 1, "i:p "), + new Syscall ("mlock", 150, 2, "i:bn "), + new Syscall ("munlock", 151, 2, "i:ai "), + new Syscall ("mlockall", 152, 1, "i:i "), + new Syscall ("munlockall", 153, 0, "i: "), + new Syscall ("sched_setp", 154, 2, "i:ip "), + new Syscall ("sched_getp", 155, 2, "i:ip "), + new Syscall ("sched_sets", 156, 3, "i:iip "), + new Syscall ("sched_gets", 157, 1, "i:i "), + new Syscall ("sched_yield", 158, 0, "i: "), + new Syscall ("sched_primax", 159, 1, "i:i "), + new Syscall ("sched_primin", 160, 1, "i:i "), + new Syscall ("sched_rr_gi", 161, 2, "i:ip "), + new Syscall ("nanosleep", 162, 2, "i:pp "), + new Syscall ("mremap", 163, 4, "b:aini "), + new Syscall ("setresuid", 164, 3, "i:iii "), + new Syscall ("getresuid", 165, 3, "i:ppp "), + new Syscall ("vm86", 166, 1, "i:p "), + new Syscall ("query_module", 167, 5, "i:sipip "), + new Syscall ("poll", 168, 3, "i:pii "), + new Syscall ("nfsservctl", 169, 3, "i:ipp "), + new Syscall ("setresgid", 170, 3, "i:iii "), + new Syscall ("getresgid", 171, 3, "i:ppp "), + new Syscall ("prctl", 172, 5, "i:iiiii "), + new Syscall ("rt_sigreturn", 173), + new Syscall ("rt_sigaction", 174), + new Syscall ("rt_sigprocmask", 175), + new Syscall ("rt_sigpending", 176), + new Syscall ("rt_sigtimedwait", 177), + new Syscall ("rt_sigqueueinfo", 178), + new Syscall ("rt_sigsuspend", 179), + new Syscall ("pread64", 180), + new Syscall ("pwrite64", 181), + new Syscall ("chown", 182, 3, "i:sii "), + new Syscall ("getcwd", 183, 2, "i:bi "), + new Syscall ("capget", 184, 2, "i:pp "), + new Syscall ("capset", 185, 2, "i:pp "), + new Syscall ("sigaltstack", 186, 2, "i:PP "), + new Syscall ("sendfile", 187, 4, "i:iipi "), + new Syscall ("getpmsg", 188), + new Syscall ("putpmsg", 189), + new Syscall ("vfork", 190, 0, "i: "), + new Syscall ("ugetrlimit", 191), + new Syscall ("mmap", 192, 6, "b:aniiii "), + new Syscall ("truncate64", 193, 3, "i:shl "), + new Syscall ("ftruncate64", 194, 3, "i:ihl "), + new Syscall ("stat64", 195, 2, "i:sp "), + new Syscall ("lstat64", 196, 2, "i:sp "), + new Syscall ("fstat64", 197, 2, "i:ip "), + new Syscall ("lchown32", 198, 3, "i:sii "), + new Syscall ("getuid32", 199), + new Syscall ("getgid32", 200), + new Syscall ("geteuid32", 201), + new Syscall ("getegid32", 202), + new Syscall ("setreuid32", 203, 2, "i:ii "), + new Syscall ("setregid32", 204, 2, "i:ii "), + new Syscall ("getgroups32", 205, 2, "i:ip "), + new Syscall ("setgroups32", 206, 2, "i:ip "), + new Syscall ("fchown32", 207, 3, "i:iii "), + new Syscall ("setresuid32", 208, 3, "i:iii "), + new Syscall ("getresuid32", 209, 3, "i:ppp "), + new Syscall ("setresgid32", 210, 3, "i:iii "), + new Syscall ("getresgid32", 211, 3, "i:ppp "), + new Syscall ("chown32", 212, 3, "i:sii "), + new Syscall ("setuid32", 213, 1, "i:i "), + new Syscall ("setgid32", 214, 1, "i:i "), + new Syscall ("setfsuid32", 215, 1, "i:i "), + new Syscall ("setfsgid32", 216, 1, "i:i "), + new Syscall ("pivot_root", 217, 2, "i:ss "), + new Syscall ("mincore", 218, 3, "i:anV "), + new Syscall ("madvise", 219, 3, "i:pii "), + new Syscall ("getdents64", 220, 3, "i:ipi "), + new Syscall ("fcntl64", 221, 3, "i:iip "), + new Syscall (222), + new Syscall (223), + new Syscall ("gettid", 224, 0), + new Syscall ("readahead", 225, 4, "i:ihli "), + new Syscall ("setxattr", 226), + new Syscall ("lsetxattr", 227), + new Syscall ("fsetxattr", 228), + new Syscall ("getxattr", 229), + new Syscall ("lgetxattr", 230), + new Syscall ("fgetxattr", 231), + new Syscall ("listxattr", 232), + new Syscall ("llistxattr", 233), + new Syscall ("flistxattr", 234), + new Syscall ("removexattr", 235), + new Syscall ("lremovexattr", 236), + new Syscall ("fremovexattr", 237), + new Syscall ("tkill", 238, 2, "i:ii "), + new Syscall ("sendfile64", 239, 4, "i:iipi "), + new Syscall ("futex", 240, 4, "i:piip "), + new Syscall ("sched_setaffinity", 241), + new Syscall ("sched_getaffinity", 242), + new Syscall ("set_thread_area", 243, 1, "i:p "), + new Syscall ("get_thread_area", 244, 1, "i:p "), + new Syscall ("io_setup", 245, 2, "i:ip "), + new Syscall ("io_destroy", 246, 1, "i:i "), + new Syscall ("io_getevents", 247, 5, "i:iiipp "), + new Syscall ("io_submit", 248, 3, "i:iip "), + new Syscall ("io_cancel", 249, 3, "i:ipp "), + new Syscall ("fadvise64", 250), + new Syscall (251), + new Syscall ("exit_group", 252, 1, " :i ", true), + new Syscall ("lookup_dcookie", 253), + new Syscall ("epoll_create", 254), + new Syscall ("epoll_ctl", 255), + new Syscall ("epoll_wait", 256), + new Syscall ("remap_file_pages", 257), + new Syscall ("set_tid_address", 258), + new Syscall ("timer_create", 259), + new Syscall ("timer_settime", 260), + new Syscall ("timer_gettime", 261), + new Syscall ("timer_getoverrun", 262), + new Syscall ("timer_delete", 263), + new Syscall ("clock_settime", 264), + new Syscall ("clock_gettime", 265), + new Syscall ("clock_getres", 266), + new Syscall ("clock_nanosleep", 267), + new Syscall ("statfs64", 268), + new Syscall ("fstatfs64", 269), + new Syscall ("tgkill", 270), + new Syscall ("utimes", 271), + new Syscall ("fadvise64_64", 272), + }; +} Index: frysk-core/frysk/proc/LinuxPPC64.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxPPC64.java,v retrieving revision 1.3 diff -u -r1.3 LinuxPPC64.java --- frysk-core/frysk/proc/LinuxPPC64.java 16 Aug 2006 19:09:51 -0000 1.3 +++ frysk-core/frysk/proc/LinuxPPC64.java 8 Sep 2006 10:55:50 -0000 @@ -2,6 +2,8 @@ package frysk.proc; +import java.util.HashMap; + import java.util.logging.Level; import java.util.logging.Logger; @@ -18,6 +20,10 @@ return isa; } + // This is used to keep track of syscalls whose number we do not + // know. + static HashMap unknownSyscalls; + private SyscallEventInfo info; public SyscallEventInfo getSyscallEventInfo () { @@ -59,7 +65,285 @@ throw new RuntimeException ("unknown syscall arg"); } } + }; return info; } + + + static Syscall[] syscallList = { + new Syscall (0), + new Syscall ("exit", 1, 1), + new Syscall ("fork", 2, 0, "i: "), + new Syscall ("read", 3, 3, "i:ibn "), + new Syscall ("write", 4, 3, "i:ibn "), + new Syscall ("open", 5, 3, "i:siv "), + new Syscall ("close", 6, 1, "i:i "), + new Syscall ("waitpid", 7, 3, "i:ipi "), + new Syscall ("creat", 8, 2, "i:sv"), + new Syscall ("link", 9, 2, "i:ss "), + new Syscall ("unlink", 10, 1, "i:s "), + new Syscall ("execve", 11, 3, "i:ppp "), + new Syscall ("chdir", 12, 1, "i:s "), + new Syscall ("time", 13, 1, "i:P "), + new Syscall ("sys_mknod", 14, 3, "i:sii "), + new Syscall ("chmod", 15, 2, "i:si "), + new Syscall ("lchown", 16, 3, "i:sii "), + new Syscall ("break", 17), + new Syscall ("old_stat", 18, 3, "i:pp "), + new Syscall ("lseek", 19, 3, "i:iii "), + new Syscall ("getpid", 20, 0, "i: "), + new Syscall ("mount", 21, 5, "i:sssip "), + new Syscall ("umount", 22, 1, "i:s "), + new Syscall ("setuid", 23, 1, "i:i "), + new Syscall ("getuid", 24, 0, "i: "), + new Syscall ("stime", 25, 1, "i:p "), + new Syscall ("ptrace", 26, 4, "i:iiii "), + new Syscall ("alarm", 27, 1, "i:i "), + new Syscall ("old_fstat", 28, 2, "i:ip "), + new Syscall ("pause", 29, 0, "i: "), + new Syscall ("utime", 30, 2, "i:sP "), + new Syscall ("stty", 31), + new Syscall ("gtty", 32), + new Syscall ("access", 33, 2, "i:si "), + new Syscall ("nice", 34, 1, "i:i "), + new Syscall ("ftime", 35, 1, "i:p "), + new Syscall ("sync", 36, 0, "i: "), + new Syscall ("kill", 37, 2, "i:ii "), + new Syscall ("rename", 38, 2, "i:ss "), + new Syscall ("mkdir", 39, 2, "i:si "), + new Syscall ("rmdir", 40, 1, "i:s "), + new Syscall ("dup", 41, 1, "i:i "), + new Syscall ("pipe", 42, 1, "i:f "), + new Syscall ("times", 43, 1, "i:p "), + new Syscall ("prof", 44), + new Syscall ("brk", 45, 1, "i:p "), + new Syscall ("setgid", 46, 1, "i:i "), + new Syscall ("getgid", 47, 0, "i: "), + new Syscall ("signal", 48, 2, "i:ii "), + new Syscall ("geteuid", 49, 0, "i: "), + new Syscall ("getegid", 50, 0, "i: "), + new Syscall ("acct", 51, 1, "i:S "), + new Syscall ("umount2", 52, 2, "i:si "), + new Syscall ("lock", 53), + new Syscall ("ioctl", 54, 3, "i:iiI "), + new Syscall ("fcntl", 55, 3, "i:iiF "), + new Syscall ("mpx", 56), + new Syscall ("setpgid", 57, 2, "i:ii "), + new Syscall ("ulimit", 58, 2, "i:ii "), + new Syscall ("oldolduname", 59), + new Syscall ("umask", 60, 1, "i:i "), + new Syscall ("chroot", 61, 1, "i:s "), + new Syscall ("ustat", 62, 2, "i:ip "), + new Syscall ("dup2", 63, 2, "i:ii "), + new Syscall ("getppid", 64, 0, "i: "), + new Syscall ("getpgrp", 65, 0, "i: "), + new Syscall ("setsid", 66, 0, "i: "), + new Syscall ("sigaction", 67, 3, "i:ipp "), + new Syscall ("sgetmask", 68), + new Syscall ("ssetmask", 69), + new Syscall ("setreuid", 70, 2, "i:ii "), + new Syscall ("setregid", 71, 2, "i:ii "), + new Syscall ("sigsuspend", 72, 1, "i:p "), + new Syscall ("sigpending", 73, 1, "i:p "), + new Syscall ("sethostname", 74, 2, "i:pi "), + new Syscall ("setrlimit", 75, 2, "i:ip "), + new Syscall ("getrlimit", 76, 2, "i:ip "), + new Syscall ("getrusage", 77, 2, "i:ip "), + new Syscall ("gettimeofday", 78, 2, "i:PP "), + new Syscall ("settimeofday", 79, 2, "i:PP "), + new Syscall ("getgroups", 80, 2, "i:ip "), + new Syscall ("setgroups", 81, 2, "i:ip "), + new Syscall ("select", 82, 5, "i:iPPPP "), + new Syscall ("symlink", 83, 2, "i:ss "), + new Syscall ("oldlstat", 84, 2, "i:pp "), + new Syscall ("readlink", 85, 3, "i:spi "), + new Syscall ("uselib", 86, 1, "i:s "), + new Syscall ("swapon", 87, 2, "i:si "), + new Syscall ("reboot", 88, 1, "i:i "), + new Syscall (89), + new Syscall ("mmap", 90, 6, "b:aniiii "), + new Syscall ("munmap", 91, 2, "i:ai "), + new Syscall ("truncate", 92, 2, "i:si "), + new Syscall ("ftruncate", 93, 2, "i:ii "), + new Syscall ("fchmod", 94, 2, "i:ii "), + new Syscall ("fchown", 95, 3, "i:iii "), + new Syscall ("getpriority", 96, 2, "i:ii "), + new Syscall ("setpriority", 97, 3, "i:iii "), + new Syscall ("profil", 98, 4, "i:piii "), + new Syscall ("statfs", 99, 2, "i:sp "), + new Syscall ("fstatfs", 100, 2, "i:ip "), + new Syscall ("ioperm", 101, 3, "i:iii "), + new Syscall ("socketcall", 102, 2, "i:ip "), + new Syscall ("klogctl", 103, 3, "i:isi "), + new Syscall ("setitimer", 104, 3, "i:ipp "), + new Syscall ("getitimer", 105, 2, "i:ip "), + new Syscall ("sys_stat", 106, 2, "i:sp "), + new Syscall ("sys_lstat", 107, 2, "i:sp "), + new Syscall ("sys_fstat", 108, 2, "i:ip "), + new Syscall ("old_uname", 109, 1, "i:p "), + new Syscall ("iopl", 110, 1, "i:i "), + new Syscall ("vhangup", 111, 1, "i:i "), + new Syscall ("idle", 112, 0, "i: "), + new Syscall (113), + new Syscall ("wait4", 114, 4, "i:iWiP "), + new Syscall ("swapoff", 115, 1, "i:s "), + new Syscall ("sysinfo", 116, 1, "i:p "), + new Syscall ("ipc", 117, 6, "i:iiiipi "), + new Syscall ("fsync", 118, 1, "i:i "), + new Syscall ("sigreturn", 119), + new Syscall ("clone", 120, 2, "i:ip "), + new Syscall ("setdomain", 121, 2, "i:si "), + new Syscall ("uname", 122, 1, "i:p "), + new Syscall ("modify_ldt", 123, 3, "i:ipi "), + new Syscall ("adjtimex", 124, 1, "i:p "), + new Syscall ("mprotect", 125, 3, "i:aii "), + new Syscall ("sigprocmask", 126, 3, "i:ipp "), + new Syscall ("create_module", 127, 3), + new Syscall ("init_module", 128, 5), + new Syscall ("delete_module", 129, 3), + new Syscall ("get_kernel_syms", 130, 1, "i:p "), + new Syscall ("quotactl", 131, 4, "i:isip "), + new Syscall ("getpgid", 132, 1, "i:i "), + new Syscall ("fchdir", 133, 1, "i:i "), + new Syscall ("bdflush", 134, 2, "i:ii "), + new Syscall ("sysfs", 135, 1, "i:i "), + new Syscall ("personality", 136, 1, "i:i "), + new Syscall ("afs_syscall", 137), + new Syscall ("setfsuid", 138, 1, "i:i "), + new Syscall ("setfsgid", 139, 1, "i:i "), + new Syscall ("llseek", 140, 5, "i:iuupi "), + new Syscall ("s_getdents", 141, 3, "i:ipi "), + new Syscall ("select", 142, 5, "i:iPPPP "), + new Syscall ("flock", 143, 2, "i:ii "), + new Syscall ("msync", 144, 3, "i:aii "), + new Syscall ("readv", 145, 3, "i:ipi "), + new Syscall ("writev", 146, 3, "i:ipi "), + new Syscall ("getsid", 147, 1, "i:i "), + new Syscall ("fdatasync", 148, 1, "i:i "), + new Syscall ("sysctl", 149, 1, "i:p "), + new Syscall ("mlock", 150, 2, "i:bn "), + new Syscall ("munlock", 151, 2, "i:ai "), + new Syscall ("mlockall", 152, 1, "i:i "), + new Syscall ("munlockall", 153, 0, "i: "), + new Syscall ("sched_setp", 154, 2, "i:ip "), + new Syscall ("sched_getp", 155, 2, "i:ip "), + new Syscall ("sched_sets", 156, 3, "i:iip "), + new Syscall ("sched_gets", 157, 1, "i:i "), + new Syscall ("sched_yield", 158, 0, "i: "), + new Syscall ("sched_primax", 159, 1, "i:i "), + new Syscall ("sched_primin", 160, 1, "i:i "), + new Syscall ("sched_rr_gi", 161, 2, "i:ip "), + new Syscall ("nanosleep", 162, 2, "i:pp "), + new Syscall ("mremap", 163, 4, "b:aini "), + new Syscall ("setresuid", 164, 3, "i:iii "), + new Syscall ("getresuid", 165, 3, "i:ppp "), + new Syscall ("vm86", 166, 1, "i:p "), + new Syscall ("query_module", 167, 5, "i:sipip "), + new Syscall ("poll", 168, 3, "i:pii "), + new Syscall ("nfsservctl", 169, 3, "i:ipp "), + new Syscall ("setresgid", 170, 3, "i:iii "), + new Syscall ("getresgid", 171, 3, "i:ppp "), + new Syscall ("prctl", 172, 5, "i:iiiii "), + new Syscall ("rt_sigreturn", 173), + new Syscall ("rt_sigaction", 174), + new Syscall ("rt_sigprocmask", 175), + new Syscall ("rt_sigpending", 176), + new Syscall ("rt_sigtimedwait", 177), + new Syscall ("rt_sigqueueinfo", 178), + new Syscall ("rt_sigsuspend", 179), + new Syscall ("pread64", 180), + new Syscall ("pwrite64", 181), + new Syscall ("chown", 182, 3, "i:sii "), + new Syscall ("getcwd", 183, 2, "i:bi "), + new Syscall ("capget", 184, 2, "i:pp "), + new Syscall ("capset", 185, 2, "i:pp "), + new Syscall ("sigaltstack", 186, 2, "i:PP "), + new Syscall ("sendfile", 187, 4, "i:iipi "), + new Syscall ("getpmsg", 188), + new Syscall ("putpmsg", 189), + new Syscall ("vfork", 190, 0, "i: "), + new Syscall ("ugetrlimit", 191), + new Syscall ("mmap", 192, 6, "b:aniiii "), + new Syscall ("truncate64", 193, 3, "i:shl "), + new Syscall ("ftruncate64", 194, 3, "i:ihl "), + new Syscall ("stat64", 195, 2, "i:sp "), + new Syscall ("lstat64", 196, 2, "i:sp "), + new Syscall ("fstat64", 197, 2, "i:ip "), + new Syscall ("lchown32", 198, 3, "i:sii "), + new Syscall ("getuid32", 199), + new Syscall ("getgid32", 200), + new Syscall ("geteuid32", 201), + new Syscall ("getegid32", 202), + new Syscall ("setreuid32", 203, 2, "i:ii "), + new Syscall ("setregid32", 204, 2, "i:ii "), + new Syscall ("getgroups32", 205, 2, "i:ip "), + new Syscall ("setgroups32", 206, 2, "i:ip "), + new Syscall ("fchown32", 207, 3, "i:iii "), + new Syscall ("setresuid32", 208, 3, "i:iii "), + new Syscall ("getresuid32", 209, 3, "i:ppp "), + new Syscall ("setresgid32", 210, 3, "i:iii "), + new Syscall ("getresgid32", 211, 3, "i:ppp "), + new Syscall ("chown32", 212, 3, "i:sii "), + new Syscall ("setuid32", 213, 1, "i:i "), + new Syscall ("setgid32", 214, 1, "i:i "), + new Syscall ("setfsuid32", 215, 1, "i:i "), + new Syscall ("setfsgid32", 216, 1, "i:i "), + new Syscall ("pivot_root", 217, 2, "i:ss "), + new Syscall ("mincore", 218, 3, "i:anV "), + new Syscall ("madvise", 219, 3, "i:pii "), + new Syscall ("getdents64", 220, 3, "i:ipi "), + new Syscall ("fcntl64", 221, 3, "i:iip "), + new Syscall (222), + new Syscall (223), + new Syscall ("gettid", 224, 0), + new Syscall ("readahead", 225, 4, "i:ihli "), + new Syscall ("setxattr", 226), + new Syscall ("lsetxattr", 227), + new Syscall ("fsetxattr", 228), + new Syscall ("getxattr", 229), + new Syscall ("lgetxattr", 230), + new Syscall ("fgetxattr", 231), + new Syscall ("listxattr", 232), + new Syscall ("llistxattr", 233), + new Syscall ("flistxattr", 234), + new Syscall ("removexattr", 235), + new Syscall ("lremovexattr", 236), + new Syscall ("fremovexattr", 237), + new Syscall ("tkill", 238, 2, "i:ii "), + new Syscall ("sendfile64", 239, 4, "i:iipi "), + new Syscall ("futex", 240, 4, "i:piip "), + new Syscall ("sched_setaffinity", 241), + new Syscall ("sched_getaffinity", 242), + new Syscall ("set_thread_area", 243, 1, "i:p "), + new Syscall ("get_thread_area", 244, 1, "i:p "), + new Syscall ("io_setup", 245, 2, "i:ip "), + new Syscall ("io_destroy", 246, 1, "i:i "), + new Syscall ("io_getevents", 247, 5, "i:iiipp "), + new Syscall ("io_submit", 248, 3, "i:iip "), + new Syscall ("io_cancel", 249, 3, "i:ipp "), + new Syscall ("fadvise64", 250), + new Syscall (251), + new Syscall ("exit_group", 252, 1, " :i ", true), + new Syscall ("lookup_dcookie", 253), + new Syscall ("epoll_create", 254), + new Syscall ("epoll_ctl", 255), + new Syscall ("epoll_wait", 256), + new Syscall ("remap_file_pages", 257), + new Syscall ("set_tid_address", 258), + new Syscall ("timer_create", 259), + new Syscall ("timer_settime", 260), + new Syscall ("timer_gettime", 261), + new Syscall ("timer_getoverrun", 262), + new Syscall ("timer_delete", 263), + new Syscall ("clock_settime", 264), + new Syscall ("clock_gettime", 265), + new Syscall ("clock_getres", 266), + new Syscall ("clock_nanosleep", 267), + new Syscall ("statfs64", 268), + new Syscall ("fstatfs64", 269), + new Syscall ("tgkill", 270), + new Syscall ("utimes", 271), + new Syscall ("fadvise64_64", 272), + }; } Index: frysk-core/frysk/proc/Syscall.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/Syscall.java,v retrieving revision 1.12 diff -u -r1.12 Syscall.java --- frysk-core/frysk/proc/Syscall.java 6 Sep 2006 15:28:32 -0000 1.12 +++ frysk-core/frysk/proc/Syscall.java 8 Sep 2006 10:55:50 -0000 @@ -96,24 +96,30 @@ { return number; } - - private void printStringArg (PrintWriter writer, - frysk.proc.Task task, - long addr) + /** Return true if this object equals the argument. */ + public boolean equals(Object other) { - if (addr == 0) - writer.print ("0x0"); - else { - writer.print ("\""); - StringBuffer x = new StringBuffer (); - task.memory.get (addr, 20, x); - if (x.length () == 20) - x.append ("..."); - x.append ("\""); - writer.print (x); - } + // Syscall objects are unique. + return this == other; } + private void printStringArg (PrintWriter writer, + frysk.proc.Task task, + long addr) + { + if (addr == 0) + writer.print ("0x0"); + else { + writer.print ("\""); + StringBuffer x = new StringBuffer (); + task.memory.get (addr, 20, x); + if (x.length () == 20) + x.append ("..."); + x.append ("\""); + writer.print (x); + } + } + /** * Print a textual representation of a system call. * @param writer where to print the representation @@ -212,295 +218,20 @@ return writer; } - /** - * Given a system call's number, this will return the corresponding - * Syscall object. Note that system call numbers are platform - * dependent. - * XXX: Eventually this will be moved down to Linux, or even - * further. - * @param num the number of the system call - */ - public static Syscall syscallByNum (int num) - { - if(num >= syscallList.length || num < 0){ - return new Syscall("UKNOWN SYSCALL", num); - } - return syscallList[num]; - } - - private static Syscall[] syscallList = { - new Syscall (0), - new Syscall ("exit", 1, 1), - new Syscall ("fork", 2, 0, "i: "), - new Syscall ("read", 3, 3, "i:ibn "), - new Syscall ("write", 4, 3, "i:ibn "), - new Syscall ("open", 5, 3, "i:siv "), - new Syscall ("close", 6, 1, "i:i "), - new Syscall ("waitpid", 7, 3, "i:ipi "), - new Syscall ("creat", 8, 2, "i:sv"), - new Syscall ("link", 9, 2, "i:ss "), - new Syscall ("unlink", 10, 1, "i:s "), - new Syscall ("execve", 11, 3, "i:ppp "), - new Syscall ("chdir", 12, 1, "i:s "), - new Syscall ("time", 13, 1, "i:P "), - new Syscall ("sys_mknod", 14, 3, "i:sii "), - new Syscall ("chmod", 15, 2, "i:si "), - new Syscall ("lchown", 16, 3, "i:sii "), - new Syscall ("break", 17), - new Syscall ("old_stat", 18, 3, "i:pp "), - new Syscall ("lseek", 19, 3, "i:iii "), - new Syscall ("getpid", 20, 0, "i: "), - new Syscall ("mount", 21, 5, "i:sssip "), - new Syscall ("umount", 22, 1, "i:s "), - new Syscall ("setuid", 23, 1, "i:i "), - new Syscall ("getuid", 24, 0, "i: "), - new Syscall ("stime", 25, 1, "i:p "), - new Syscall ("ptrace", 26, 4, "i:iiii "), - new Syscall ("alarm", 27, 1, "i:i "), - new Syscall ("old_fstat", 28, 2, "i:ip "), - new Syscall ("pause", 29, 0, "i: "), - new Syscall ("utime", 30, 2, "i:sP "), - new Syscall ("stty", 31), - new Syscall ("gtty", 32), - new Syscall ("access", 33, 2, "i:si "), - new Syscall ("nice", 34, 1, "i:i "), - new Syscall ("ftime", 35, 1, "i:p "), - new Syscall ("sync", 36, 0, "i: "), - new Syscall ("kill", 37, 2, "i:ii "), - new Syscall ("rename", 38, 2, "i:ss "), - new Syscall ("mkdir", 39, 2, "i:si "), - new Syscall ("rmdir", 40, 1, "i:s "), - new Syscall ("dup", 41, 1, "i:i "), - new Syscall ("pipe", 42, 1, "i:f "), - new Syscall ("times", 43, 1, "i:p "), - new Syscall ("prof", 44), - new Syscall ("brk", 45, 1, "i:p "), - new Syscall ("setgid", 46, 1, "i:i "), - new Syscall ("getgid", 47, 0, "i: "), - new Syscall ("signal", 48, 2, "i:ii "), - new Syscall ("geteuid", 49, 0, "i: "), - new Syscall ("getegid", 50, 0, "i: "), - new Syscall ("acct", 51, 1, "i:S "), - new Syscall ("umount2", 52, 2, "i:si "), - new Syscall ("lock", 53), - new Syscall ("ioctl", 54, 3, "i:iiI "), - new Syscall ("fcntl", 55, 3, "i:iiF "), - new Syscall ("mpx", 56), - new Syscall ("setpgid", 57, 2, "i:ii "), - new Syscall ("ulimit", 58, 2, "i:ii "), - new Syscall ("oldolduname", 59), - new Syscall ("umask", 60, 1, "i:i "), - new Syscall ("chroot", 61, 1, "i:s "), - new Syscall ("ustat", 62, 2, "i:ip "), - new Syscall ("dup2", 63, 2, "i:ii "), - new Syscall ("getppid", 64, 0, "i: "), - new Syscall ("getpgrp", 65, 0, "i: "), - new Syscall ("setsid", 66, 0, "i: "), - new Syscall ("sigaction", 67, 3, "i:ipp "), - new Syscall ("sgetmask", 68), - new Syscall ("ssetmask", 69), - new Syscall ("setreuid", 70, 2, "i:ii "), - new Syscall ("setregid", 71, 2, "i:ii "), - new Syscall ("sigsuspend", 72, 1, "i:p "), - new Syscall ("sigpending", 73, 1, "i:p "), - new Syscall ("sethostname", 74, 2, "i:pi "), - new Syscall ("setrlimit", 75, 2, "i:ip "), - new Syscall ("getrlimit", 76, 2, "i:ip "), - new Syscall ("getrusage", 77, 2, "i:ip "), - new Syscall ("gettimeofday", 78, 2, "i:PP "), - new Syscall ("settimeofday", 79, 2, "i:PP "), - new Syscall ("getgroups", 80, 2, "i:ip "), - new Syscall ("setgroups", 81, 2, "i:ip "), - new Syscall ("select", 82, 5, "i:iPPPP "), - new Syscall ("symlink", 83, 2, "i:ss "), - new Syscall ("oldlstat", 84, 2, "i:pp "), - new Syscall ("readlink", 85, 3, "i:spi "), - new Syscall ("uselib", 86, 1, "i:s "), - new Syscall ("swapon", 87, 2, "i:si "), - new Syscall ("reboot", 88, 1, "i:i "), - new Syscall (89), - new Syscall ("mmap", 90, 6, "b:aniiii "), - new Syscall ("munmap", 91, 2, "i:ai "), - new Syscall ("truncate", 92, 2, "i:si "), - new Syscall ("ftruncate", 93, 2, "i:ii "), - new Syscall ("fchmod", 94, 2, "i:ii "), - new Syscall ("fchown", 95, 3, "i:iii "), - new Syscall ("getpriority", 96, 2, "i:ii "), - new Syscall ("setpriority", 97, 3, "i:iii "), - new Syscall ("profil", 98, 4, "i:piii "), - new Syscall ("statfs", 99, 2, "i:sp "), - new Syscall ("fstatfs", 100, 2, "i:ip "), - new Syscall ("ioperm", 101, 3, "i:iii "), - new Syscall ("socketcall", 102, 2, "i:ip "), - new Syscall ("klogctl", 103, 3, "i:isi "), - new Syscall ("setitimer", 104, 3, "i:ipp "), - new Syscall ("getitimer", 105, 2, "i:ip "), - new Syscall ("sys_stat", 106, 2, "i:sp "), - new Syscall ("sys_lstat", 107, 2, "i:sp "), - new Syscall ("sys_fstat", 108, 2, "i:ip "), - new Syscall ("old_uname", 109, 1, "i:p "), - new Syscall ("iopl", 110, 1, "i:i "), - new Syscall ("vhangup", 111, 1, "i:i "), - new Syscall ("idle", 112, 0, "i: "), - new Syscall (113), - new Syscall ("wait4", 114, 4, "i:iWiP "), - new Syscall ("swapoff", 115, 1, "i:s "), - new Syscall ("sysinfo", 116, 1, "i:p "), - new Syscall ("ipc", 117, 6, "i:iiiipi "), - new Syscall ("fsync", 118, 1, "i:i "), - new Syscall ("sigreturn", 119), - new Syscall ("clone", 120, 2, "i:ip "), - new Syscall ("setdomain", 121, 2, "i:si "), - new Syscall ("uname", 122, 1, "i:p "), - new Syscall ("modify_ldt", 123, 3, "i:ipi "), - new Syscall ("adjtimex", 124, 1, "i:p "), - new Syscall ("mprotect", 125, 3, "i:aii "), - new Syscall ("sigprocmask", 126, 3, "i:ipp "), - new Syscall ("create_module", 127, 3), - new Syscall ("init_module", 128, 5), - new Syscall ("delete_module", 129, 3), - new Syscall ("get_kernel_syms", 130, 1, "i:p "), - new Syscall ("quotactl", 131, 4, "i:isip "), - new Syscall ("getpgid", 132, 1, "i:i "), - new Syscall ("fchdir", 133, 1, "i:i "), - new Syscall ("bdflush", 134, 2, "i:ii "), - new Syscall ("sysfs", 135, 1, "i:i "), - new Syscall ("personality", 136, 1, "i:i "), - new Syscall ("afs_syscall", 137), - new Syscall ("setfsuid", 138, 1, "i:i "), - new Syscall ("setfsgid", 139, 1, "i:i "), - new Syscall ("llseek", 140, 5, "i:iuupi "), - new Syscall ("s_getdents", 141, 3, "i:ipi "), - new Syscall ("select", 142, 5, "i:iPPPP "), - new Syscall ("flock", 143, 2, "i:ii "), - new Syscall ("msync", 144, 3, "i:aii "), - new Syscall ("readv", 145, 3, "i:ipi "), - new Syscall ("writev", 146, 3, "i:ipi "), - new Syscall ("getsid", 147, 1, "i:i "), - new Syscall ("fdatasync", 148, 1, "i:i "), - new Syscall ("sysctl", 149, 1, "i:p "), - new Syscall ("mlock", 150, 2, "i:bn "), - new Syscall ("munlock", 151, 2, "i:ai "), - new Syscall ("mlockall", 152, 1, "i:i "), - new Syscall ("munlockall", 153, 0, "i: "), - new Syscall ("sched_setp", 154, 2, "i:ip "), - new Syscall ("sched_getp", 155, 2, "i:ip "), - new Syscall ("sched_sets", 156, 3, "i:iip "), - new Syscall ("sched_gets", 157, 1, "i:i "), - new Syscall ("sched_yield", 158, 0, "i: "), - new Syscall ("sched_primax", 159, 1, "i:i "), - new Syscall ("sched_primin", 160, 1, "i:i "), - new Syscall ("sched_rr_gi", 161, 2, "i:ip "), - new Syscall ("nanosleep", 162, 2, "i:pp "), - new Syscall ("mremap", 163, 4, "b:aini "), - new Syscall ("setresuid", 164, 3, "i:iii "), - new Syscall ("getresuid", 165, 3, "i:ppp "), - new Syscall ("vm86", 166, 1, "i:p "), - new Syscall ("query_module", 167, 5, "i:sipip "), - new Syscall ("poll", 168, 3, "i:pii "), - new Syscall ("nfsservctl", 169, 3, "i:ipp "), - new Syscall ("setresgid", 170, 3, "i:iii "), - new Syscall ("getresgid", 171, 3, "i:ppp "), - new Syscall ("prctl", 172, 5, "i:iiiii "), - new Syscall ("rt_sigreturn", 173), - new Syscall ("rt_sigaction", 174), - new Syscall ("rt_sigprocmask", 175), - new Syscall ("rt_sigpending", 176), - new Syscall ("rt_sigtimedwait", 177), - new Syscall ("rt_sigqueueinfo", 178), - new Syscall ("rt_sigsuspend", 179), - new Syscall ("pread64", 180), - new Syscall ("pwrite64", 181), - new Syscall ("chown", 182, 3, "i:sii "), - new Syscall ("getcwd", 183, 2, "i:bi "), - new Syscall ("capget", 184, 2, "i:pp "), - new Syscall ("capset", 185, 2, "i:pp "), - new Syscall ("sigaltstack", 186, 2, "i:PP "), - new Syscall ("sendfile", 187, 4, "i:iipi "), - new Syscall ("getpmsg", 188), - new Syscall ("putpmsg", 189), - new Syscall ("vfork", 190, 0, "i: "), - new Syscall ("ugetrlimit", 191), - new Syscall ("mmap", 192, 6, "b:aniiii "), - new Syscall ("truncate64", 193, 3, "i:shl "), - new Syscall ("ftruncate64", 194, 3, "i:ihl "), - new Syscall ("stat64", 195, 2, "i:sp "), - new Syscall ("lstat64", 196, 2, "i:sp "), - new Syscall ("fstat64", 197, 2, "i:ip "), - new Syscall ("lchown32", 198, 3, "i:sii "), - new Syscall ("getuid32", 199), - new Syscall ("getgid32", 200), - new Syscall ("geteuid32", 201), - new Syscall ("getegid32", 202), - new Syscall ("setreuid32", 203, 2, "i:ii "), - new Syscall ("setregid32", 204, 2, "i:ii "), - new Syscall ("getgroups32", 205, 2, "i:ip "), - new Syscall ("setgroups32", 206, 2, "i:ip "), - new Syscall ("fchown32", 207, 3, "i:iii "), - new Syscall ("setresuid32", 208, 3, "i:iii "), - new Syscall ("getresuid32", 209, 3, "i:ppp "), - new Syscall ("setresgid32", 210, 3, "i:iii "), - new Syscall ("getresgid32", 211, 3, "i:ppp "), - new Syscall ("chown32", 212, 3, "i:sii "), - new Syscall ("setuid32", 213, 1, "i:i "), - new Syscall ("setgid32", 214, 1, "i:i "), - new Syscall ("setfsuid32", 215, 1, "i:i "), - new Syscall ("setfsgid32", 216, 1, "i:i "), - new Syscall ("pivot_root", 217, 2, "i:ss "), - new Syscall ("mincore", 218, 3, "i:anV "), - new Syscall ("madvise", 219, 3, "i:pii "), - new Syscall ("getdents64", 220, 3, "i:ipi "), - new Syscall ("fcntl64", 221, 3, "i:iip "), - new Syscall (222), - new Syscall (223), - new Syscall ("gettid", 224, 0), - new Syscall ("readahead", 225, 4, "i:ihli "), - new Syscall ("setxattr", 226), - new Syscall ("lsetxattr", 227), - new Syscall ("fsetxattr", 228), - new Syscall ("getxattr", 229), - new Syscall ("lgetxattr", 230), - new Syscall ("fgetxattr", 231), - new Syscall ("listxattr", 232), - new Syscall ("llistxattr", 233), - new Syscall ("flistxattr", 234), - new Syscall ("removexattr", 235), - new Syscall ("lremovexattr", 236), - new Syscall ("fremovexattr", 237), - new Syscall ("tkill", 238, 2, "i:ii "), - new Syscall ("sendfile64", 239, 4, "i:iipi "), - new Syscall ("futex", 240, 4, "i:piip "), - new Syscall ("sched_setaffinity", 241), - new Syscall ("sched_getaffinity", 242), - new Syscall ("set_thread_area", 243, 1, "i:p "), - new Syscall ("get_thread_area", 244, 1, "i:p "), - new Syscall ("io_setup", 245, 2, "i:ip "), - new Syscall ("io_destroy", 246, 1, "i:i "), - new Syscall ("io_getevents", 247, 5, "i:iiipp "), - new Syscall ("io_submit", 248, 3, "i:iip "), - new Syscall ("io_cancel", 249, 3, "i:ipp "), - new Syscall ("fadvise64", 250), - new Syscall (251), - new Syscall ("exit_group", 252, 1, " :i ", true), - new Syscall ("lookup_dcookie", 253), - new Syscall ("epoll_create", 254), - new Syscall ("epoll_ctl", 255), - new Syscall ("epoll_wait", 256), - new Syscall ("remap_file_pages", 257), - new Syscall ("set_tid_address", 258), - new Syscall ("timer_create", 259), - new Syscall ("timer_settime", 260), - new Syscall ("timer_gettime", 261), - new Syscall ("timer_getoverrun", 262), - new Syscall ("timer_delete", 263), - new Syscall ("clock_settime", 264), - new Syscall ("clock_gettime", 265), - new Syscall ("clock_getres", 266), - new Syscall ("clock_nanosleep", 267), - new Syscall ("statfs64", 268), - new Syscall ("fstatfs64", 269), - new Syscall ("tgkill", 270), - new Syscall ("utimes", 271), - new Syscall ("fadvise64_64", 272), - }; + /** + * Given a system call's name, this will return the corresponding + * Syscall object. If no predefined system call with that name + * is available, this will return null. + * @param name the name of the system call + * @param syscallList system calls list + * @return the Syscall object, or null + * @throws NullPointerException if name is null + */ + public static Syscall syscallByName (String name, Syscall[] syscallList) + { + for (int i = 0; i < LinuxIa32.syscallList.length; ++i) + if (name.equals(syscallList[i].name)) + return syscallList[i]; + return null; + } } Index: frysk-core/frysk/proc/SyscallEventInfo.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/SyscallEventInfo.java,v retrieving revision 1.4 diff -u -r1.4 SyscallEventInfo.java --- frysk-core/frysk/proc/SyscallEventInfo.java 11 Jul 2006 21:25:25 -0000 1.4 +++ frysk-core/frysk/proc/SyscallEventInfo.java 8 Sep 2006 10:55:50 -0000 @@ -38,17 +38,181 @@ // exception. package frysk.proc; +import java.util.HashMap; /** * An object that retrieves syscall info from a task. Used in combination * with Syscall and a Task object to retrieve information. */ public abstract class SyscallEventInfo { - public final static int ENTER = 0; - public final static int EXIT = 1; - public final static int UNKNOWN = -1; - - public abstract int number (Task task); - public abstract long arg (Task task, int n); - public abstract long returnCode (Task task); + public final static int ENTER = 0; + public final static int EXIT = 1; + public final static int UNKNOWN = -1; + + public abstract int number (Task task); + public abstract long arg (Task task, int n); + public abstract long returnCode (Task task); + + + public Syscall getSyscall (Task task) + { + int number = this.number (task); + return syscallByNum (number, task); + } + + private static Syscall[] getSyscallList (Task task) + { + Syscall[] syscallList; + String isaName = new String(); + + try + { + isaName = task.getIsa().toString(); + } + catch (Exception e) + { + throw new RuntimeException ("Could not get the name of isa"); + } + + if (isaName.equals("ia32")) + { + syscallList = LinuxIa32.syscallList; + } + else if (isaName.equals("x86-64")) + { + syscallList = LinuxEMT64.syscallList; + } + else if (isaName.equals("ppc64")) + { + syscallList = LinuxPPC64.syscallList; + } + else + { + syscallList = LinuxPPC.syscallList; + } + + return syscallList; + } + + private static HashMap getUnknownSyscalls (Task task) + { + HashMap unknownSyscalls; + String isaName = new String(); + + try + { + isaName = task.getIsa().toString(); + } + catch (Exception e) + { + throw new RuntimeException ("Could not get the name of isa"); + } + + if (isaName.equals("ia32")) + { + unknownSyscalls = LinuxIa32.unknownSyscalls; + } + else if (isaName.equals("x86-64")) + { + unknownSyscalls = LinuxEMT64.unknownSyscalls; + } + else if (isaName.equals("ppc64")) + { + unknownSyscalls = LinuxPPC64.unknownSyscalls; + } + else + { + unknownSyscalls = LinuxPPC.unknownSyscalls; + } + return unknownSyscalls; + } + + /** + * Given a system call's number, this will return the corresponding + * Syscall object. Note that system call numbers are platform + * dependent. This will return a Syscall object in all cases; if + * there is no predefined system call with the given number, a unique + * "unknown" system call with the indicated number will be saved in + * unknownSyscalls. + * @param num the number of the system call + * @param task the current task + * @return the Syscall object + */ + public static Syscall syscallByNum (int num, Task task) + { + Syscall[] syscallList; + HashMap unknownSyscalls; + + syscallList = getSyscallList (task); + unknownSyscalls = getUnknownSyscalls (task); + + if (num < 0) + { + throw new RuntimeException ("Negative Syscall Number:" + + Integer.toString(num)); + } + else if (num >= syscallList.length) + { + synchronized (SyscallEventInfo.class) + { + Integer key = new Integer(num); + if (unknownSyscalls == null) + unknownSyscalls = new HashMap(); + else if (unknownSyscalls.containsKey(key)) + return (Syscall) unknownSyscalls.get(key); + + Syscall result = new Syscall("UNKNOWN SYSCALL " + Integer.toString(num), num); + unknownSyscalls.put(key, result); + + return result; + } + } + else + { + return syscallList[num]; + } + } + + /** + * Given a system call's name, this will return the corresponding + * Syscall object. If no predefined system call with that name + * is available, this will return null. + * @param name the name of the system call + * @param task the cuurent task + * @return the Syscall object, or null + * @throws NullPointerException if name is null + */ + public static Syscall syscallByName (String name, Task task) + { + Syscall syscall; + String isaName = new String(); + + try + { + isaName = task.getIsa().toString(); + } + catch (Exception e) + { + throw new RuntimeException ("Could not get the name of isa"); + } + + if (isaName.equals("ia32")) + { + syscall = Syscall.syscallByName (name, LinuxIa32.syscallList); + if (syscall != null) + return syscall; + + syscall = Syscall.syscallByName (name, LinuxIa32.socketSubcallList); + if (syscall != null) + return syscall; + + syscall = Syscall.syscallByName (name, LinuxIa32.ipcSubcallList); + if (syscall != null) + return syscall; + return null; + } + else + return Syscall.syscallByName (name, getSyscallList(task)); + + } }