Revision 388bb21a

b/linux-user/elfload.c
287 287

  
288 288
#define elf_check_arch(x) ( (x) == EM_MIPS )
289 289

  
290
#ifdef TARGET_MIPS64
291
#define ELF_CLASS   ELFCLASS64
292
#else
290 293
#define ELF_CLASS   ELFCLASS32
294
#endif
291 295
#ifdef TARGET_WORDS_BIGENDIAN
292 296
#define ELF_DATA	ELFDATA2MSB
293 297
#else
......
302 306
    regs->regs[29] = infop->start_stack;
303 307
}
304 308

  
309
#define USE_ELF_CORE_DUMP
310
#define ELF_EXEC_PAGESIZE        4096
311

  
305 312
#endif /* TARGET_MIPS */
306 313

  
307 314
#ifdef TARGET_SH4
b/linux-user/main.c
1312 1312
	MIPS_SYS(sys_waitid	, 4)
1313 1313
	MIPS_SYS(sys_ni_syscall	, 0)	/* available, was setaltroot */
1314 1314
	MIPS_SYS(sys_add_key	, 5)
1315
	MIPS_SYS(sys_request_key	, 4)
1315
	MIPS_SYS(sys_request_key, 4)
1316 1316
	MIPS_SYS(sys_keyctl	, 5)
1317 1317
	MIPS_SYS(sys_set_thread_area, 1)
1318
	MIPS_SYS(sys_inotify_init, 0)
1319
	MIPS_SYS(sys_inotify_add_watch, 3) /* 4285 */
1320
	MIPS_SYS(sys_inotify_rm_watch, 2)
1321
	MIPS_SYS(sys_migrate_pages, 4)
1322
	MIPS_SYS(sys_openat, 4)
1323
	MIPS_SYS(sys_mkdirat, 3)
1324
	MIPS_SYS(sys_mknodat, 4)	/* 4290 */
1325
	MIPS_SYS(sys_fchownat, 5)
1326
	MIPS_SYS(sys_futimesat, 3)
1327
	MIPS_SYS(sys_fstatat64, 4)
1328
	MIPS_SYS(sys_unlinkat, 3)
1329
	MIPS_SYS(sys_renameat, 4)	/* 4295 */
1330
	MIPS_SYS(sys_linkat, 5)
1331
	MIPS_SYS(sys_symlinkat, 3)
1332
	MIPS_SYS(sys_readlinkat, 4)
1333
	MIPS_SYS(sys_fchmodat, 3)
1334
	MIPS_SYS(sys_faccessat, 3)	/* 4300 */
1335
	MIPS_SYS(sys_pselect6, 6)
1336
	MIPS_SYS(sys_ppoll, 5)
1337
	MIPS_SYS(sys_unshare, 1)
1338
	MIPS_SYS(sys_splice, 4)
1339
	MIPS_SYS(sys_sync_file_range, 7) /* 4305 */
1340
	MIPS_SYS(sys_tee, 4)
1341
	MIPS_SYS(sys_vmsplice, 4)
1342
	MIPS_SYS(sys_move_pages, 6)
1343
	MIPS_SYS(sys_set_robust_list, 2)
1344
	MIPS_SYS(sys_get_robust_list, 3) /* 4310 */
1345
	MIPS_SYS(sys_kexec_load, 4)
1346
	MIPS_SYS(sys_getcpu, 3)
1347
	MIPS_SYS(sys_epoll_pwait, 6)
1348
	MIPS_SYS(sys_ioprio_set, 3)
1349
	MIPS_SYS(sys_ioprio_get, 2)
