📄 emul_unix.c
字号:
/* 45 */ { 0, "plock" }, /* 46 */ { 0, "setgid" }, /* 47 */ { do_unix_getgid2, "getgid" }, /* 48 */ { 0, "signal" }, /* 49 */ { 0, "msgsys" }, /* 50 */ { 0, "syssun" }, /* 51 */ { 0, "acct" }, /* 52 */ { 0, "shmsys" }, /* 53 */ { 0, "semsys" }, /* 54 */ { do_solaris_ioctl, "ioctl" }, /* 55 */ { 0, "uadmin" }, /* 56 */ { 0, 0 /* reserved for exch */ }, /* 57 */ { 0, "utssys" }, /* 58 */ { 0, "fdsync" }, /* 59 */ { 0, "execve" }, /* 60 */ { do_unix_umask, "umask" }, /* 61 */ { 0, "chroot" }, /* 62 */ { 0, "fcntl" }, /* 63 */ { 0, "ulimit" }, /* 64 */ { 0, 0 /* reserved for UNIX PC */ }, /* 64 */ { 0, 0 /* reserved for UNIX PC */ }, /* 65 */ { 0, 0 /* reserved for UNIX PC */ }, /* 66 */ { 0, 0 /* reserved for UNIX PC */ }, /* 67 */ { 0, 0 /* reserved for UNIX PC */ }, /* 68 */ { 0, 0 /* reserved for UNIX PC */ }, /* 69 */ { 0, 0 /* reserved for UNIX PC */ }, /* 70 */ { 0, 0 /* was advfs */ }, /* 71 */ { 0, 0 /* was unadvfs */ }, /* 72 */ { 0, 0 /* was rmount */ }, /* 73 */ { 0, 0 /* was rumount */ }, /* 74 */ { 0, 0 /* was rfstart */ }, /* 75 */ { 0, 0 /* was sigret */ }, /* 76 */ { 0, 0 /* was rdebug */ }, /* 77 */ { 0, 0 /* was rfstop */ }, /* 78 */ { 0, 0 /* was rfsys */ }, /* 79 */ { do_unix_rmdir, "rmdir" }, /* 80 */ { do_unix_mkdir, "mkdir" }, /* 81 */ { 0, "getdents" }, /* 82 */ { 0, 0 /* was libattach */ }, /* 83 */ { 0, 0 /* was libdetach */ }, /* 84 */ { 0, "sysfs" }, /* 85 */ { 0, "getmsg" }, /* 86 */ { 0, "putmsg" }, /* 87 */ { 0, "poll" }, /* 88 */ { do_solaris_lstat, "lstat" }, /* 89 */ { do_unix_symlink, "symlink" }, /* 90 */ { 0, "readlink" }, /* 91 */ { 0, "setgroups" }, /* 92 */ { 0, "getgroups" }, /* 93 */ { 0, "fchmod" }, /* 94 */ { 0, "fchown" }, /* 95 */ { 0, "sigprocmask" }, /* 96 */ { 0, "sigsuspend" }, /* 97 */ { do_unix_nop, "sigaltstack" }, /* 98 */ { do_unix_nop, "sigaction" }, /* 99 */ { 0, "sigpending" }, /* 100 */ { 0, "context" }, /* 101 */ { 0, "evsys" }, /* 102 */ { 0, "evtrapret" }, /* 103 */ { 0, "statvfs" }, /* 104 */ { 0, "fstatvfs" }, /* 105 */ { 0, 0 /* reserved */ }, /* 106 */ { 0, "nfssys" }, /* 107 */ { 0, "waitsys" }, /* 108 */ { 0, "sigsendsys" }, /* 109 */ { 0, "hrtsys" }, /* 110 */ { 0, "acancel" }, /* 111 */ { 0, "async" }, /* 112 */ { 0, "priocntlsys" }, /* 113 */ { 0, "pathconf" }, /* 114 */ { 0, "mincore" }, /* 115 */ { 0, "mmap" }, /* 116 */ { 0, "mprotect" }, /* 117 */ { 0, "munmap" }, /* 118 */ { 0, "fpathconf" }, /* 119 */ { 0, "vfork" }, /* 120 */ { 0, "fchdir" }, /* 121 */ { 0, "readv" }, /* 122 */ { 0, "writev" }, /* 123 */ { 0, "xstat" }, /* 124 */ { 0, "lxstat" }, /* 125 */ { 0, "fxstat" }, /* 126 */ { 0, "xmknod" }, /* 127 */ { 0, "clocal" }, /* 128 */ { 0, "setrlimit" }, /* 129 */ { 0, "getrlimit" }, /* 130 */ { 0, "lchown" }, /* 131 */ { 0, "memcntl" }, /* 132 */ { 0, "getpmsg" }, /* 133 */ { 0, "putpmsg" }, /* 134 */ { 0, "rename" }, /* 135 */ { 0, "uname" }, /* 136 */ { 0, "setegid" }, /* 137 */ { 0, "sysconfig" }, /* 138 */ { 0, "adjtime" }, /* 139 */ { 0, "systeminfo" }, /* 140 */ { 0, 0 /* reserved */ }, /* 141 */ { 0, "seteuid" }, /* 142 */ { 0, "vtrace" }, /* 143 */ { 0, "fork1" }, /* 144 */ { 0, "sigtimedwait" }, /* 145 */ { 0, "lwp_info" }, /* 146 */ { 0, "yield" }, /* 147 */ { 0, "lwp_sema_wait" }, /* 148 */ { 0, "lwp_sema_post" }, /* 149 */ { 0, 0 /* reserved */ }, /* 150 */ { 0, 0 /* reserved */ }, /* 151 */ { 0, 0 /* reserved */ }, /* 152 */ { 0, "modctl" }, /* 153 */ { 0, "fchroot" }, /* 154 */ { 0, "utimes" }, /* 155 */ { 0, "vhangup" }, /* 156 */ { do_unix_gettimeofday, "gettimeofday" }, /* 157 */ { 0, "getitimer" }, /* 158 */ { 0, "setitimer" }, /* 159 */ { 0, "lwp_create" }, /* 160 */ { 0, "lwp_exit" }, /* 161 */ { 0, "lwp_suspend" }, /* 162 */ { 0, "lwp_continue" }, /* 163 */ { 0, "lwp_kill" }, /* 164 */ { 0, "lwp_self" }, /* 165 */ { 0, "lwp_setprivate" }, /* 166 */ { 0, "lwp_getprivate" }, /* 167 */ { 0, "lwp_wait" }, /* 168 */ { 0, "lwp_mutex_unlock" }, /* 169 */ { 0, "lwp_mutex_lock" }, /* 170 */ { 0, "lwp_cond_wait" }, /* 171 */ { 0, "lwp_cond_signal" }, /* 172 */ { 0, "lwp_cond_broadcast" }, /* 173 */ { 0, "pread" }, /* 174 */ { 0, "pwrite" }, /* 175 */ { 0, "llseek" }, /* 176 */ { 0, "inst_sync" }, /* 177 */ { 0, 0 /* reserved */ }, /* 178 */ { 0, "kaio" }, /* 179 */ { 0, 0 /* reserved */ }, /* 180 */ { 0, 0 /* reserved */ }, /* 181 */ { 0, 0 /* reserved */ }, /* 182 */ { 0, 0 /* reserved */ }, /* 183 */ { 0, 0 /* reserved */ }, /* 184 */ { 0, "tsolsys" }, /* 185 */ { 0, "acl" }, /* 186 */ { 0, "auditsys" }, /* 187 */ { 0, "processor_bind" }, /* 188 */ { 0, "processor_info" }, /* 189 */ { 0, "p_online" }, /* 190 */ { 0, "sigqueue" }, /* 191 */ { 0, "clock_gettime" }, /* 192 */ { 0, "clock_settime" }, /* 193 */ { 0, "clock_getres" }, /* 194 */ { 0, "timer_create" }, /* 195 */ { 0, "timer_delete" }, /* 196 */ { 0, "timer_settime" }, /* 197 */ { 0, "timer_gettime" }, /* 198 */ { 0, "timer_getoverrun" }, /* 199 */ { 0, "nanosleep" }, /* 200 */ { 0, "facl" }, /* 201 */ { 0, "door" }, /* 202 */ { 0, "setreuid" }, /* 203 */ { 0, "setregid" }, /* 204 */ { 0, "install_utrap" }, /* 205 */ { 0, 0 /* reserved */ }, /* 206 */ { 0, 0 /* reserved */ }, /* 207 */ { 0, 0 /* reserved */ }, /* 208 */ { 0, 0 /* reserved */ }, /* 209 */ { 0, 0 /* reserved */ }, /* 210 */ { 0, "signotifywait" }, /* 211 */ { 0, "lwp_sigredirect" }, /* 212 */ { 0, "lwp_alarm" },};static char *(solaris_error_names[]) = { /* 0 */ "ESUCCESS", /* 1 */ "EPERM", /* 2 */ "ENOENT", /* 3 */ "ESRCH", /* 4 */ "EINTR", /* 5 */ "EIO", /* 6 */ "ENXIO", /* 7 */ "E2BIG", /* 8 */ "ENOEXEC", /* 9 */ "EBADF", /* 10 */ "ECHILD", /* 11 */ "EAGAIN", /* 12 */ "ENOMEM", /* 13 */ "EACCES", /* 14 */ "EFAULT", /* 15 */ "ENOTBLK", /* 16 */ "EBUSY", /* 17 */ "EEXIST", /* 18 */ "EXDEV", /* 19 */ "ENODEV", /* 20 */ "ENOTDIR", /* 21 */ "EISDIR", /* 22 */ "EINVAL", /* 23 */ "ENFILE", /* 24 */ "EMFILE", /* 25 */ "ENOTTY", /* 26 */ "ETXTBSY", /* 27 */ "EFBIG", /* 28 */ "ENOSPC", /* 29 */ "ESPIPE", /* 30 */ "EROFS", /* 31 */ "EMLINK", /* 32 */ "EPIPE", /* 33 */ "EDOM", /* 34 */ "ERANGE", /* 35 */ "ENOMSG", /* 36 */ "EIDRM", /* 37 */ "ECHRNG", /* 38 */ "EL2NSYNC", /* 39 */ "EL3HLT", /* 40 */ "EL3RST", /* 41 */ "ELNRNG", /* 42 */ "EUNATCH", /* 43 */ "ENOCSI", /* 44 */ "EL2HLT", /* 45 */ "EDEADLK", /* 46 */ "ENOLCK", /* 47 */ "ECANCELED", /* 48 */ "ENOTSUP", /* 49 */ "EDQUOT", /* 50 */ "EBADE", /* 51 */ "EBADR", /* 52 */ "EXFULL", /* 53 */ "ENOANO", /* 54 */ "EBADRQC", /* 55 */ "EBADSLT", /* 56 */ "EDEADLOCK", /* 57 */ "EBFONT", /* 58 */ "Error code 58", /* 59 */ "Error code 59", /* 60 */ "ENOSTR", /* 61 */ "ENODATA", /* 62 */ "ETIME", /* 63 */ "ENOSR", /* 64 */ "ENONET", /* 65 */ "ENOPKG", /* 66 */ "EREMOTE", /* 67 */ "ENOLINK", /* 68 */ "EADV", /* 69 */ "ESRMNT", /* 70 */ "ECOMM", /* 71 */ "EPROTO", /* 72 */ "Error code 72", /* 73 */ "Error code 73", /* 74 */ "EMULTIHOP", /* 75 */ "Error code 75", /* 76 */ "Error code 76", /* 77 */ "EBADMSG", /* 78 */ "ENAMETOOLONG", /* 79 */ "EOVERFLOW", /* 80 */ "ENOTUNIQ", /* 81 */ "EBADFD", /* 82 */ "EREMCHG", /* 83 */ "ELIBACC", /* 84 */ "ELIBBAD", /* 85 */ "ELIBSCN", /* 86 */ "ELIBMAX", /* 87 */ "ELIBEXEC", /* 88 */ "EILSEQ", /* 89 */ "ENOSYS", /* 90 */ "ELOOP", /* 91 */ "ERESTART", /* 92 */ "ESTRPIPE", /* 93 */ "ENOTEMPTY", /* 94 */ "EUSERS", /* 95 */ "ENOTSOCK", /* 96 */ "EDESTADDRREQ", /* 97 */ "EMSGSIZE", /* 98 */ "EPROTOTYPE", /* 99 */ "ENOPROTOOPT", /* 100 */ "Error code 100", /* 101 */ "Error code 101", /* 102 */ "Error code 102", /* 103 */ "Error code 103", /* 104 */ "Error code 104", /* 105 */ "Error code 105", /* 106 */ "Error code 106", /* 107 */ "Error code 107", /* 108 */ "Error code 108", /* 109 */ "Error code 109", /* 110 */ "Error code 110", /* 111 */ "Error code 111", /* 112 */ "Error code 112", /* 113 */ "Error code 113", /* 114 */ "Error code 114", /* 115 */ "Error code 115", /* 116 */ "Error code 116", /* 117 */ "Error code 117", /* 118 */ "Error code 118", /* 119 */ "Error code 119", /* 120 */ "EPROTONOSUPPORT", /* 121 */ "ESOCKTNOSUPPORT", /* 122 */ "EOPNOTSUPP", /* 123 */ "EPFNOSUPPORT", /* 124 */ "EAFNOSUPPORT", /* 125 */ "EADDRINUSE", /* 126 */ "EADDRNOTAVAIL", /* 127 */ "ENETDOWN", /* 128 */ "ENETUNREACH", /* 129 */ "ENETRESET", /* 130 */ "ECONNABORTED", /* 131 */ "ECONNRESET", /* 132 */ "ENOBUFS", /* 133 */ "EISCONN", /* 134 */ "ENOTCONN", /* 135 */ "Error code 135", /* XENIX has 135 - 142 */ /* 136 */ "Error code 136", /* 137 */ "Error code 137", /* 138 */ "Error code 138", /* 139 */ "Error code 139", /* 140 */ "Error code 140", /* 141 */ "Error code 141", /* 142 */ "Error code 142", /* 143 */ "ESHUTDOWN", /* 144 */ "ETOOMANYREFS", /* 145 */ "ETIMEDOUT", /* 146 */ "ECONNREFUSED", /* 147 */ "EHOSTDOWN", /* 148 */ "EHOSTUNREACH", /* 149 */ "EALREADY", /* 150 */ "EINPROGRESS", /* 151 */ "ESTALE",};static char *(solaris_signal_names[]) = { /* 0 */ 0, /* 1 */ "SIGHUP", /* 2 */ "SIGINT", /* 3 */ "SIGQUIT", /* 4 */ "SIGILL", /* 5 */ "SIGTRAP", /* 6 */ "SIGABRT", /* 7 */ "SIGEMT", /* 8 */ "SIGFPE", /* 9 */ "SIGKILL", /* 10 */ "SIGBUS", /* 11 */ "SIGSEGV", /* 12 */ "SIGSYS", /* 13 */ "SIGPIPE", /* 14 */ "SIGALRM", /* 15 */ "SIGTERM", /* 16 */ "SIGUSR1", /* 17 */ "SIGUSR2", /* 18 */ "SIGCHLD", /* 19 */ "SIGPWR", /* 20 */ "SIGWINCH", /* 21 */ "SIGURG", /* 22 */ "SIGPOLL", /* 23 */ "SIGSTOP", /* 24 */ "SIGTSTP", /* 25 */ "SIGCONT", /* 26 */ "SIGTTIN", /* 27 */ "SIGTTOU", /* 28 */ "SIGVTALRM", /* 29 */ "SIGPROF", /* 30 */ "SIGXCPU", /* 31 */ "SIGXFSZ", /* 32 */ "SIGWAITING", /* 33 */ "SIGLWP", /* 34 */ "SIGFREEZE", /* 35 */ "SIGTHAW", /* 36 */ "SIGCANCEL",};static emul_syscall emul_solaris_syscalls = { solaris_descriptors, sizeof(solaris_descriptors) / sizeof(solaris_descriptors[0]), solaris_error_names, sizeof(solaris_error_names) / sizeof(solaris_error_names[0]), solaris_signal_names, sizeof(solaris_signal_names) / sizeof(solaris_signal_names[0]),};/* Solaris's os_emul interface, most are just passed on to the generic syscall stuff */static os_emul_data *emul_solaris_create(device *root, bfd *image, const char *name){ /* check that this emulation is really for us */ if (name != NULL && strcmp(name, "solaris") != 0) return NULL; if (image == NULL) return NULL; return emul_unix_create(root, image, "solaris", &emul_solaris_syscalls);} static voidemul_solaris_init(os_emul_data *emul_data, int nr_cpus){ /* nothing yet */}static voidemul_solaris_system_call(cpu *processor, unsigned_word cia, os_emul_data *emul_data){ emul_do_system_call(emul_data, emul_data->syscalls, cpu_registers(processor)->gpr[0], 3, /*r3 contains arg0*/ processor, cia);}const os_emul emul_solaris = { "solaris", emul_solaris_create, emul_solaris_init, emul_solaris_system_call, 0, /*instruction_call*/ 0 /*data*/};/* EMULATION Linux - Emulation of user programs for Linux/PPC DESCRIPTION *//* Linux specific implementation */typedef unsigned32 linux_dev_t;typedef unsigned32 linux_ino_t;typedef unsigned32 linux_mode_t;typedef unsigned16 linux_nlink_t;typedef signed32 linux_off_t;typedef signed32 linux_pid_t;typedef unsigned32 linux_uid_t;typedef unsigned32 linux_gid_t;typedef unsigned32 linux_size_t;typedef signed32 linux_ssize_t;typedef signed32 linux_ptrdiff_t;typedef signed32 linux_time_t;typedef signed32 linux_clock_t;typedef signed32 linux_daddr_t;#ifdef HAVE_SYS_STAT_H/* For the PowerPC, don't both with the 'old' stat structure, since there should be no extant binaries with that structure. */struct linux_stat { linux_dev_t st_dev; linux_ino_t st_ino; linux_mode_t st_mode; linux_nlink_t st_nlink; linux_uid_t st_uid; linux_gid_t st_gid; linux_dev_t st_rdev; linux_off_t st_size; unsigned32 st_blksize; unsigned32 st_blocks; unsigned32 st_atimx; /* don't use st_{a,c,m}time, that might a macro */ unsigned32 __unused1; /* defined by the host's stat.h */ unsigned32 st_mtimx; unsigned32 __unused2; unsigned32 st_ctimx; unsigned32 __unused3; unsigned32 __unused4; unsigned32 __unused5;};/* Convert from host stat structure to solaris stat structure */STATIC_INLINE_EMUL_UNIX voidconvert_to_linux_stat(unsigned_word addr, struct stat *host, cpu *processor, unsigned_word cia){ struct linux_stat target; target.st_dev = H2T_4(host->st_dev); target.st_ino = H2T_4(host->st_ino); target.st_mode = H2T_4(host->st_mode); target.st_nlink = H2T_2(host->st_nlink); target.st_uid = H2T_4(host->st_uid); target.st_gid = H2T_4(host->st_gid); target.st_size = H2T_4(host->st_size);#ifdef HAVE_ST_RDEV target.st_rdev = H2T_4(host->st_rdev);#else target.st_rdev = 0;#endif#ifdef HAVE_ST_BLKSIZE target.st_blksize = H2T_4(host->st_blksize);#else target.st_blksize = 0;#endif#ifdef HAVE_ST_BLOCKS target.st_blocks = H2T_4(host->st_blocks);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -