diff options
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/elfload.c | 23 | ||||
-rw-r--r-- | linux-user/signal.c | 29 | ||||
-rw-r--r-- | linux-user/sparc64/syscall.h | 10 | ||||
-rw-r--r-- | linux-user/sparc64/syscall_nr.h | 286 | ||||
-rw-r--r-- | linux-user/sparc64/termbits.h | 279 | ||||
-rw-r--r-- | linux-user/syscall.c | 55 |
6 files changed, 664 insertions, 18 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 09c33aa90b..684e70eeb8 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -94,11 +94,33 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #endif #ifdef TARGET_SPARC +#ifdef TARGET_SPARC64 #define ELF_START_MMAP 0x80000000 #define elf_check_arch(x) ( (x) == EM_SPARC ) +#define ELF_CLASS ELFCLASS64 +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_SPARC + +/*XXX*/ +#define ELF_PLAT_INIT(_r) + +static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +{ + regs->tstate = 0; + regs->pc = infop->entry; + regs->npc = regs->pc + 4; + regs->y = 0; + regs->u_regs[14] = infop->start_stack - 16 * 4; +} + +#else +#define ELF_START_MMAP 0x80000000 + +#define elf_check_arch(x) ( (x) == EM_SPARC ) + #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_SPARC @@ -116,6 +138,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i } #endif +#endif #ifdef TARGET_PPC diff --git a/linux-user/signal.c b/linux-user/signal.c index b2dcaa36a3..d3ca2bfef5 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -131,7 +131,7 @@ static void host_to_target_sigset_internal(target_sigset_t *d, d->sig[0] = target_sigmask; d->sig[1] = sigmask >> 32; #else -#error host_to_target_sigset +#warning host_to_target_sigset #endif } @@ -165,7 +165,7 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s) #elif TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 64 && TARGET_NSIG_WORDS == 2 ((unsigned long *)d)[0] = sigmask | ((unsigned long)(s->sig[1]) << 32); #else -#error target_to_host_sigset +#warning target_to_host_sigset #endif /* TARGET_LONG_BITS */ } @@ -1391,10 +1391,10 @@ setup___siginfo(__siginfo_t *si, CPUState *env, target_ulong mask) err |= __put_user(env->pc, &si->si_regs.pc); err |= __put_user(env->npc, &si->si_regs.npc); err |= __put_user(env->y, &si->si_regs.y); - for (i=0; i < 7; i++) { + for (i=0; i < 8; i++) { err |= __put_user(env->gregs[i], &si->si_regs.u_regs[i]); } - for (i=0; i < 7; i++) { + for (i=0; i < 8; i++) { err |= __put_user(env->regwptr[UREG_I0 + i], &si->si_regs.u_regs[i+8]); } err |= __put_user(mask, &si->si_mask); @@ -1452,10 +1452,10 @@ static void setup_frame(int sig, struct emulated_sigaction *ka, err |= __put_user(set->sig[i + 1], &sf->extramask[i]); } - for (i = 0; i < 7; i++) { + for (i = 0; i < 8; i++) { err |= __put_user(env->regwptr[i + UREG_L0], &sf->ss.locals[i]); } - for (i = 0; i < 7; i++) { + for (i = 0; i < 8; i++) { err |= __put_user(env->regwptr[i + UREG_I0], &sf->ss.ins[i]); } if (err) @@ -1488,7 +1488,6 @@ static void setup_frame(int sig, struct emulated_sigaction *ka, //flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); // tb_flush(env); } - //cpu_dump_state(env, stderr, fprintf, 0); return; //sigill_and_return: @@ -1569,7 +1568,6 @@ long do_sigreturn(CPUState *env) err = __get_user(pc, &sf->info.si_regs.pc); err |= __get_user(npc, &sf->info.si_regs.npc); - // fprintf(stderr, "pc: %lx npc %lx\n", pc, npc); if ((pc | npc) & 3) goto segv_and_exit; @@ -1577,16 +1575,16 @@ long do_sigreturn(CPUState *env) err |= __get_user(up_psr, &sf->info.si_regs.psr); /* User can only change condition codes and FPU enabling in %psr. */ - env->psr = (up_psr & ~(PSR_ICC /* | PSR_EF */)) - | (env->psr & (PSR_ICC /* | PSR_EF */)); - fprintf(stderr, "psr: %x\n", env->psr); - env->pc = pc-4; - env->npc = pc; + env->psr = (up_psr & (PSR_ICC /* | PSR_EF */)) + | (env->psr & ~(PSR_ICC /* | PSR_EF */)); + + env->pc = pc; + env->npc = npc; err |= __get_user(env->y, &sf->info.si_regs.y); - for (i=0; i < 7; i++) { + for (i=0; i < 8; i++) { err |= __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]); } - for (i=0; i < 7; i++) { + for (i=0; i < 8; i++) { err |= __get_user(env->regwptr[i + UREG_I0], &sf->info.si_regs.u_regs[i+8]); } @@ -1609,7 +1607,6 @@ long do_sigreturn(CPUState *env) if (err) goto segv_and_exit; - // fprintf(stderr, "returning %lx\n", env->regwptr[0]); return env->regwptr[0]; segv_and_exit: diff --git a/linux-user/sparc64/syscall.h b/linux-user/sparc64/syscall.h new file mode 100644 index 0000000000..c361558b67 --- /dev/null +++ b/linux-user/sparc64/syscall.h @@ -0,0 +1,10 @@ +struct target_pt_regs { + target_ulong u_regs[16]; + target_ulong tstate; + target_ulong pc; + target_ulong npc; + target_ulong y; + target_ulong fprs; +}; + +#define UNAME_MACHINE "sun4u" diff --git a/linux-user/sparc64/syscall_nr.h b/linux-user/sparc64/syscall_nr.h new file mode 100644 index 0000000000..9274c85fcf --- /dev/null +++ b/linux-user/sparc64/syscall_nr.h @@ -0,0 +1,286 @@ +#define TARGET_NR_restart_syscall 0 /* Linux Specific */ +#define TARGET_NR_exit 1 /* Common */ +#define TARGET_NR_fork 2 /* Common */ +#define TARGET_NR_read 3 /* Common */ +#define TARGET_NR_write 4 /* Common */ +#define TARGET_NR_open 5 /* Common */ +#define TARGET_NR_close 6 /* Common */ +#define TARGET_NR_wait4 7 /* Common */ +#define TARGET_NR_creat 8 /* Common */ +#define TARGET_NR_link 9 /* Common */ +#define TARGET_NR_unlink 10 /* Common */ +#define TARGET_NR_execv 11 /* SunOS Specific */ +#define TARGET_NR_chdir 12 /* Common */ +#define TARGET_NR_chown 13 /* Common */ +#define TARGET_NR_mknod 14 /* Common */ +#define TARGET_NR_chmod 15 /* Common */ +#define TARGET_NR_lchown 16 /* Common */ +#define TARGET_NR_brk 17 /* Common */ +#define TARGET_NR_perfctr 18 /* Performance counter operations */ +#define TARGET_NR_lseek 19 /* Common */ +#define TARGET_NR_getpid 20 /* Common */ +#define TARGET_NR_capget 21 /* Linux Specific */ +#define TARGET_NR_capset 22 /* Linux Specific */ +#define TARGET_NR_setuid 23 /* Implemented via setreuid in SunOS */ +#define TARGET_NR_getuid 24 /* Common */ +/* #define TARGET_NR_time alias 25 ENOSYS under SunOS */ +#define TARGET_NR_ptrace 26 /* Common */ +#define TARGET_NR_alarm 27 /* Implemented via setitimer in SunOS */ +#define TARGET_NR_sigaltstack 28 /* Common */ +#define TARGET_NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */ +#define TARGET_NR_utime 30 /* Implemented via utimes() under SunOS */ +/* #define TARGET_NR_lchown32 31 Linux sparc32 specific */ +/* #define TARGET_NR_fchown32 32 Linux sparc32 specific */ +#define TARGET_NR_access 33 /* Common */ +#define TARGET_NR_nice 34 /* Implemented via get/setpriority() in SunOS */ +/* #define TARGET_NR_chown32 35 Linux sparc32 specific */ +#define TARGET_NR_sync 36 /* Common */ +#define TARGET_NR_kill 37 /* Common */ +#define TARGET_NR_stat 38 /* Common */ +#define TARGET_NR_sendfile 39 /* Linux Specific */ +#define TARGET_NR_lstat 40 /* Common */ +#define TARGET_NR_dup 41 /* Common */ +#define TARGET_NR_pipe 42 /* Common */ +#define TARGET_NR_times 43 /* Implemented via getrusage() in SunOS */ +/* #define TARGET_NR_getuid32 44 Linux sparc32 specific */ +#define TARGET_NR_umount2 45 /* Linux Specific */ +#define TARGET_NR_setgid 46 /* Implemented via setregid() in SunOS */ +#define TARGET_NR_getgid 47 /* Common */ +#define TARGET_NR_signal 48 /* Implemented via sigvec() in SunOS */ +#define TARGET_NR_geteuid 49 /* SunOS calls getuid() */ +#define TARGET_NR_getegid 50 /* SunOS calls getgid() */ +#define TARGET_NR_acct 51 /* Common */ +#define TARGET_NR_memory_ordering 52 /* Linux Specific */ +/* #define TARGET_NR_getgid32 53 Linux sparc32 specific */ +#define TARGET_NR_ioctl 54 /* Common */ +#define TARGET_NR_reboot 55 /* Common */ +/* #define TARGET_NR_mmap2 56 Linux sparc32 Specific */ +#define TARGET_NR_symlink 57 /* Common */ +#define TARGET_NR_readlink 58 /* Common */ +#define TARGET_NR_execve 59 /* Common */ +#define TARGET_NR_umask 60 /* Common */ +#define TARGET_NR_chroot 61 /* Common */ +#define TARGET_NR_fstat 62 /* Common */ +/* #define TARGET_NR_fstat64 63 Linux sparc32 Specific */ +#define TARGET_NR_getpagesize 64 /* Common */ +#define TARGET_NR_msync 65 /* Common in newer 1.3.x revs... */ +#define TARGET_NR_vfork 66 /* Common */ +#define TARGET_NR_pread64 67 /* Linux Specific */ +#define TARGET_NR_pwrite64 68 /* Linux Specific */ +/* #define TARGET_NR_geteuid32 69 Linux sparc32, sbrk under SunOS */ +/* #define TARGET_NR_getegid32 70 Linux sparc32, sstk under SunOS */ +#define TARGET_NR_mmap 71 /* Common */ +/* #define TARGET_NR_setreuid32 72 Linux sparc32, vadvise under SunOS */ +#define TARGET_NR_munmap 73 /* Common */ +#define TARGET_NR_mprotect 74 /* Common */ +#define TARGET_NR_madvise 75 /* Common */ +#define TARGET_NR_vhangup 76 /* Common */ +/* #define TARGET_NR_truncate64 77 Linux sparc32 Specific */ +#define TARGET_NR_mincore 78 /* Common */ +#define TARGET_NR_getgroups 79 /* Common */ +#define TARGET_NR_setgroups 80 /* Common */ +#define TARGET_NR_getpgrp 81 /* Common */ +/* #define TARGET_NR_setgroups32 82 Linux sparc32, setpgrp under SunOS */ +#define TARGET_NR_setitimer 83 /* Common */ +/* #define TARGET_NR_ftruncate64 84 Linux sparc32 Specific */ +#define TARGET_NR_swapon 85 /* Common */ +#define TARGET_NR_getitimer 86 /* Common */ +/* #define TARGET_NR_setuid32 87 Linux sparc32, gethostname under SunOS */ +#define TARGET_NR_sethostname 88 /* Common */ +/* #define TARGET_NR_setgid32 89 Linux sparc32, getdtablesize under SunOS */ +#define TARGET_NR_dup2 90 /* Common */ +/* #define TARGET_NR_setfsuid32 91 Linux sparc32, getdopt under SunOS */ +#define TARGET_NR_fcntl 92 /* Common */ +#define TARGET_NR_select 93 /* Common */ +/* #define TARGET_NR_setfsgid32 94 Linux sparc32, setdopt under SunOS */ +#define TARGET_NR_fsync 95 /* Common */ +#define TARGET_NR_setpriority 96 /* Common */ +#define TARGET_NR_socket 97 /* Common */ +#define TARGET_NR_connect 98 /* Common */ +#define TARGET_NR_accept 99 /* Common */ +#define TARGET_NR_getpriority 100 /* Common */ +#define TARGET_NR_rt_sigreturn 101 /* Linux Specific */ +#define TARGET_NR_rt_sigaction 102 /* Linux Specific */ +#define TARGET_NR_rt_sigprocmask 103 /* Linux Specific */ +#define TARGET_NR_rt_sigpending 104 /* Linux Specific */ +#define TARGET_NR_rt_sigtimedwait 105 /* Linux Specific */ +#define TARGET_NR_rt_sigqueueinfo 106 /* Linux Specific */ +#define TARGET_NR_rt_sigsuspend 107 /* Linux Specific */ +#define TARGET_NR_setresuid 108 /* Linux Specific, sigvec under SunOS */ +#define TARGET_NR_getresuid 109 /* Linux Specific, sigblock under SunOS */ +#define TARGET_NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */ +#define TARGET_NR_getresgid 111 /* Linux Specific, sigpause under SunOS */ +/* #define TARGET_NR_setregid32 75 Linux sparc32, sigstack under SunOS */ +#define TARGET_NR_recvmsg 113 /* Common */ +#define TARGET_NR_sendmsg 114 /* Common */ +/* #define TARGET_NR_getgroups32 115 Linux sparc32, vtrace under SunOS */ +#define TARGET_NR_gettimeofday 116 /* Common */ +#define TARGET_NR_getrusage 117 /* Common */ +#define TARGET_NR_getsockopt 118 /* Common */ +#define TARGET_NR_getcwd 119 /* Linux Specific */ +#define TARGET_NR_readv 120 /* Common */ +#define TARGET_NR_writev 121 /* Common */ +#define TARGET_NR_settimeofday 122 /* Common */ +#define TARGET_NR_fchown 123 /* Common */ +#define TARGET_NR_fchmod 124 /* Common */ +#define TARGET_NR_recvfrom 125 /* Common */ +#define TARGET_NR_setreuid 126 /* Common */ +#define TARGET_NR_setregid 127 /* Common */ +#define TARGET_NR_rename 128 /* Common */ +#define TARGET_NR_truncate 129 /* Common */ +#define TARGET_NR_ftruncate 130 /* Common */ +#define TARGET_NR_flock 131 /* Common */ +/* #define TARGET_NR_lstat64 132 Linux sparc32 Specific */ +#define TARGET_NR_sendto 133 /* Common */ +#define TARGET_NR_shutdown 134 /* Common */ +#define TARGET_NR_socketpair 135 /* Common */ +#define TARGET_NR_mkdir 136 /* Common */ +#define TARGET_NR_rmdir 137 /* Common */ +#define TARGET_NR_utimes 138 /* SunOS Specific */ +/* #define TARGET_NR_stat64 139 Linux sparc32 Specific */ +#define TARGET_NR_sendfile64 140 /* adjtime under SunOS */ +#define TARGET_NR_getpeername 141 /* Common */ +#define TARGET_NR_futex 142 /* gethostid under SunOS */ +#define TARGET_NR_gettid 143 /* ENOSYS under SunOS */ +#define TARGET_NR_getrlimit 144 /* Common */ +#define TARGET_NR_setrlimit 145 /* Common */ +#define TARGET_NR_pivot_root 146 /* Linux Specific, killpg under SunOS */ +#define TARGET_NR_prctl 147 /* ENOSYS under SunOS */ +#define TARGET_NR_pciconfig_read 148 /* ENOSYS under SunOS */ +#define TARGET_NR_pciconfig_write 149 /* ENOSYS under SunOS */ +#define TARGET_NR_getsockname 150 /* Common */ +/* #define TARGET_NR_getmsg 151 SunOS Specific */ +/* #define TARGET_NR_putmsg 152 SunOS Specific */ +#define TARGET_NR_poll 153 /* Common */ +#define TARGET_NR_getdents64 154 /* Linux specific */ +/* #define TARGET_NR_fcntl64 155 Linux sparc32 Specific */ +/* #define TARGET_NR_getdirentries 156 SunOS Specific */ +#define TARGET_NR_statfs 157 /* Common */ +#define TARGET_NR_fstatfs 158 /* Common */ +#define TARGET_NR_umount 159 /* Common */ +#define TARGET_NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */ +#define TARGET_NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */ +#define TARGET_NR_getdomainname 162 /* SunOS Specific */ +#define TARGET_NR_setdomainname 163 /* Common */ +#define TARGET_NR_utrap_install 164 /* SYSV ABI/v9 required */ +#define TARGET_NR_quotactl 165 /* Common */ +#define TARGET_NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */ +#define TARGET_NR_mount 167 /* Common */ +#define TARGET_NR_ustat 168 /* Common */ +#define TARGET_NR_setxattr 169 /* SunOS: semsys */ +#define TARGET_NR_lsetxattr 170 /* SunOS: msgsys */ +#define TARGET_NR_fsetxattr 171 /* SunOS: shmsys */ +#define TARGET_NR_getxattr 172 /* SunOS: auditsys */ +#define TARGET_NR_lgetxattr 173 /* SunOS: rfssys */ +#define TARGET_NR_getdents 174 /* Common */ +#define TARGET_NR_setsid 175 /* Common */ +#define TARGET_NR_fchdir 176 /* Common */ +#define TARGET_NR_fgetxattr 177 /* SunOS: fchroot */ +#define TARGET_NR_listxattr 178 /* SunOS: vpixsys */ +#define TARGET_NR_llistxattr 179 /* SunOS: aioread */ +#define TARGET_NR_flistxattr 180 /* SunOS: aiowrite */ +#define TARGET_NR_removexattr 181 /* SunOS: aiowait */ +#define TARGET_NR_lremovexattr 182 /* SunOS: aiocancel */ +#define TARGET_NR_sigpending 183 /* Common */ +#define TARGET_NR_query_module 184 /* Linux Specific */ +#define TARGET_NR_setpgid 185 /* Common */ +#define TARGET_NR_fremovexattr 186 /* SunOS: pathconf */ +#define TARGET_NR_tkill 187 /* SunOS: fpathconf */ +#define TARGET_NR_exit_group 188 /* Linux specific, sysconf undef SunOS */ +#define TARGET_NR_uname 189 /* Linux Specific */ +#define TARGET_NR_init_module 190 /* Linux Specific */ +#define TARGET_NR_personality 191 /* Linux Specific */ +#define TARGET_NR_remap_file_pages 192 /* Linux Specific */ +#define TARGET_NR_epoll_create 193 /* Linux Specific */ +#define TARGET_NR_epoll_ctl 194 /* Linux Specific */ +#define TARGET_NR_epoll_wait 195 /* Linux Specific */ +/* #define TARGET_NR_ulimit 196 Linux Specific */ +#define TARGET_NR_getppid 197 /* Linux Specific */ +#define TARGET_NR_sigaction 198 /* Linux Specific */ +#define TARGET_NR_sgetmask 199 /* Linux Specific */ +#define TARGET_NR_ssetmask 200 /* Linux Specific */ +#define TARGET_NR_sigsuspend 201 /* Linux Specific */ +#define TARGET_NR_oldlstat 202 /* Linux Specific */ +#define TARGET_NR_uselib 203 /* Linux Specific */ +#define TARGET_NR_readdir 204 /* Linux Specific */ +#define TARGET_NR_readahead 205 /* Linux Specific */ +#define TARGET_NR_socketcall 206 /* Linux Specific */ +#define TARGET_NR_syslog 207 /* Linux Specific */ +#define TARGET_NR_lookup_dcookie 208 /* Linux Specific */ +#define TARGET_NR_fadvise64 209 /* Linux Specific */ +#define TARGET_NR_fadvise64_64 210 /* Linux Specific */ +#define TARGET_NR_tgkill 211 /* Linux Specific */ +#define TARGET_NR_waitpid 212 /* Linux Specific */ +#define TARGET_NR_swapoff 213 /* Linux Specific */ +#define TARGET_NR_sysinfo 214 /* Linux Specific */ +#define TARGET_NR_ipc 215 /* Linux Specific */ +#define TARGET_NR_sigreturn 216 /* Linux Specific */ +#define TARGET_NR_clone 217 /* Linux Specific */ +/* #define TARGET_NR_modify_ldt 218 Linux Specific - i386 specific, unused */ +#define TARGET_NR_adjtimex 219 /* Linux Specific */ +#define TARGET_NR_sigprocmask 220 /* Linux Specific */ +#define TARGET_NR_create_module 221 /* Linux Specific */ +#define TARGET_NR_delete_module 222 /* Linux Specific */ +#define TARGET_NR_get_kernel_syms 223 /* Linux Specific */ +#define TARGET_NR_getpgid 224 /* Linux Specific */ +#define TARGET_NR_bdflush 225 /* Linux Specific */ +#define TARGET_NR_sysfs 226 /* Linux Specific */ +#define TARGET_NR_afs_syscall 227 /* Linux Specific */ +#define TARGET_NR_setfsuid 228 /* Linux Specific */ +#define TARGET_NR_setfsgid 229 /* Linux Specific */ +#define TARGET_NR__newselect 230 /* Linux Specific */ +#ifdef __KERNEL__ +#define TARGET_NR_time 231 /* Linux sparc32 */ +#endif +/* #define TARGET_NR_oldstat 232 Linux Specific */ +#define TARGET_NR_stime 233 /* Linux Specific */ +#define TARGET_NR_statfs64 234 /* Linux Specific */ +#define TARGET_NR_fstatfs64 235 /* Linux Specific */ +#define TARGET_NR__llseek 236 /* Linux Specific */ +#define TARGET_NR_mlock 237 +#define TARGET_NR_munlock 238 +#define TARGET_NR_mlockall 239 +#define TARGET_NR_munlockall 240 +#define TARGET_NR_sched_setparam 241 +#define TARGET_NR_sched_getparam 242 +#define TARGET_NR_sched_setscheduler 243 +#define TARGET_NR_sched_getscheduler 244 +#define TARGET_NR_sched_yield 245 +#define TARGET_NR_sched_get_priority_max 246 +#define TARGET_NR_sched_get_priority_min 247 +#define TARGET_NR_sched_rr_get_interval 248 +#define TARGET_NR_nanosleep 249 +#define TARGET_NR_mremap 250 +#define TARGET_NR__sysctl 251 +#define TARGET_NR_getsid 252 +#define TARGET_NR_fdatasync 253 +#define TARGET_NR_nfsservctl 254 +#define TARGET_NR_aplib 255 +#define TARGET_NR_clock_settime 256 +#define TARGET_NR_clock_gettime 257 +#define TARGET_NR_clock_getres 258 +#define TARGET_NR_clock_nanosleep 259 +#define TARGET_NR_sched_getaffinity 260 +#define TARGET_NR_sched_setaffinity 261 +#define TARGET_NR_timer_settime 262 +#define TARGET_NR_timer_gettime 263 +#define TARGET_NR_timer_getoverrun 264 +#define TARGET_NR_timer_delete 265 +#define TARGET_NR_timer_create 266 +/* #define TARGET_NR_vserver 267 Reserved for VSERVER */ +#define TARGET_NR_io_setup 268 +#define TARGET_NR_io_destroy 269 +#define TARGET_NR_io_submit 270 +#define TARGET_NR_io_cancel 271 +#define TARGET_NR_io_getevents 272 +#define TARGET_NR_mq_open 273 +#define TARGET_NR_mq_unlink 274 +#define TARGET_NR_mq_timedsend 275 +#define TARGET_NR_mq_timedreceive 276 +#define TARGET_NR_mq_notify 277 +#define TARGET_NR_mq_getsetattr 278 +#define TARGET_NR_waitid 279 +/*#define TARGET_NR_sys_setaltroot 280 available (was setaltroot) */ +#define TARGET_NR_add_key 281 +#define TARGET_NR_request_key 282 +#define TARGET_NR_keyctl 283 diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h new file mode 100644 index 0000000000..cad45b2925 --- /dev/null +++ b/linux-user/sparc64/termbits.h @@ -0,0 +1,279 @@ +/* from asm/termbits.h */ + +#define TARGET_NCCS 19 + +struct target_termios { + unsigned int c_iflag; /* input mode flags */ + unsigned int c_oflag; /* output mode flags */ + unsigned int c_cflag; /* control mode flags */ + unsigned int c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[TARGET_NCCS]; /* control characters */ +}; + +/* c_cc characters */ +#define TARGET_VINTR 0 +#define TARGET_VQUIT 1 +#define TARGET_VERASE 2 +#define TARGET_VKILL 3 +#define TARGET_VEOF 4 +#define TARGET_VEOL 5 +#define TARGET_VEOL2 6 +#define TARGET_VSWTC 7 +#define TARGET_VSTART 8 +#define TARGET_VSTOP 9 + +#define TARGET_VSUSP 10 +#define TARGET_VDSUSP 11 /* SunOS POSIX nicety I do believe... */ +#define TARGET_VREPRINT 12 +#define TARGET_VDISCARD 13 +#define TARGET_VWERASE 14 +#define TARGET_VLNEXT 15 + +/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is + * shared with eof/eol + */ +#define TARGET_VMIN TARGET_VEOF +#define TARGET_VTIME TARGET_VEOL + +/* c_iflag bits */ +#define TARGET_IGNBRK 0x00000001 +#define TARGET_BRKINT 0x00000002 +#define TARGET_IGNPAR 0x00000004 +#define TARGET_PARMRK 0x00000008 +#define TARGET_INPCK 0x00000010 +#define TARGET_ISTRIP 0x00000020 +#define TARGET_INLCR 0x00000040 +#define TARGET_IGNCR 0x00000080 +#define TARGET_ICRNL 0x00000100 +#define TARGET_IUCLC 0x00000200 +#define TARGET_IXON 0x00000400 +#define TARGET_IXANY 0x00000800 +#define TARGET_IXOFF 0x00001000 +#define TARGET_IMAXBEL 0x00002000 + +/* c_oflag bits */ +#define TARGET_OPOST 0x00000001 +#define TARGET_OLCUC 0x00000002 +#define TARGET_ONLCR 0x00000004 +#define TARGET_OCRNL 0x00000008 +#define TARGET_ONOCR 0x00000010 +#define TARGET_ONLRET 0x00000020 +#define TARGET_OFILL 0x00000040 +#define TARGET_OFDEL 0x00000080 +#define TARGET_NLDLY 0x00000100 +#define TARGET_NL0 0x00000000 +#define TARGET_NL1 0x00000100 +#define TARGET_CRDLY 0x00000600 +#define TARGET_CR0 0x00000000 +#define TARGET_CR1 0x00000200 +#define TARGET_CR2 0x00000400 +#define TARGET_CR3 0x00000600 +#define TARGET_TABDLY 0x00001800 +#define TARGET_TAB0 0x00000000 +#define TARGET_TAB1 0x00000800 +#define TARGET_TAB2 0x00001000 +#define TARGET_TAB3 0x00001800 +#define TARGET_XTABS 0x00001800 +#define TARGET_BSDLY 0x00002000 +#define TARGET_BS0 0x00000000 +#define TARGET_BS1 0x00002000 +#define TARGET_VTDLY 0x00004000 +#define TARGET_VT0 0x00000000 +#define TARGET_VT1 0x00004000 +#define TARGET_FFDLY 0x00008000 +#define TARGET_FF0 0x00000000 +#define TARGET_FF1 0x00008000 +#define TARGET_PAGEOUT 0x00010000 /* SUNOS specific */ +#define TARGET_WRAP 0x00020000 /* SUNOS specific */ + +/* c_cflag bit meaning */ +#define TARGET_CBAUD 0x0000100f +#define TARGET_B0 0x00000000 /* hang up */ +#define TARGET_B50 0x00000001 +#define TARGET_B75 0x00000002 +#define TARGET_B110 0x00000003 +#define TARGET_B134 0x00000004 +#define TARGET_B150 0x00000005 +#define TARGET_B200 0x00000006 +#define TARGET_B300 0x00000007 +#define TARGET_B600 0x00000008 +#define TARGET_B1200 0x00000009 +#define TARGET_B1800 0x0000000a +#define TARGET_B2400 0x0000000b +#define TARGET_B4800 0x0000000c +#define TARGET_B9600 0x0000000d +#define TARGET_B19200 0x0000000e +#define TARGET_B38400 0x0000000f +#define TARGET_EXTA B19200 +#define TARGET_EXTB B38400 +#define TARGET_CSIZE 0x00000030 +#define TARGET_CS5 0x00000000 +#define TARGET_CS6 0x00000010 +#define TARGET_CS7 0x00000020 +#define TARGET_CS8 0x00000030 +#define TARGET_CSTOPB 0x00000040 +#define TARGET_CREAD 0x00000080 +#define TARGET_PARENB 0x00000100 +#define TARGET_PARODD 0x00000200 +#define TARGET_HUPCL 0x00000400 +#define TARGET_CLOCAL 0x00000800 +#define TARGET_CBAUDEX 0x00001000 +/* We'll never see these speeds with the Zilogs, but for completeness... */ +#define TARGET_B57600 0x00001001 +#define TARGET_B115200 0x00001002 +#define TARGET_B230400 0x00001003 +#define TARGET_B460800 0x00001004 +/* This is what we can do with the Zilogs. */ +#define TARGET_B76800 0x00001005 +/* This is what we can do with the SAB82532. */ +#define TARGET_B153600 0x00001006 +#define TARGET_B307200 0x00001007 +#define TARGET_B614400 0x00001008 +#define TARGET_B921600 0x00001009 +/* And these are the rest... */ +#define TARGET_B500000 0x0000100a +#define TARGET_B576000 0x0000100b +#define TARGET_B1000000 0x0000100c +#define TARGET_B1152000 0x0000100d +#define TARGET_B1500000 0x0000100e +#define TARGET_B2000000 0x0000100f +/* These have totally bogus values and nobody uses them + so far. Later on we'd have to use say 0x10000x and + adjust CBAUD constant and drivers accordingly. +#define B2500000 0x00001010 +#define B3000000 0x00001011 +#define B3500000 0x00001012 +#define B4000000 0x00001013 */ +#define TARGET_CIBAUD 0x100f0000 /* input baud rate (not used) */ +#define TARGET_CMSPAR 0x40000000 /* mark or space (stick) parity */ +#define TARGET_CRTSCTS 0x80000000 /* flow control */ + +/* c_lflag bits */ +#define TARGET_ISIG 0x00000001 +#define TARGET_ICANON 0x00000002 +#define TARGET_XCASE 0x00000004 +#define TARGET_ECHO 0x00000008 +#define TARGET_ECHOE 0x00000010 +#define TARGET_ECHOK 0x00000020 +#define TARGET_ECHONL 0x00000040 +#define TARGET_NOFLSH 0x00000080 +#define TARGET_TOSTOP 0x00000100 +#define TARGET_ECHOCTL 0x00000200 +#define TARGET_ECHOPRT 0x00000400 +#define TARGET_ECHOKE 0x00000800 +#define TARGET_DEFECHO 0x00001000 /* SUNOS thing, what is it? */ +#define TARGET_FLUSHO 0x00002000 +#define TARGET_PENDIN 0x00004000 +#define TARGET_IEXTEN 0x00008000 + +/* ioctls */ + +/* Big T */ +#define TARGET_TCGETA TARGET_IOR('T', 1, struct target_termio) +#define TARGET_TCSETA TARGET_IOW('T', 2, struct target_termio) +#define TARGET_TCSETAW TARGET_IOW('T', 3, struct target_termio) +#define TARGET_TCSETAF TARGET_IOW('T', 4, struct target_termio) +#define TARGET_TCSBRK TARGET_IO('T', 5) +#define TARGET_TCXONC TARGET_IO('T', 6) +#define TARGET_TCFLSH TARGET_IO('T', 7) +#define TARGET_TCGETS TARGET_IOR('T', 8, struct target_termios) +#define TARGET_TCSETS TARGET_IOW('T', 9, struct target_termios) +#define TARGET_TCSETSW TARGET_IOW('T', 10, struct target_termios) +#define TARGET_TCSETSF TARGET_IOW('T', 11, struct target_termios) + +/* Note that all the ioctls that are not available in Linux have a + * double underscore on the front to: a) avoid some programs to + * thing we support some ioctls under Linux (autoconfiguration stuff) + */ +/* Little t */ +#define TARGET_TIOCGETD TARGET_IOR('t', 0, int) +#define TARGET_TIOCSETD TARGET_IOW('t', 1, int) +//#define __TIOCHPCL _IO('t', 2) /* SunOS Specific */ +//#define __TIOCMODG _IOR('t', 3, int) /* SunOS Specific */ +//#define __TIOCMODS _IOW('t', 4, int) /* SunOS Specific */ +//#define __TIOCGETP _IOR('t', 8, struct sgttyb) /* SunOS Specific */ +//#define __TIOCSETP _IOW('t', 9, struct sgttyb) /* SunOS Specific */ +//#define __TIOCSETN _IOW('t', 10, struct sgttyb) /* SunOS Specific */ +#define TARGET_TIOCEXCL TARGET_IO('t', 13) +#define TARGET_TIOCNXCL TARGET_IO('t', 14) +//#define __TIOCFLUSH _IOW('t', 16, int) /* SunOS Specific */ +//#define __TIOCSETC _IOW('t', 17, struct tchars) /* SunOS Specific */ +//#define __TIOCGETC _IOR('t', 18, struct tchars) /* SunOS Specific */ +//#define __TIOCTCNTL _IOW('t', 32, int) /* SunOS Specific */ +//#define __TIOCSIGNAL _IOW('t', 33, int) /* SunOS Specific */ +//#define __TIOCSETX _IOW('t', 34, int) /* SunOS Specific */ +//#define __TIOCGETX _IOR('t', 35, int) /* SunOS Specific */ +#define TARGET_TIOCCONS TARGET_IO('t', 36) +//#define __TIOCSSIZE _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */ +//#define __TIOCGSIZE _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */ +#define TARGET_TIOCGSOFTCAR TARGET_IOR('t', 100, int) +#define TARGET_TIOCSSOFTCAR TARGET_IOW('t', 101, int) +//#define __TIOCUCNTL _IOW('t', 102, int) /* SunOS Specific */ +#define TARGET_TIOCSWINSZ TARGET_IOW('t', 103, struct winsize) +#define TARGET_TIOCGWINSZ TARGET_IOR('t', 104, struct winsize) +//#define __TIOCREMOTE _IOW('t', 105, int) /* SunOS Specific */ +#define TARGET_TIOCMGET TARGET_IOR('t', 106, int) +#define TARGET_TIOCMBIC TARGET_IOW('t', 107, int) +#define TARGET_TIOCMBIS TARGET_IOW('t', 108, int) +#define TARGET_TIOCMSET TARGET_IOW('t', 109, int) +#define TARGET_TIOCSTART TARGET_IO('t', 110) +#define TARGET_TIOCSTOP TARGET_IO('t', 111) +#define TARGET_TIOCPKT TARGET_IOW('t', 112, int) +#define TARGET_TIOCNOTTY TARGET_IO('t', 113) +#define TARGET_TIOCSTI TARGET_IOW('t', 114, char) +#define TARGET_TIOCOUTQ TARGET_IOR('t', 115, int) +//#define __TIOCGLTC _IOR('t', 116, struct ltchars) /* SunOS Specific */ +//#define __TIOCSLTC _IOW('t', 117, struct ltchars) /* SunOS Specific */ +/* 118 is the non-posix setpgrp tty ioctl */ +/* 119 is the non-posix getpgrp tty ioctl */ +//#define __TIOCCDTR TARGET_IO('t', 120) /* SunOS Specific */ +//#define __TIOCSDTR TARGET_IO('t', 121) /* SunOS Specific */ +#define TARGET_TIOCCBRK TARGET_IO('t', 122) +#define TARGET_TIOCSBRK TARGET_IO('t', 123) +//#define __TIOCLGET TARGET_IOW('t', 124, int) /* SunOS Specific */ +//#define __TIOCLSET TARGET_IOW('t', 125, int) /* SunOS Specific */ +//#define __TIOCLBIC TARGET_IOW('t', 126, int) /* SunOS Specific */ +//#define __TIOCLBIS TARGET_IOW('t', 127, int) /* SunOS Specific */ +//#define __TIOCISPACE TARGET_IOR('t', 128, int) /* SunOS Specific */ +//#define __TIOCISIZE TARGET_IOR('t', 129, int) /* SunOS Specific */ +#define TARGET_TIOCSPGRP TARGET_IOW('t', 130, int) +#define TARGET_TIOCGPGRP TARGET_IOR('t', 131, int) +#define TARGET_TIOCSCTTY TARGET_IO('t', 132) +#define TARGET_TIOCGSID TARGET_IOR('t', 133, int) +/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ +#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */ +#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */ + +/* Little f */ +#define TARGET_FIOCLEX TARGET_IO('f', 1) +#define TARGET_FIONCLEX TARGET_IO('f', 2) +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) +#define TARGET_FIONBIO TARGET_IOW('f', 126, int) +#define TARGET_FIONREAD TARGET_IOR('f', 127, int) +#define TARGET_TIOCINQ TARGET_FIONREAD + +/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it + * someday. This is completely bogus, I know... + */ +//#define __TCGETSTAT TARGET_IO('T', 200) /* Rutgers specific */ +//#define __TCSETSTAT TARGET_IO('T', 201) /* Rutgers specific */ + +/* Linux specific, no SunOS equivalent. */ +#define TARGET_TIOCLINUX 0x541C +#define TARGET_TIOCGSERIAL 0x541E +#define TARGET_TIOCSSERIAL 0x541F +#define TARGET_TCSBRKP 0x5425 +#define TARGET_TIOCTTYGSTRUCT 0x5426 +#define TARGET_TIOCSERCONFIG 0x5453 +#define TARGET_TIOCSERGWILD 0x5454 +#define TARGET_TIOCSERSWILD 0x5455 +#define TARGET_TIOCGLCKTRMIOS 0x5456 +#define TARGET_TIOCSLCKTRMIOS 0x5457 +#define TARGET_TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TARGET_TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */ +#define TARGET_TIOCMIWAIT 0x545C /* Wait input */ +#define TARGET_TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */ + diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7901befdd2..9c7992e0b8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1674,6 +1674,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, case TARGET_NR_chdir: ret = get_errno(chdir((const char *)arg1)); break; +#ifdef TARGET_NR_time case TARGET_NR_time: { int *time_ptr = (int *)arg1; @@ -1682,6 +1683,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, tswap32s(time_ptr); } break; +#endif case TARGET_NR_mknod: ret = get_errno(mknod((const char *)arg1, arg2, arg3)); break; @@ -2168,6 +2170,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, arg6)); #endif break; +#ifdef TARGET_NR_mmap2 case TARGET_NR_mmap2: #if defined(TARGET_SPARC) #define MMAP_SHIFT 12 @@ -2179,6 +2182,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, arg5, arg6 << MMAP_SHIFT)); break; +#endif case TARGET_NR_munmap: ret = get_errno(target_munmap(arg1, arg2)); break; @@ -2471,7 +2475,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, break; case TARGET_NR_getdents: #if TARGET_LONG_SIZE != 4 -#error not supported +#warning not supported #elif TARGET_LONG_SIZE == 4 && HOST_LONG_SIZE == 8 { struct target_dirent *target_dirp = (void *)arg2; @@ -2746,16 +2750,25 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, break; } #endif +#ifdef TARGET_NR_truncate64 case TARGET_NR_truncate64: goto unimplemented; +#endif +#ifdef TARGET_NR_ftruncate64 case TARGET_NR_ftruncate64: goto unimplemented; +#endif +#ifdef TARGET_NR_stat64 case TARGET_NR_stat64: ret = get_errno(stat(path((const char *)arg1), &st)); goto do_stat64; +#endif +#ifdef TARGET_NR_lstat64 case TARGET_NR_lstat64: ret = get_errno(lstat(path((const char *)arg1), &st)); goto do_stat64; +#endif +#ifdef TARGET_NR_fstat64 case TARGET_NR_fstat64: { ret = get_errno(fstat(arg1, &st)); @@ -2783,7 +2796,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, } } break; - +#endif #ifdef USE_UID16 case TARGET_NR_lchown: ret = get_errno(lchown((const char *)arg1, low2highuid(arg2), low2highgid(arg3))); @@ -2894,37 +2907,60 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, break; #endif /* USE_UID16 */ +#ifdef TARGET_NR_lchown32 case TARGET_NR_lchown32: ret = get_errno(lchown((const char *)arg1, arg2, arg3)); break; +#endif +#ifdef TARGET_NR_getuid32 case TARGET_NR_getuid32: ret = get_errno(getuid()); break; +#endif +#ifdef TARGET_NR_getgid32 case TARGET_NR_getgid32: ret = get_errno(getgid()); break; +#endif +#ifdef TARGET_NR_geteuid32 case TARGET_NR_geteuid32: ret = get_errno(geteuid()); break; +#endif +#ifdef TARGET_NR_getegid32 case TARGET_NR_getegid32: ret = get_errno(getegid()); break; +#endif +#ifdef TARGET_NR_setreuid32 case TARGET_NR_setreuid32: ret = get_errno(setreuid(arg1, arg2)); break; +#endif +#ifdef TARGET_NR_setregid32 case TARGET_NR_setregid32: ret = get_errno(setregid(arg1, arg2)); break; +#endif +#ifdef TARGET_NR_getgroups32 case TARGET_NR_getgroups32: goto unimplemented; +#endif +#ifdef TARGET_NR_setgroups32 case TARGET_NR_setgroups32: goto unimplemented; +#endif +#ifdef TARGET_NR_fchown32 case TARGET_NR_fchown32: ret = get_errno(fchown(arg1, arg2, arg3)); break; +#endif +#ifdef TARGET_NR_setresuid32 case TARGET_NR_setresuid32: ret = get_errno(setresuid(arg1, arg2, arg3)); break; +#endif +#ifdef TARGET_NR_getresuid32 case TARGET_NR_getresuid32: { int ruid, euid, suid; @@ -2936,9 +2972,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, } } break; +#endif +#ifdef TARGET_NR_setresgid32 case TARGET_NR_setresgid32: ret = get_errno(setresgid(arg1, arg2, arg3)); break; +#endif +#ifdef TARGET_NR_getresgid32 case TARGET_NR_getresgid32: { int rgid, egid, sgid; @@ -2950,21 +2990,32 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, } } break; +#endif +#ifdef TARGET_NR_chown32 case TARGET_NR_chown32: ret = get_errno(chown((const char *)arg1, arg2, arg3)); break; +#endif +#ifdef TARGET_NR_setuid32 case TARGET_NR_setuid32: ret = get_errno(setuid(arg1)); break; +#endif +#ifdef TARGET_NR_setgid32 case TARGET_NR_setgid32: ret = get_errno(setgid(arg1)); break; +#endif +#ifdef TARGET_NR_setfsuid32 case TARGET_NR_setfsuid32: ret = get_errno(setfsuid(arg1)); break; +#endif +#ifdef TARGET_NR_setfsgid32 case TARGET_NR_setfsgid32: ret = get_errno(setfsgid(arg1)); break; +#endif case TARGET_NR_pivot_root: goto unimplemented; |