1318 1350
};
1319 1351

  
1320 1352
#undef MIPS_SYS
......
1322 1354
void cpu_loop(CPUMIPSState *env)
1323 1355
{
1324 1356
    target_siginfo_t info;
1325
    int trapnr, ret, nb_args;
1357
    int trapnr, ret;
1326 1358
    unsigned int syscall_num;
1327
    target_ulong arg5, arg6, sp_reg;
1328 1359

  
1329 1360
    for(;;) {
1330 1361
        trapnr = cpu_mips_exec(env);
1331 1362
        switch(trapnr) {
1332 1363
        case EXCP_SYSCALL:
1333
            {
1334
                syscall_num = env->gpr[2] - 4000;
1335
                env->PC += 4;
1336
                if (syscall_num >= sizeof(mips_syscall_args)) {
1337
                    ret = -ENOSYS;
1338
                } else {
1339
                    nb_args = mips_syscall_args[syscall_num];
1340
                    if (nb_args >= 5) {
1341
                        sp_reg = env->gpr[29];
1342
                        /* these arguments are taken from the stack */
1343
                        arg5 = tgetl(sp_reg + 16);
1344
                        if (nb_args >= 6) {
1345
                            arg6 = tgetl(sp_reg + 20);
1346
                        } else {
1347
                            arg6 = 0;
1348
                        }
1349
                    } else {
1350
                        arg5 = 0;
1351
                        arg6 = 0;
1352
                    }
1353
                    ret = do_syscall(env, 
1354
                                     env->gpr[2], 
1355
                                     env->gpr[4],
1356
                                     env->gpr[5],
1357
                                     env->gpr[6],
1358
                                     env->gpr[7],
1359
                                     arg5, 
1360
                                     arg6);
1361
                }
1362
                if ((unsigned int)ret >= (unsigned int)(-1133)) {
1363
                    env->gpr[7] = 1; /* error flag */
1364
                    ret = -ret;
1365
                    env->gpr[0] = ret;
1366
                    env->gpr[2] = ret;
1367
                } else {
1368
                    env->gpr[7] = 0; /* error flag */
1369
                    env->gpr[2] = ret;
1364
            syscall_num = env->gpr[2] - 4000;
1365
            env->PC += 4;
1366
            if (syscall_num >= sizeof(mips_syscall_args)) {
1367
                ret = -ENOSYS;
1368
            } else {
1369
                int nb_args;
1370
                target_ulong sp_reg;
1371
                target_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
1372

  
1373
                nb_args = mips_syscall_args[syscall_num];
1374
                sp_reg = env->gpr[29];
1375
                switch (nb_args) {
1376
                /* these arguments are taken from the stack */
1377
                case 8: arg8 = tgetl(sp_reg + 28);
1378
                case 7: arg7 = tgetl(sp_reg + 24);
1379
                case 6: arg6 = tgetl(sp_reg + 20);
1380
                case 5: arg5 = tgetl(sp_reg + 16);
1381
                default:
1382
                    break;
1370 1383
                }
1384
                ret = do_syscall(env, env->gpr[2],
1385
                                 env->gpr[4], env->gpr[5],
1386
                                 env->gpr[6], env->gpr[7],
1387
                                 arg5, arg6/*, arg7, arg8*/);
1388
            }
1389
            if ((unsigned int)ret >= (unsigned int)(-1133)) {
1390
                env->gpr[7] = 1; /* error flag */
1391
                ret = -ret;
1392
            } else {
1393
                env->gpr[7] = 0; /* error flag */
1371 1394
            }
1395
            env->gpr[2] = ret;
1372 1396
            break;
1373 1397
        case EXCP_TLBL:
1374 1398
        case EXCP_TLBS:
b/linux-user/mips/syscall_nr.h
2 2
 * Linux o32 style syscalls are in the range from 4000 to 4999.
3 3
 */
4 4
#define TARGET_NR_Linux			4000
5
#define TARGET_NR_syscall			(TARGET_NR_Linux +   0)
5
#define TARGET_NR_syscall		(TARGET_NR_Linux +   0)
6 6
#define TARGET_NR_exit			(TARGET_NR_Linux +   1)
7 7
#define TARGET_NR_fork			(TARGET_NR_Linux +   2)
8 8
#define TARGET_NR_read			(TARGET_NR_Linux +   3)
9 9
#define TARGET_NR_write			(TARGET_NR_Linux +   4)
10 10
#define TARGET_NR_open			(TARGET_NR_Linux +   5)
11 11
#define TARGET_NR_close			(TARGET_NR_Linux +   6)
12
#define TARGET_NR_waitpid			(TARGET_NR_Linux +   7)
12
#define TARGET_NR_waitpid		(TARGET_NR_Linux +   7)
13 13
#define TARGET_NR_creat			(TARGET_NR_Linux +   8)
14 14
#define TARGET_NR_link			(TARGET_NR_Linux +   9)
15
#define TARGET_NR_unlink			(TARGET_NR_Linux +  10)
16
#define TARGET_NR_execve			(TARGET_NR_Linux +  11)
15
#define TARGET_NR_unlink		(TARGET_NR_Linux +  10)
16
#define TARGET_NR_execve		(TARGET_NR_Linux +  11)
17 17
#define TARGET_NR_chdir			(TARGET_NR_Linux +  12)
18 18
#define TARGET_NR_time			(TARGET_NR_Linux +  13)
19 19
#define TARGET_NR_mknod			(TARGET_NR_Linux +  14)
20 20
#define TARGET_NR_chmod			(TARGET_NR_Linux +  15)
21
#define TARGET_NR_lchown32			(TARGET_NR_Linux +  16)
21
#define TARGET_NR_lchown32		(TARGET_NR_Linux +  16)
22 22
#define TARGET_NR_break			(TARGET_NR_Linux +  17)
23
#define TARGET_NR_unused18			(TARGET_NR_Linux +  18)
23
#define TARGET_NR_unused18		(TARGET_NR_Linux +  18)
24 24
#define TARGET_NR_lseek			(TARGET_NR_Linux +  19)
25
#define TARGET_NR_getpid			(TARGET_NR_Linux +  20)
25
#define TARGET_NR_getpid		(TARGET_NR_Linux +  20)
26 26
#define TARGET_NR_mount			(TARGET_NR_Linux +  21)
27
#define TARGET_NR_umount			(TARGET_NR_Linux +  22)
28
#define TARGET_NR_setuid32			(TARGET_NR_Linux +  23)
29
#define TARGET_NR_getuid32			(TARGET_NR_Linux +  24)
27
#define TARGET_NR_umount		(TARGET_NR_Linux +  22)
28
#define TARGET_NR_setuid32		(TARGET_NR_Linux +  23)
29
#define TARGET_NR_getuid32		(TARGET_NR_Linux +  24)
30 30
#define TARGET_NR_stime			(TARGET_NR_Linux +  25)
31
#define TARGET_NR_ptrace			(TARGET_NR_Linux +  26)
31
#define TARGET_NR_ptrace		(TARGET_NR_Linux +  26)
32 32
#define TARGET_NR_alarm			(TARGET_NR_Linux +  27)
33
#define TARGET_NR_unused28			(TARGET_NR_Linux +  28)
33
#define TARGET_NR_unused28		(TARGET_NR_Linux +  28)
34 34
#define TARGET_NR_pause			(TARGET_NR_Linux +  29)
35 35
#define TARGET_NR_utime			(TARGET_NR_Linux +  30)
36 36
#define TARGET_NR_stty			(TARGET_NR_Linux +  31)
37 37
#define TARGET_NR_gtty			(TARGET_NR_Linux +  32)
38
#define TARGET_NR_access			(TARGET_NR_Linux +  33)
38
#define TARGET_NR_access		(TARGET_NR_Linux +  33)
39 39
#define TARGET_NR_nice			(TARGET_NR_Linux +  34)
40 40
#define TARGET_NR_ftime			(TARGET_NR_Linux +  35)
41 41
#define TARGET_NR_sync			(TARGET_NR_Linux +  36)
42 42
#define TARGET_NR_kill			(TARGET_NR_Linux +  37)
43
#define TARGET_NR_rename			(TARGET_NR_Linux +  38)
43
#define TARGET_NR_rename		(TARGET_NR_Linux +  38)
44 44
#define TARGET_NR_mkdir			(TARGET_NR_Linux +  39)
45 45
#define TARGET_NR_rmdir			(TARGET_NR_Linux +  40)
46 46
#define TARGET_NR_dup			(TARGET_NR_Linux +  41)
......
48 48
#define TARGET_NR_times			(TARGET_NR_Linux +  43)
49 49
#define TARGET_NR_prof			(TARGET_NR_Linux +  44)
50 50
#define TARGET_NR_brk			(TARGET_NR_Linux +  45)
51
#define TARGET_NR_setgid32			(TARGET_NR_Linux +  46)
52
#define TARGET_NR_getgid32			(TARGET_NR_Linux +  47)
53
#define TARGET_NR_signal			(TARGET_NR_Linux +  48)
54
#define TARGET_NR_geteuid32			(TARGET_NR_Linux +  49)
55
#define TARGET_NR_getegid32			(TARGET_NR_Linux +  50)
51
#define TARGET_NR_setgid32		(TARGET_NR_Linux +  46)
52
#define TARGET_NR_getgid32		(TARGET_NR_Linux +  47)
53
#define TARGET_NR_signal		(TARGET_NR_Linux +  48)
54
#define TARGET_NR_geteuid32		(TARGET_NR_Linux +  49)
55
#define TARGET_NR_getegid32		(TARGET_NR_Linux +  50)
56 56
#define TARGET_NR_acct			(TARGET_NR_Linux +  51)
57
#define TARGET_NR_umount2			(TARGET_NR_Linux +  52)
57
#define TARGET_NR_umount2		(TARGET_NR_Linux +  52)
58 58
#define TARGET_NR_lock			(TARGET_NR_Linux +  53)
59 59
#define TARGET_NR_ioctl			(TARGET_NR_Linux +  54)
60 60
#define TARGET_NR_fcntl			(TARGET_NR_Linux +  55)
61 61
#define TARGET_NR_mpx			(TARGET_NR_Linux +  56)
62
#define TARGET_NR_setpgid			(TARGET_NR_Linux +  57)
63
#define TARGET_NR_ulimit			(TARGET_NR_Linux +  58)
64
#define TARGET_NR_unused59			(TARGET_NR_Linux +  59)
62
#define TARGET_NR_setpgid		(TARGET_NR_Linux +  57)
63
#define TARGET_NR_ulimit		(TARGET_NR_Linux +  58)
64
#define TARGET_NR_unused59		(TARGET_NR_Linux +  59)
65 65
#define TARGET_NR_umask			(TARGET_NR_Linux +  60)
66
#define TARGET_NR_chroot			(TARGET_NR_Linux +  61)
66
#define TARGET_NR_chroot		(TARGET_NR_Linux +  61)
67 67
#define TARGET_NR_ustat			(TARGET_NR_Linux +  62)
68 68
#define TARGET_NR_dup2			(TARGET_NR_Linux +  63)
69
#define TARGET_NR_getppid			(TARGET_NR_Linux +  64)
70
#define TARGET_NR_getpgrp			(TARGET_NR_Linux +  65)
71
#define TARGET_NR_setsid			(TARGET_NR_Linux +  66)
72
#define TARGET_NR_sigaction			(TARGET_NR_Linux +  67)
73
#define TARGET_NR_sgetmask			(TARGET_NR_Linux +  68)
74
#define TARGET_NR_ssetmask			(TARGET_NR_Linux +  69)
75
#define TARGET_NR_setreuid32			(TARGET_NR_Linux +  70)
76
#define TARGET_NR_setregid32			(TARGET_NR_Linux +  71)
77
#define TARGET_NR_sigsuspend			(TARGET_NR_Linux +  72)
78
#define TARGET_NR_sigpending			(TARGET_NR_Linux +  73)
69
#define TARGET_NR_getppid		(TARGET_NR_Linux +  64)
70
#define TARGET_NR_getpgrp		(TARGET_NR_Linux +  65)
71
#define TARGET_NR_setsid		(TARGET_NR_Linux +  66)
72
#define TARGET_NR_sigaction		(TARGET_NR_Linux +  67)
73
#define TARGET_NR_sgetmask		(TARGET_NR_Linux +  68)
74
#define TARGET_NR_ssetmask		(TARGET_NR_Linux +  69)
75
#define TARGET_NR_setreuid32		(TARGET_NR_Linux +  70)
76
#define TARGET_NR_setregid32		(TARGET_NR_Linux +  71)
77
#define TARGET_NR_sigsuspend		(TARGET_NR_Linux +  72)
78
#define TARGET_NR_sigpending		(TARGET_NR_Linux +  73)
79 79
#define TARGET_NR_sethostname		(TARGET_NR_Linux +  74)
80
#define TARGET_NR_setrlimit			(TARGET_NR_Linux +  75)
81
#define TARGET_NR_getrlimit			(TARGET_NR_Linux +  76)
82
#define TARGET_NR_getrusage			(TARGET_NR_Linux +  77)
80
#define TARGET_NR_setrlimit		(TARGET_NR_Linux +  75)
81
#define TARGET_NR_getrlimit		(TARGET_NR_Linux +  76)
82
#define TARGET_NR_getrusage		(TARGET_NR_Linux +  77)
83 83
#define TARGET_NR_gettimeofday		(TARGET_NR_Linux +  78)
84 84
#define TARGET_NR_settimeofday		(TARGET_NR_Linux +  79)
85
#define TARGET_NR_getgroups32			(TARGET_NR_Linux +  80)
86
#define TARGET_NR_setgroups32			(TARGET_NR_Linux +  81)
87
#define TARGET_NR_reserved82			(TARGET_NR_Linux +  82)
88
#define TARGET_NR_symlink			(TARGET_NR_Linux +  83)
89
#define TARGET_NR_unused84			(TARGET_NR_Linux +  84)
90
#define TARGET_NR_readlink			(TARGET_NR_Linux +  85)
91
#define TARGET_NR_uselib			(TARGET_NR_Linux +  86)
92
#define TARGET_NR_swapon			(TARGET_NR_Linux +  87)
93
#define TARGET_NR_reboot			(TARGET_NR_Linux +  88)
94
#define TARGET_NR_readdir			(TARGET_NR_Linux +  89)
85
#define TARGET_NR_getgroups32		(TARGET_NR_Linux +  80)
86
#define TARGET_NR_setgroups32		(TARGET_NR_Linux +  81)
87
#define TARGET_NR_reserved82		(TARGET_NR_Linux +  82)
88
#define TARGET_NR_symlink		(TARGET_NR_Linux +  83)
89
#define TARGET_NR_unused84		(TARGET_NR_Linux +  84)
90
#define TARGET_NR_readlink		(TARGET_NR_Linux +  85)
91
#define TARGET_NR_uselib		(TARGET_NR_Linux +  86)
92
#define TARGET_NR_swapon		(TARGET_NR_Linux +  87)
93
#define TARGET_NR_reboot		(TARGET_NR_Linux +  88)
94
#define TARGET_NR_readdir		(TARGET_NR_Linux +  89)
95 95
#define TARGET_NR_mmap			(TARGET_NR_Linux +  90)
96
#define TARGET_NR_munmap			(TARGET_NR_Linux +  91)
97
#define TARGET_NR_truncate			(TARGET_NR_Linux +  92)
98
#define TARGET_NR_ftruncate			(TARGET_NR_Linux +  93)
99
#define TARGET_NR_fchmod			(TARGET_NR_Linux +  94)
100
#define TARGET_NR_fchown32			(TARGET_NR_Linux +  95)
96
#define TARGET_NR_munmap		(TARGET_NR_Linux +  91)
97
#define TARGET_NR_truncate		(TARGET_NR_Linux +  92)
98
#define TARGET_NR_ftruncate		(TARGET_NR_Linux +  93)
99
#define TARGET_NR_fchmod		(TARGET_NR_Linux +  94)
100
#define TARGET_NR_fchown32		(TARGET_NR_Linux +  95)
101 101
#define TARGET_NR_getpriority		(TARGET_NR_Linux +  96)
102 102
#define TARGET_NR_setpriority		(TARGET_NR_Linux +  97)
103
#define TARGET_NR_profil			(TARGET_NR_Linux +  98)
104
#define TARGET_NR_statfs			(TARGET_NR_Linux +  99)
105
#define TARGET_NR_fstatfs			(TARGET_NR_Linux + 100)
106
#define TARGET_NR_ioperm			(TARGET_NR_Linux + 101)
107
#define TARGET_NR_socketcall			(TARGET_NR_Linux + 102)
108
#define TARGET_NR_syslog			(TARGET_NR_Linux + 103)
109
#define TARGET_NR_setitimer			(TARGET_NR_Linux + 104)
110
#define TARGET_NR_getitimer			(TARGET_NR_Linux + 105)
103
#define TARGET_NR_profil		(TARGET_NR_Linux +  98)
104
#define TARGET_NR_statfs		(TARGET_NR_Linux +  99)
105
#define TARGET_NR_fstatfs		(TARGET_NR_Linux + 100)
106
#define TARGET_NR_ioperm		(TARGET_NR_Linux + 101)
107
#define TARGET_NR_socketcall		(TARGET_NR_Linux + 102)
108
#define TARGET_NR_syslog		(TARGET_NR_Linux + 103)
109
#define TARGET_NR_setitimer		(TARGET_NR_Linux + 104)
110
#define TARGET_NR_getitimer		(TARGET_NR_Linux + 105)
111 111
#define TARGET_NR_stat			(TARGET_NR_Linux + 106)
112 112
#define TARGET_NR_lstat			(TARGET_NR_Linux + 107)
113 113
#define TARGET_NR_fstat			(TARGET_NR_Linux + 108)
114
#define TARGET_NR_unused109			(TARGET_NR_Linux + 109)
114
#define TARGET_NR_unused109		(TARGET_NR_Linux + 109)
115 115
#define TARGET_NR_iopl			(TARGET_NR_Linux + 110)
116
#define TARGET_NR_vhangup			(TARGET_NR_Linux + 111)
116
#define TARGET_NR_vhangup		(TARGET_NR_Linux + 111)
117 117
#define TARGET_NR_idle			(TARGET_NR_Linux + 112)
118 118
#define TARGET_NR_vm86			(TARGET_NR_Linux + 113)
119 119
#define TARGET_NR_wait4			(TARGET_NR_Linux + 114)
120
#define TARGET_NR_swapoff			(TARGET_NR_Linux + 115)
121
#define TARGET_NR_sysinfo			(TARGET_NR_Linux + 116)
120
#define TARGET_NR_swapoff		(TARGET_NR_Linux + 115)
121
#define TARGET_NR_sysinfo		(TARGET_NR_Linux + 116)
122 122
#define TARGET_NR_ipc			(TARGET_NR_Linux + 117)
123 123
#define TARGET_NR_fsync			(TARGET_NR_Linux + 118)
124
#define TARGET_NR_sigreturn			(TARGET_NR_Linux + 119)
124
#define TARGET_NR_sigreturn		(TARGET_NR_Linux + 119)
125 125
#define TARGET_NR_clone			(TARGET_NR_Linux + 120)
126 126
#define TARGET_NR_setdomainname		(TARGET_NR_Linux + 121)
127 127
#define TARGET_NR_uname			(TARGET_NR_Linux + 122)
128
#define TARGET_NR_modify_ldt			(TARGET_NR_Linux + 123)
129
#define TARGET_NR_adjtimex			(TARGET_NR_Linux + 124)
130
#define TARGET_NR_mprotect			(TARGET_NR_Linux + 125)
128
#define TARGET_NR_modify_ldt		(TARGET_NR_Linux + 123)
129
#define TARGET_NR_adjtimex		(TARGET_NR_Linux + 124)
130
#define TARGET_NR_mprotect		(TARGET_NR_Linux + 125)
131 131
#define TARGET_NR_sigprocmask		(TARGET_NR_Linux + 126)
132 132
#define TARGET_NR_create_module		(TARGET_NR_Linux + 127)
133 133
#define TARGET_NR_init_module		(TARGET_NR_Linux + 128)
134 134
#define TARGET_NR_delete_module		(TARGET_NR_Linux + 129)
135
#define TARGET_NR_get_kernel_syms		(TARGET_NR_Linux + 130)
136
#define TARGET_NR_quotactl			(TARGET_NR_Linux + 131)
137
#define TARGET_NR_getpgid			(TARGET_NR_Linux + 132)
138
#define TARGET_NR_fchdir			(TARGET_NR_Linux + 133)
139
#define TARGET_NR_bdflush			(TARGET_NR_Linux + 134)
135
#define TARGET_NR_get_kernel_syms	(TARGET_NR_Linux + 130)
136
#define TARGET_NR_quotactl		(TARGET_NR_Linux + 131)
137
#define TARGET_NR_getpgid		(TARGET_NR_Linux + 132)
138
#define TARGET_NR_fchdir		(TARGET_NR_Linux + 133)
139
#define TARGET_NR_bdflush		(TARGET_NR_Linux + 134)
140 140
#define TARGET_NR_sysfs			(TARGET_NR_Linux + 135)
141 141
#define TARGET_NR_personality		(TARGET_NR_Linux + 136)
142 142
#define TARGET_NR_afs_syscall		(TARGET_NR_Linux + 137) /* Syscall for Andrew File System */
143
#define TARGET_NR_setfsuid32			(TARGET_NR_Linux + 138)
144
#define TARGET_NR_setfsgid32			(TARGET_NR_Linux + 139)
145
#define TARGET_NR__llseek			(TARGET_NR_Linux + 140)
146
#define TARGET_NR_getdents			(TARGET_NR_Linux + 141)
147
#define TARGET_NR__newselect			(TARGET_NR_Linux + 142)
143
#define TARGET_NR_setfsuid32		(TARGET_NR_Linux + 138)
144
#define TARGET_NR_setfsgid32		(TARGET_NR_Linux + 139)
145
#define TARGET_NR__llseek		(TARGET_NR_Linux + 140)
146
#define TARGET_NR_getdents		(TARGET_NR_Linux + 141)
147
#define TARGET_NR__newselect		(TARGET_NR_Linux + 142)
148 148
#define TARGET_NR_flock			(TARGET_NR_Linux + 143)
149 149
#define TARGET_NR_msync			(TARGET_NR_Linux + 144)
150 150
#define TARGET_NR_readv			(TARGET_NR_Linux + 145)
151
#define TARGET_NR_writev			(TARGET_NR_Linux + 146)
152
#define TARGET_NR_cacheflush			(TARGET_NR_Linux + 147)
153
#define TARGET_NR_cachectl			(TARGET_NR_Linux + 148)
154
#define TARGET_NR_sysmips			(TARGET_NR_Linux + 149)
155
#define TARGET_NR_unused150			(TARGET_NR_Linux + 150)
156
#define TARGET_NR_getsid			(TARGET_NR_Linux + 151)
157
#define TARGET_NR_fdatasync			(TARGET_NR_Linux + 152)
158
#define TARGET_NR__sysctl			(TARGET_NR_Linux + 153)
151
#define TARGET_NR_writev		(TARGET_NR_Linux + 146)
152
#define TARGET_NR_cacheflush		(TARGET_NR_Linux + 147)
153
#define TARGET_NR_cachectl		(TARGET_NR_Linux + 148)
154
#define TARGET_NR_sysmips		(TARGET_NR_Linux + 149)
155
#define TARGET_NR_unused150		(TARGET_NR_Linux + 150)
156
#define TARGET_NR_getsid		(TARGET_NR_Linux + 151)
157
#define TARGET_NR_fdatasync		(TARGET_NR_Linux + 152)
158
#define TARGET_NR__sysctl		(TARGET_NR_Linux + 153)
159 159
#define TARGET_NR_mlock			(TARGET_NR_Linux + 154)
160
#define TARGET_NR_munlock			(TARGET_NR_Linux + 155)
161
#define TARGET_NR_mlockall			(TARGET_NR_Linux + 156)
162
#define TARGET_NR_munlockall			(TARGET_NR_Linux + 157)
163
#define TARGET_NR_sched_setparam		(TARGET_NR_Linux + 158)
164
#define TARGET_NR_sched_getparam		(TARGET_NR_Linux + 159)
165
#define TARGET_NR_sched_setscheduler		(TARGET_NR_Linux + 160)
166
#define TARGET_NR_sched_getscheduler		(TARGET_NR_Linux + 161)
160
#define TARGET_NR_munlock		(TARGET_NR_Linux + 155)
161
#define TARGET_NR_mlockall		(TARGET_NR_Linux + 156)
162
#define TARGET_NR_munlockall		(TARGET_NR_Linux + 157)
163
#define TARGET_NR_sched_setparam	(TARGET_NR_Linux + 158)
164
#define TARGET_NR_sched_getparam	(TARGET_NR_Linux + 159)
165
#define TARGET_NR_sched_setscheduler	(TARGET_NR_Linux + 160)
166
#define TARGET_NR_sched_getscheduler	(TARGET_NR_Linux + 161)
167 167
#define TARGET_NR_sched_yield		(TARGET_NR_Linux + 162)
168 168
#define TARGET_NR_sched_get_priority_max	(TARGET_NR_Linux + 163)
169 169
#define TARGET_NR_sched_get_priority_min	(TARGET_NR_Linux + 164)
170 170
#define TARGET_NR_sched_rr_get_interval	(TARGET_NR_Linux + 165)
171
#define TARGET_NR_nanosleep			(TARGET_NR_Linux + 166)
172
#define TARGET_NR_mremap			(TARGET_NR_Linux + 167)
173
#define TARGET_NR_accept			(TARGET_NR_Linux + 168)
171
#define TARGET_NR_nanosleep		(TARGET_NR_Linux + 166)
172
#define TARGET_NR_mremap		(TARGET_NR_Linux + 167)
173
#define TARGET_NR_accept		(TARGET_NR_Linux + 168)
174 174
#define TARGET_NR_bind			(TARGET_NR_Linux + 169)
175
#define TARGET_NR_connect			(TARGET_NR_Linux + 170)
175
#define TARGET_NR_connect		(TARGET_NR_Linux + 170)
176 176
#define TARGET_NR_getpeername		(TARGET_NR_Linux + 171)
177 177
#define TARGET_NR_getsockname		(TARGET_NR_Linux + 172)
178
#define TARGET_NR_getsockopt			(TARGET_NR_Linux + 173)
179
#define TARGET_NR_listen			(TARGET_NR_Linux + 174)
178
#define TARGET_NR_getsockopt		(TARGET_NR_Linux + 173)
179
#define TARGET_NR_listen		(TARGET_NR_Linux + 174)
180 180
#define TARGET_NR_recv			(TARGET_NR_Linux + 175)
181
#define TARGET_NR_recvfrom			(TARGET_NR_Linux + 176)
182
#define TARGET_NR_recvmsg			(TARGET_NR_Linux + 177)
181
#define TARGET_NR_recvfrom		(TARGET_NR_Linux + 176)
182
#define TARGET_NR_recvmsg		(TARGET_NR_Linux + 177)
183 183
#define TARGET_NR_send			(TARGET_NR_Linux + 178)
184
#define TARGET_NR_sendmsg			(TARGET_NR_Linux + 179)
185
#define TARGET_NR_sendto			(TARGET_NR_Linux + 180)
186
#define TARGET_NR_setsockopt			(TARGET_NR_Linux + 181)
187
#define TARGET_NR_shutdown			(TARGET_NR_Linux + 182)
188
#define TARGET_NR_socket			(TARGET_NR_Linux + 183)
189
#define TARGET_NR_socketpair			(TARGET_NR_Linux + 184)
190
#define TARGET_NR_setresuid32			(TARGET_NR_Linux + 185)
191
#define TARGET_NR_getresuid32			(TARGET_NR_Linux + 186)
184
#define TARGET_NR_sendmsg		(TARGET_NR_Linux + 179)
185
#define TARGET_NR_sendto		(TARGET_NR_Linux + 180)
186
#define TARGET_NR_setsockopt		(TARGET_NR_Linux + 181)
187
#define TARGET_NR_shutdown		(TARGET_NR_Linux + 182)
188
#define TARGET_NR_socket		(TARGET_NR_Linux + 183)
189
#define TARGET_NR_socketpair		(TARGET_NR_Linux + 184)
190
#define TARGET_NR_setresuid32		(TARGET_NR_Linux + 185)
191
#define TARGET_NR_getresuid32		(TARGET_NR_Linux + 186)
192 192
#define TARGET_NR_query_module		(TARGET_NR_Linux + 187)
193 193
#define TARGET_NR_poll			(TARGET_NR_Linux + 188)
194
#define TARGET_NR_nfsservctl			(TARGET_NR_Linux + 189)
195
#define TARGET_NR_setresgid32			(TARGET_NR_Linux + 190)
196
#define TARGET_NR_getresgid32			(TARGET_NR_Linux + 191)
194
#define TARGET_NR_nfsservctl		(TARGET_NR_Linux + 189)
195
#define TARGET_NR_setresgid32		(TARGET_NR_Linux + 190)
196
#define TARGET_NR_getresgid32		(TARGET_NR_Linux + 191)
197 197
#define TARGET_NR_prctl			(TARGET_NR_Linux + 192)
198 198
#define TARGET_NR_rt_sigreturn		(TARGET_NR_Linux + 193)
199 199
#define TARGET_NR_rt_sigaction		(TARGET_NR_Linux + 194)
200
#define TARGET_NR_rt_sigprocmask		(TARGET_NR_Linux + 195)
200
#define TARGET_NR_rt_sigprocmask	(TARGET_NR_Linux + 195)
201 201
#define TARGET_NR_rt_sigpending		(TARGET_NR_Linux + 196)
202
#define TARGET_NR_rt_sigtimedwait		(TARGET_NR_Linux + 197)
203
#define TARGET_NR_rt_sigqueueinfo		(TARGET_NR_Linux + 198)
202
#define TARGET_NR_rt_sigtimedwait	(TARGET_NR_Linux + 197)
203
#define TARGET_NR_rt_sigqueueinfo	(TARGET_NR_Linux + 198)
204 204
#define TARGET_NR_rt_sigsuspend		(TARGET_NR_Linux + 199)
205
#define TARGET_NR_pread64			(TARGET_NR_Linux + 200)
206
#define TARGET_NR_pwrite64			(TARGET_NR_Linux + 201)
207
#define TARGET_NR_chown32			(TARGET_NR_Linux + 202)
208
#define TARGET_NR_getcwd			(TARGET_NR_Linux + 203)
209
#define TARGET_NR_capget			(TARGET_NR_Linux + 204)
210
#define TARGET_NR_capset			(TARGET_NR_Linux + 205)
205
#define TARGET_NR_pread64		(TARGET_NR_Linux + 200)
206
#define TARGET_NR_pwrite64		(TARGET_NR_Linux + 201)
207
#define TARGET_NR_chown32		(TARGET_NR_Linux + 202)
208
#define TARGET_NR_getcwd		(TARGET_NR_Linux + 203)
209
#define TARGET_NR_capget		(TARGET_NR_Linux + 204)
210
#define TARGET_NR_capset		(TARGET_NR_Linux + 205)
211 211
#define TARGET_NR_sigaltstack		(TARGET_NR_Linux + 206)
212
#define TARGET_NR_sendfile			(TARGET_NR_Linux + 207)
213
#define TARGET_NR_getpmsg			(TARGET_NR_Linux + 208)
214
#define TARGET_NR_putpmsg			(TARGET_NR_Linux + 209)
212
#define TARGET_NR_sendfile		(TARGET_NR_Linux + 207)
213
#define TARGET_NR_getpmsg		(TARGET_NR_Linux + 208)
214
#define TARGET_NR_putpmsg		(TARGET_NR_Linux + 209)
215 215
#define TARGET_NR_mmap2			(TARGET_NR_Linux + 210)
216
#define TARGET_NR_truncate64			(TARGET_NR_Linux + 211)
216
#define TARGET_NR_truncate64		(TARGET_NR_Linux + 211)
217 217
#define TARGET_NR_ftruncate64		(TARGET_NR_Linux + 212)
218
#define TARGET_NR_stat64			(TARGET_NR_Linux + 213)
219
#define TARGET_NR_lstat64			(TARGET_NR_Linux + 214)
220
#define TARGET_NR_fstat64			(TARGET_NR_Linux + 215)
221
#define TARGET_NR_pivot_root			(TARGET_NR_Linux + 216)
222
#define TARGET_NR_mincore			(TARGET_NR_Linux + 217)
223
#define TARGET_NR_madvise			(TARGET_NR_Linux + 218)
224
#define TARGET_NR_getdents64			(TARGET_NR_Linux + 219)
225
#define TARGET_NR_fcntl64			(TARGET_NR_Linux + 220)
218
#define TARGET_NR_stat64		(TARGET_NR_Linux + 213)
219
#define TARGET_NR_lstat64		(TARGET_NR_Linux + 214)
220
#define TARGET_NR_fstat64		(TARGET_NR_Linux + 215)
221
#define TARGET_NR_pivot_root		(TARGET_NR_Linux + 216)
222
#define TARGET_NR_mincore		(TARGET_NR_Linux + 217)
223
#define TARGET_NR_madvise		(TARGET_NR_Linux + 218)
224
#define TARGET_NR_getdents64		(TARGET_NR_Linux + 219)
225
#define TARGET_NR_fcntl64		(TARGET_NR_Linux + 220)
226 226
#define TARGET_NR_reserved221		(TARGET_NR_Linux + 221)
227
#define TARGET_NR_gettid			(TARGET_NR_Linux + 222)
228
#define TARGET_NR_readahead			(TARGET_NR_Linux + 223)
229
#define TARGET_NR_setxattr			(TARGET_NR_Linux + 224)
230
#define TARGET_NR_lsetxattr			(TARGET_NR_Linux + 225)
231
#define TARGET_NR_fsetxattr			(TARGET_NR_Linux + 226)
232
#define TARGET_NR_getxattr			(TARGET_NR_Linux + 227)
233
#define TARGET_NR_lgetxattr			(TARGET_NR_Linux + 228)
234
#define TARGET_NR_fgetxattr			(TARGET_NR_Linux + 229)
235
#define TARGET_NR_listxattr			(TARGET_NR_Linux + 230)
236
#define TARGET_NR_llistxattr			(TARGET_NR_Linux + 231)
237
#define TARGET_NR_flistxattr			(TARGET_NR_Linux + 232)
227
#define TARGET_NR_gettid		(TARGET_NR_Linux + 222)
228
#define TARGET_NR_readahead		(TARGET_NR_Linux + 223)
229
#define TARGET_NR_setxattr		(TARGET_NR_Linux + 224)
230
#define TARGET_NR_lsetxattr		(TARGET_NR_Linux + 225)
231
#define TARGET_NR_fsetxattr		(TARGET_NR_Linux + 226)
232
#define TARGET_NR_getxattr		(TARGET_NR_Linux + 227)
233
#define TARGET_NR_lgetxattr		(TARGET_NR_Linux + 228)
234
#define TARGET_NR_fgetxattr		(TARGET_NR_Linux + 229)
235
#define TARGET_NR_listxattr		(TARGET_NR_Linux + 230)
236
#define TARGET_NR_llistxattr		(TARGET_NR_Linux + 231)
237
#define TARGET_NR_flistxattr		(TARGET_NR_Linux + 232)
238 238
#define TARGET_NR_removexattr		(TARGET_NR_Linux + 233)
239 239
#define TARGET_NR_lremovexattr		(TARGET_NR_Linux + 234)
240 240
#define TARGET_NR_fremovexattr		(TARGET_NR_Linux + 235)
241 241
#define TARGET_NR_tkill			(TARGET_NR_Linux + 236)
242
#define TARGET_NR_sendfile64			(TARGET_NR_Linux + 237)
242
#define TARGET_NR_sendfile64		(TARGET_NR_Linux + 237)
243 243
#define TARGET_NR_futex			(TARGET_NR_Linux + 238)
244
#define TARGET_NR_sched_setaffinity		(TARGET_NR_Linux + 239)
245
#define TARGET_NR_sched_getaffinity		(TARGET_NR_Linux + 240)
246
#define TARGET_NR_io_setup			(TARGET_NR_Linux + 241)
247
#define TARGET_NR_io_destroy			(TARGET_NR_Linux + 242)
244
#define TARGET_NR_sched_setaffinity	(TARGET_NR_Linux + 239)
245
#define TARGET_NR_sched_getaffinity	(TARGET_NR_Linux + 240)
246
#define TARGET_NR_io_setup		(TARGET_NR_Linux + 241)
247
#define TARGET_NR_io_destroy		(TARGET_NR_Linux + 242)
248 248
#define TARGET_NR_io_getevents		(TARGET_NR_Linux + 243)
249
#define TARGET_NR_io_submit			(TARGET_NR_Linux + 244)
250
#define TARGET_NR_io_cancel			(TARGET_NR_Linux + 245)
251
#define TARGET_NR_exit_group			(TARGET_NR_Linux + 246)
252
#define TARGET_NR_lookup_dcookie		(TARGET_NR_Linux + 247)
249
#define TARGET_NR_io_submit		(TARGET_NR_Linux + 244)
250
#define TARGET_NR_io_cancel		(TARGET_NR_Linux + 245)
251
#define TARGET_NR_exit_group		(TARGET_NR_Linux + 246)
252
#define TARGET_NR_lookup_dcookie	(TARGET_NR_Linux + 247)
253 253
#define TARGET_NR_epoll_create		(TARGET_NR_Linux + 248)
254
#define TARGET_NR_epoll_ctl			(TARGET_NR_Linux + 249)
255
#define TARGET_NR_epoll_wait			(TARGET_NR_Linux + 250)
256
#define TARGET_NR_remap_file_pages		(TARGET_NR_Linux + 251)
257
#define TARGET_NR_set_tid_address		(TARGET_NR_Linux + 252)
258
#define TARGET_NR_restart_syscall		(TARGET_NR_Linux + 253)
259
#define TARGET_NR_fadvise64			(TARGET_NR_Linux + 254)
260
#define TARGET_NR_statfs64			(TARGET_NR_Linux + 255)
261
#define TARGET_NR_fstatfs64			(TARGET_NR_Linux + 256)
254
#define TARGET_NR_epoll_ctl		(TARGET_NR_Linux + 249)
255
#define TARGET_NR_epoll_wait		(TARGET_NR_Linux + 250)
256
#define TARGET_NR_remap_file_pages	(TARGET_NR_Linux + 251)
257
#define TARGET_NR_set_tid_address	(TARGET_NR_Linux + 252)
258
#define TARGET_NR_restart_syscall	(TARGET_NR_Linux + 253)
259
#define TARGET_NR_fadvise64		(TARGET_NR_Linux + 254)
260
#define TARGET_NR_statfs64		(TARGET_NR_Linux + 255)
261
#define TARGET_NR_fstatfs64		(TARGET_NR_Linux + 256)
262 262
#define TARGET_NR_timer_create		(TARGET_NR_Linux + 257)
263 263
#define TARGET_NR_timer_settime		(TARGET_NR_Linux + 258)
264 264
#define TARGET_NR_timer_gettime		(TARGET_NR_Linux + 259)
265
#define TARGET_NR_timer_getoverrun		(TARGET_NR_Linux + 260)
265
#define TARGET_NR_timer_getoverrun	(TARGET_NR_Linux + 260)
266 266
#define TARGET_NR_timer_delete		(TARGET_NR_Linux + 261)
267 267
#define TARGET_NR_clock_settime		(TARGET_NR_Linux + 262)
268 268
#define TARGET_NR_clock_gettime		(TARGET_NR_Linux + 263)
269 269
#define TARGET_NR_clock_getres		(TARGET_NR_Linux + 264)
270
#define TARGET_NR_clock_nanosleep		(TARGET_NR_Linux + 265)
271
#define TARGET_NR_tgkill			(TARGET_NR_Linux + 266)
272
#define TARGET_NR_utimes			(TARGET_NR_Linux + 267)
270
#define TARGET_NR_clock_nanosleep	(TARGET_NR_Linux + 265)
271
#define TARGET_NR_tgkill		(TARGET_NR_Linux + 266)
272
#define TARGET_NR_utimes		(TARGET_NR_Linux + 267)
273 273
#define TARGET_NR_mbind			(TARGET_NR_Linux + 268)
274 274
#define TARGET_NR_get_mempolicy		(TARGET_NR_Linux + 269)
275 275
#define TARGET_NR_set_mempolicy		(TARGET_NR_Linux + 270)
276
#define TARGET_NR_mq_open			(TARGET_NR_Linux + 271)
277
#define TARGET_NR_mq_unlink			(TARGET_NR_Linux + 272)
276
#define TARGET_NR_mq_open		(TARGET_NR_Linux + 271)
277
#define TARGET_NR_mq_unlink		(TARGET_NR_Linux + 272)
278 278
#define TARGET_NR_mq_timedsend		(TARGET_NR_Linux + 273)
279
#define TARGET_NR_mq_timedreceive		(TARGET_NR_Linux + 274)
280
#define TARGET_NR_mq_notify			(TARGET_NR_Linux + 275)
279
#define TARGET_NR_mq_timedreceive	(TARGET_NR_Linux + 274)
280
#define TARGET_NR_mq_notify		(TARGET_NR_Linux + 275)
281 281
#define TARGET_NR_mq_getsetattr		(TARGET_NR_Linux + 276)
282
#define TARGET_NR_vserver			(TARGET_NR_Linux + 277)
283
#define TARGET_NR_waitid			(TARGET_NR_Linux + 278)
284
/* #define TARGET_NR_sys_setaltroot		(TARGET_NR_Linux + 279) */
285
#define TARGET_NR_add_key			(TARGET_NR_Linux + 280)
282
#define TARGET_NR_vserver		(TARGET_NR_Linux + 277)
283
#define TARGET_NR_waitid		(TARGET_NR_Linux + 278)
284
/* #define TARGET_NR_sys_setaltroot	(TARGET_NR_Linux + 279) */
285
#define TARGET_NR_add_key		(TARGET_NR_Linux + 280)
286 286
#define TARGET_NR_request_key		(TARGET_NR_Linux + 281)
287
#define TARGET_NR_keyctl			(TARGET_NR_Linux + 282)
287
#define TARGET_NR_keyctl		(TARGET_NR_Linux + 282)
288 288
#define TARGET_NR_set_thread_area	(TARGET_NR_Linux + 283)
289
#define TARGET_NR_inotify_init		(TARGET_NR_Linux + 284)
290
#define TARGET_NR_inotify_add_watch	(TARGET_NR_Linux + 285)
291
#define TARGET_NR_inotify_rm_watch	(TARGET_NR_Linux + 286)
292
#define TARGET_NR_migrate_pages		(TARGET_NR_Linux + 287)
293
#define TARGET_NR_openat		(TARGET_NR_Linux + 288)
294
#define TARGET_NR_mkdirat		(TARGET_NR_Linux + 289)
295
#define TARGET_NR_mknodat		(TARGET_NR_Linux + 290)
296
#define TARGET_NR_fchownat		(TARGET_NR_Linux + 291)
297
#define TARGET_NR_futimesat		(TARGET_NR_Linux + 292)
298
#define TARGET_NR_fstatat64		(TARGET_NR_Linux + 293)
299
#define TARGET_NR_unlinkat		(TARGET_NR_Linux + 294)
300
#define TARGET_NR_renameat		(TARGET_NR_Linux + 295)
301
#define TARGET_NR_linkat		(TARGET_NR_Linux + 296)
302
#define TARGET_NR_symlinkat		(TARGET_NR_Linux + 297)
303
#define TARGET_NR_readlinkat		(TARGET_NR_Linux + 298)
304
#define TARGET_NR_fchmodat		(TARGET_NR_Linux + 299)
305
#define TARGET_NR_faccessat		(TARGET_NR_Linux + 300)
306
#define TARGET_NR_pselect6		(TARGET_NR_Linux + 301)
307
#define TARGET_NR_ppoll			(TARGET_NR_Linux + 302)
308
#define TARGET_NR_unshare		(TARGET_NR_Linux + 303)
309
#define TARGET_NR_splice		(TARGET_NR_Linux + 304)
310
#define TARGET_NR_sync_file_range	(TARGET_NR_Linux + 305)
311
#define TARGET_NR_tee			(TARGET_NR_Linux + 306)
312
#define TARGET_NR_vmsplice		(TARGET_NR_Linux + 307)
313
#define TARGET_NR_move_pages		(TARGET_NR_Linux + 308)
314
#define TARGET_NR_set_robust_list	(TARGET_NR_Linux + 309)
315
#define TARGET_NR_get_robust_list	(TARGET_NR_Linux + 310)
316
#define TARGET_NR_kexec_load		(TARGET_NR_Linux + 311)
317
#define TARGET_NR_getcpu		(TARGET_NR_Linux + 312)
318
#define TARGET_NR_epoll_pwait		(TARGET_NR_Linux + 313)
319
#define TARGET_NR_ioprio_set		(TARGET_NR_Linux + 314)
320
#define TARGET_NR_ioprio_get		(TARGET_NR_Linux + 315)
b/linux-user/signal.c
432 432
    if (oact) {
433 433
        oact->_sa_handler = tswapl(k->sa._sa_handler);
434 434
        oact->sa_flags = tswapl(k->sa.sa_flags);
435
	#if !defined(TARGET_MIPS)
436
        	oact->sa_restorer = tswapl(k->sa.sa_restorer);
437
	#endif
435
#if !defined(TARGET_MIPS)
436
        oact->sa_restorer = tswapl(k->sa.sa_restorer);
437
#endif
438 438
        oact->sa_mask = k->sa.sa_mask;
439 439
    }
440 440
    if (act) {
441 441
        k->sa._sa_handler = tswapl(act->_sa_handler);
442 442
        k->sa.sa_flags = tswapl(act->sa_flags);
443
	#if !defined(TARGET_MIPS)
444
        	k->sa.sa_restorer = tswapl(act->sa_restorer);
445
	#endif
443
#if !defined(TARGET_MIPS)
444
        k->sa.sa_restorer = tswapl(act->sa_restorer);
445
#endif
446 446
        k->sa.sa_mask = act->sa_mask;
447 447

  
448 448
        /* we update the host linux signal state */
......
1684 1684

  
1685 1685
    err |= __put_user(regs->PC, &sc->sc_pc);
1686 1686

  
1687
    #define save_gp_reg(i) do {   					\
1688
        err |= __put_user(regs->gpr[i], &sc->sc_regs[i]);		\
1687
#define save_gp_reg(i) do {   					\
1688
        err |= __put_user(regs->gpr[i], &sc->sc_regs[i]);	\
1689 1689
    } while(0)
1690 1690
    __put_user(0, &sc->sc_regs[0]); save_gp_reg(1); save_gp_reg(2);
1691 1691
    save_gp_reg(3); save_gp_reg(4); save_gp_reg(5); save_gp_reg(6);
......
1696 1696
    save_gp_reg(23); save_gp_reg(24); save_gp_reg(25); save_gp_reg(26);
1697 1697
    save_gp_reg(27); save_gp_reg(28); save_gp_reg(29); save_gp_reg(30);
1698 1698
    save_gp_reg(31);
1699
    #undef save_gp_reg
1699
#undef save_gp_reg
1700 1700

  
1701 1701
    err |= __put_user(regs->HI, &sc->sc_mdhi);
1702 1702
    err |= __put_user(regs->LO, &sc->sc_mdlo);
......
1713 1713
	err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
1714 1714
    }
1715 1715
    /* same with 64 bit */
1716
    #ifdef CONFIG_64BIT
1716
#ifdef CONFIG_64BIT
1717 1717
    err |= __put_user(regs->hi, &sc->sc_hi[0]);
1718 1718
    err |= __put_user(regs->lo, &sc->sc_lo[0]);
1719 1719
    if (cpu_has_dsp) {
......
1725 1725
	err |= __put_user(mflo3(), &sc->sc_lo[3]);
1726 1726
	err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
1727 1727
    }
1728
    #endif
1729

  
1730

  
1731
    #endif
1732

  
1728
#endif
1729
#endif
1733 1730

  
1734
    #if 0
1731
#if 0
1735 1732
    err |= __put_user(!!used_math(), &sc->sc_used_math);
1736 1733

  
1737 1734
    if (!used_math())
......
1765 1762
    err |= __get_user(regs->HI, &sc->sc_mdhi);
1766 1763
    err |= __get_user(regs->LO, &sc->sc_mdlo);
1767 1764

  
1768
    #define restore_gp_reg(i) do {   					\
1765
#define restore_gp_reg(i) do {   					\
1769 1766
        err |= __get_user(regs->gpr[i], &sc->sc_regs[i]);		\
1770 1767
    } while(0)
1771 1768
    restore_gp_reg( 1); restore_gp_reg( 2); restore_gp_reg( 3);
......
1779 1776
    restore_gp_reg(25); restore_gp_reg(26); restore_gp_reg(27);
1780 1777
    restore_gp_reg(28); restore_gp_reg(29); restore_gp_reg(30);
1781 1778
    restore_gp_reg(31);
1782
    #undef restore_gp_reg
1779
#undef restore_gp_reg
1783 1780

  
1784 1781
#if 0
1785 1782
    if (cpu_has_dsp) {
......
1791 1788
	err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg);
1792 1789
	err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
1793 1790
    }
1794
    #ifdef CONFIG_64BIT
1791
#ifdef CONFIG_64BIT
1795 1792
    err |= __get_user(regs->hi, &sc->sc_hi[0]);
1796 1793
    err |= __get_user(regs->lo, &sc->sc_lo[0]);
1797 1794
    if (cpu_has_dsp) {
......
1803 1800
	err |= __get_user(treg, &sc->sc_lo[3]); mthi3(treg);
1804 1801
	err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
1805 1802
    }
1806
    #endif
1803
#endif
1807 1804

  
1808 1805
    err |= __get_user(used_math, &sc->sc_used_math);
1809 1806
    conditional_used_math(used_math);
......
1898 1895

  
1899 1896
long do_sigreturn(CPUState *regs)
1900 1897
{
1901
   struct sigframe *frame;
1902
   sigset_t blocked;
1903
   target_sigset_t target_set;
1904
   int i;
1898
    struct sigframe *frame;
1899
    sigset_t blocked;
1900
    target_sigset_t target_set;
1901
    int i;
1905 1902

  
1906 1903
#if defined(DEBUG_SIGNAL)
1907
   fprintf(stderr, "do_sigreturn\n");
1904
    fprintf(stderr, "do_sigreturn\n");
1908 1905
#endif
1909
   frame = (struct sigframe *) regs->gpr[29];
1910
   if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
1906
    frame = (struct sigframe *) regs->gpr[29];
1907
    if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
1911 1908
   	goto badframe;
1912 1909

  
1913
   for(i = 0; i < TARGET_NSIG_WORDS; i++) {
1910
    for(i = 0; i < TARGET_NSIG_WORDS; i++) {
1914 1911
   	if(__get_user(target_set.sig[i], &frame->sf_mask.sig[i]))
1915 1912
	    goto badframe;
1916
   }		
1913
    }
1917 1914

  
1918
   target_to_host_sigset_internal(&blocked, &target_set);
1919
   sigprocmask(SIG_SETMASK, &blocked, NULL);
1915
    target_to_host_sigset_internal(&blocked, &target_set);
1916
    sigprocmask(SIG_SETMASK, &blocked, NULL);
1920 1917

  
1921
   if (restore_sigcontext(regs, &frame->sf_sc))
1918
    if (restore_sigcontext(regs, &frame->sf_sc))
1922 1919
   	goto badframe;
1923 1920

  
1924 1921
#if 0
1925
   /*
1926
    * Don't let your children do this ...
1927
    */
1928
   __asm__ __volatile__(
1922
    /*
1923
     * Don't let your children do this ...
1924
     */
1925
    __asm__ __volatile__(
1929 1926
   	"move\t$29, %0\n\t"
1930 1927
   	"j\tsyscall_exit"
1931 1928
   	:/* no outputs */
1932 1929
   	:"r" (&regs));
1933
   /* Unreached */
1930
    /* Unreached */
1934 1931
#endif
1935 1932
    
1936 1933
    regs->PC = regs->CP0_EPC;
1937
   /* I am not sure this is right, but it seems to work
1934
    /* I am not sure this is right, but it seems to work
1938 1935
    * maybe a problem with nested signals ? */
1939 1936
    regs->CP0_EPC = 0;
1940 1937
    return 0;
1941 1938

  
1942 1939
badframe:
1943
   force_sig(TARGET_SIGSEGV/*, current*/);
1944
   return 0;	
1945

  
1940
    force_sig(TARGET_SIGSEGV/*, current*/);
1941
    return 0;
1946 1942
}
1947 1943

  
1948 1944
static void setup_rt_frame(int sig, struct emulated_sigaction *ka, 
......
2070 2066
    if (q != &k->info)
2071 2067
        free_sigqueue(q);
2072 2068
}
2073

  
2074

  
b/linux-user/syscall.c
1750 1750
        new_env->dregs[0] = 0;
1751 1751
        /* ??? is this sufficient?  */
1752 1752
#elif defined(TARGET_MIPS)
1753
        printf ("HELPME: %s:%d\n", __FILE__, __LINE__);
1753
        if (!newsp)
1754
            newsp = env->gpr[29];
1755
        new_env->gpr[29] = newsp;
1754 1756
#elif defined(TARGET_PPC)
1755 1757
        if (!newsp)
1756 1758
            newsp = env->gpr[1];
......
2429 2431
#ifdef TARGET_NR_sigaction
2430 2432
    case TARGET_NR_sigaction:
2431 2433
        {
2432
	#if !defined(TARGET_MIPS)
2434
#if !defined(TARGET_MIPS)
2433 2435
            struct target_old_sigaction *old_act;
2434 2436
            struct target_sigaction act, oact, *pact;
2435 2437
            if (arg2) {
......
2452 2454
                old_act->sa_restorer = oact.sa_restorer;
2453 2455
                unlock_user_struct(old_act, arg3, 1);
2454 2456
            }
2455
	#else
2457
#else
2456 2458
	    struct target_sigaction act, oact, *pact, *old_act;
2457 2459

  
2458 2460
	    if (arg2) {
......
2478 2480
		old_act->sa_mask.sig[3] = 0;
2479 2481
		unlock_user_struct(old_act, arg3, 1);
2480 2482
	    }
2481
	#endif
2483
#endif
2482 2484
        }
2483 2485
        break;
2484 2486
#endif
b/target-mips/cpu.h
372 372
int cpu_mips_exec(CPUMIPSState *s);
373 373
CPUMIPSState *cpu_mips_init(void);
374 374
uint32_t cpu_mips_get_clock (void);
375
int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
375 376

  
376 377
#endif /* !defined (__MIPS_CPU_H__) */

Also available in: Unified diff