From 19e64aa99d52ec61c74a09d54b050adc59cdb88b Mon Sep 17 00:00:00 2001 From: Kazuhiro Inaoka Date: Thu, 9 Dec 2004 00:47:45 +0000 Subject: [PATCH] 2004-12-09 Kazuhiro Inaoka Committed by Kei Sakamoto. * traps-linux.c (m32r_trap): Add entries of the following dummy system calls: __NR_mmap2, __NR_lchown32, __NR_getuid32, __NR_getgid32, __NR_geteuid32, __NR_getegid32, __NR_getgroups32, __NR_fchown32, __NR_setfsuid32, __NR_setfsgid32, __NR_getresuid32, __NR_getresgid32 and __NR_chown32. * syscall.h: Add new definitions of system call number. --- sim/m32r/ChangeLog | 10 +++++ sim/m32r/syscall.h | 86 ++++++++++++++++++++++++++++++++++++++++++ sim/m32r/traps-linux.c | 39 +++++++++++++++++++ 3 files changed, 135 insertions(+) diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 89a44f0e8f5..3722ee2f0cf 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,13 @@ +2004-12-09 Kazuhiro Inaoka + + Committed by Kei Sakamoto. + * traps-linux.c (m32r_trap): Add entries of the following dummy system + calls: __NR_mmap2, __NR_lchown32, __NR_getuid32, __NR_getgid32, + __NR_geteuid32, __NR_getegid32, __NR_getgroups32, __NR_fchown32, + __NR_setfsuid32, __NR_setfsgid32, __NR_getresuid32, + __NR_getresgid32 and __NR_chown32. + * syscall.h: Add new definitions of system call number. + 2004-12-08 Hans-Peter Nilsson * configure: Regenerate for ../common/aclocal.m4 update. diff --git a/sim/m32r/syscall.h b/sim/m32r/syscall.h index 7762aca7eab..3f4252a8089 100644 --- a/sim/m32r/syscall.h +++ b/sim/m32r/syscall.h @@ -193,3 +193,89 @@ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 +#define __NR_pread64 180 +#define __NR_pwrite64 181 + +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 +#define __NR_stat64 195 +#define __NR_lstat64 196 +#define __NR_fstat64 197 +#define __NR_lchown32 198 +#define __NR_getuid32 199 +#define __NR_getgid32 200 +#define __NR_geteuid32 201 +#define __NR_getegid32 202 +#define __NR_setreuid32 203 +#define __NR_setregid32 204 +#define __NR_getgroups32 205 +#define __NR_setgroups32 206 +#define __NR_fchown32 207 +#define __NR_setresuid32 208 +#define __NR_getresuid32 209 +#define __NR_setresgid32 210 +#define __NR_getresgid32 211 +#define __NR_chown32 212 +#define __NR_setuid32 213 +#define __NR_setgid32 214 +#define __NR_setfsuid32 215 +#define __NR_setfsgid32 216 +#define __NR_pivot_root 217 +#define __NR_mincore 218 +#define __NR_madvise 219 +#define __NR_madvise1 219 /* delete when C lib stub is removed */ +#define __NR_getdents64 220 +#define __NR_fcntl64 221 +/* 223 is unused */ +#define __NR_gettid 224 +#define __NR_readahead 225 +#define __NR_setxattr 226 +#define __NR_lsetxattr 227 +#define __NR_fsetxattr 228 +#define __NR_getxattr 229 +#define __NR_lgetxattr 230 +#define __NR_fgetxattr 231 +#define __NR_listxattr 232 +#define __NR_llistxattr 233 +#define __NR_flistxattr 234 +#define __NR_removexattr 235 +#define __NR_lremovexattr 236 +#define __NR_fremovexattr 237 +#define __NR_tkill 238 +#define __NR_sendfile64 239 +#define __NR_futex 240 +#define __NR_sched_setaffinity 241 +#define __NR_sched_getaffinity 242 +#define __NR_set_thread_area 243 +#define __NR_get_thread_area 244 +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 +#define __NR_fadvise64 250 + +#define __NR_exit_group 252 +#define __NR_lookup_dcookie 253 +#define __NR_epoll_create 254 +#define __NR_epoll_ctl 255 +#define __NR_epoll_wait 256 +#define __NR_remap_file_pages 257 +#define __NR_set_tid_address 258 +#define __NR_timer_create 259 +#define __NR_timer_settime (__NR_timer_create+1) +#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_getoverrun (__NR_timer_create+3) +#define __NR_timer_delete (__NR_timer_create+4) +#define __NR_clock_settime (__NR_timer_create+5) +#define __NR_clock_gettime (__NR_timer_create+6) +#define __NR_clock_getres (__NR_timer_create+7) +#define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_statfs64 268 +#define __NR_fstatfs64 269 +#define __NR_tgkill 270 +#define __NR_utimes 271 +#define __NR_fadvise64_64 272 +#define __NR_vserver 273 diff --git a/sim/m32r/traps-linux.c b/sim/m32r/traps-linux.c index a6362c1f1d9..f5b67837570 100644 --- a/sim/m32r/traps-linux.c +++ b/sim/m32r/traps-linux.c @@ -384,6 +384,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_lchown32: case __NR_lchown: result = lchown((char *) t2h_addr(cb, &s, arg1), (uid_t) arg2, (gid_t) arg3); @@ -400,6 +401,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_getuid32: case __NR_getuid: result = getuid(); errcode = errno; @@ -483,16 +485,19 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) //result = arg1; break; + case __NR_getgid32: case __NR_getgid: result = getgid(); errcode = errno; break; + case __NR_geteuid32: case __NR_geteuid: result = geteuid(); errcode = errno; break; + case __NR_getegid32: case __NR_getegid: result = getegid(); errcode = errno; @@ -592,6 +597,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } break; + case __NR_getgroups32: case __NR_getgroups: { gid_t *list; @@ -750,6 +756,33 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } break; #endif + case __NR_mmap2: + { + void *addr; + size_t len; + int prot, flags, fildes; + off_t off; + + addr = (void *) t2h_addr(cb, &s, arg1); + len = arg2; + prot = arg3; + flags = arg4; + fildes = arg5; + off = arg6 << 12; + + result = (int) mmap(addr, len, prot, flags, fildes, off); + errcode = errno; + if (result != -1) + { + char c; + if (sim_core_read_buffer (sd, NULL, read_map, &c, result, 1) == 0) + sim_core_attach (sd, NULL, + 0, access_read_write_exec, 0, + result, len, 0, NULL, NULL); + } + } + break; + case __NR_mmap: { void *addr; @@ -813,6 +846,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_fchown32: case __NR_fchown: result = fchown(arg1, arg2, arg3); errcode = errno; @@ -1100,11 +1134,13 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_setfsuid32: case __NR_setfsuid: result = setfsuid(arg1); errcode = errno; break; + case __NR_setfsgid32: case __NR_setfsgid: result = setfsgid(arg1); errcode = errno; @@ -1231,6 +1267,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_getresuid32: case __NR_getresuid: { uid_t ruid, euid, suid; @@ -1261,6 +1298,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) } break; + case __NR_getresgid32: case __NR_getresgid: { uid_t rgid, egid, sgid; @@ -1287,6 +1325,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) errcode = errno; break; + case __NR_chown32: case __NR_chown: result = chown((char *) t2h_addr(cb, &s, arg1), arg2, arg3); errcode = errno; -- 2.30.2