MIPS patches 2016-09-23

Changes:
 * 24KEc CPU definition
 * SYNC instructions make use of tcg memory barrier ops
 * various MIPS linux-user bug fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJX5NUUAAoJEFIRjjwLKdprVcsH/0noTs5B/Nnqkdzc1/Hf/wUD
 WWrmj5hLctPK/1Rn209oWGQPEeygppr8spV+ELpGQ/rzi6cnrhf+ApyRgJIYqAeu
 uGyS3Eu0C4WRR1I5ncpJKxQBZl95fKkWg4QZP1nwXaWAtJe4aZp4apeEPs6HBZzI
 SfpvpQ34oGjodI2UzCSxnx5ZvawowRozoUrVsJeuA9ep3H995ZkbNIq14zKh2blx
 RtH09vaWd8mY+yQ0MVlKDUgZuj5PukSsDQCG1uwqBCKJKq0N3VHb5ht3nhOCTpaU
 xoA9MJTrE7ctiyNRpgg/JzJQ0P4Ifq5Ry4lyDxDzuXA35wHzvOeIbTdg78dQr3M=
 =3Hfc
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/lalrae/tags/mips-20160923' into staging

MIPS patches 2016-09-23

Changes:
* 24KEc CPU definition
* SYNC instructions make use of tcg memory barrier ops
* various MIPS linux-user bug fixes

# gpg: Signature made Fri 23 Sep 2016 08:09:08 BST
# gpg:                using RSA key 0x52118E3C0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
# Primary key fingerprint: 8DD3 2F98 5495 9D66 35D4  4FC0 5211 8E3C 0B29 DA6B

* remotes/lalrae/tags/mips-20160923:
  linux-user: Add missing Mips syscalls items in strace.list
  linux-user: Add missing TARGET_EDQUOT error code for Mips
  linux-user: Fix certain argument alignment cases for Mips64
  linux-user: Fix structure target_semid64_ds definition for Mips
  linux-user: Fix structure target_flock definition for Mips
  linux-user: Fix TARGET_F_GETOWN definition for Mips
  linux-user: Fix TARGET_SIOCATMARK definition for Mips
  target-mips: generate fences
  target-mips: add 24KEc CPU definition

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-09-23 15:28:07 +01:00
commit eaff9c4367
8 changed files with 199 additions and 4 deletions

View File

@ -45,4 +45,20 @@ struct target_shmid_ds {
abi_ulong __unused2;
};
#define TARGET_SEMID64_DS
/*
* The semid64_ds structure for the MIPS architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
*/
struct target_semid64_ds {
struct target_ipc_perm sem_perm;
abi_ulong sem_otime;
abi_ulong sem_ctime;
abi_ulong sem_nsems;
abi_ulong __unused1;
abi_ulong __unused2;
};
#endif

View File

@ -221,6 +221,8 @@ struct target_pt_regs {
#undef TARGET_ENOTRECOVERABLE
#define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */
#undef TARGET_EDQUOT
#define TARGET_EDQUOT 1133 /* Quota exceeded */
#define UNAME_MACHINE "mips"
#define UNAME_MINIMUM_RELEASE "2.6.32"

View File

@ -218,6 +218,8 @@ struct target_pt_regs {
#undef TARGET_ENOTRECOVERABLE
#define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */
#undef TARGET_EDQUOT
#define TARGET_EDQUOT 1133 /* Quota exceeded */
#define UNAME_MACHINE "mips64"
#define UNAME_MINIMUM_RELEASE "2.6.32"

View File

@ -6,6 +6,9 @@
#ifdef TARGET_NR_accept
{ TARGET_NR_accept, "accept" , NULL, print_accept, NULL },
#endif
#ifdef TARGET_NR_accept4
{ TARGET_NR_accept4, "accept4" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_access
{ TARGET_NR_access, "access" , NULL, print_access, NULL },
#endif
@ -39,6 +42,9 @@
#ifdef TARGET_NR_bind
{ TARGET_NR_bind, "bind" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_bpf
{ TARGET_NR_bpf, "bpf" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_break
{ TARGET_NR_break, "break" , NULL, NULL, NULL },
#endif
@ -123,18 +129,30 @@
#ifdef TARGET_NR_epoll_ctl_old
{ TARGET_NR_epoll_ctl_old, "epoll_ctl_old" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_pwait
{ TARGET_NR_epoll_pwait, "epoll_pwait" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_wait
{ TARGET_NR_epoll_wait, "epoll_wait" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_wait_old
{ TARGET_NR_epoll_wait_old, "epoll_wait_old" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd
{ TARGET_NR_eventfd, "eventfd" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd2
{ TARGET_NR_eventfd2, "eventfd2" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_execv
{ TARGET_NR_execv, "execv" , NULL, print_execv, NULL },
#endif
#ifdef TARGET_NR_execve
{ TARGET_NR_execve, "execve" , NULL, print_execve, NULL },
#endif
#ifdef TARGET_NR_execveat
{ TARGET_NR_execveat, "execveat" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_exec_with_loader
{ TARGET_NR_exec_with_loader, "exec_with_loader" , NULL, NULL, NULL },
#endif
@ -156,6 +174,15 @@
#ifdef TARGET_NR_fadvise64_64
{ TARGET_NR_fadvise64_64, "fadvise64_64" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fallocate
{ TARGET_NR_fallocate, "fallocate" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fanotify_init
{ TARGET_NR_fanotify_init, "fanotify_init" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fanotify_mark
{ TARGET_NR_fanotify_mark, "fanotify_mark" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fchdir
{ TARGET_NR_fchdir, "fchdir" , NULL, NULL, NULL },
#endif
@ -186,6 +213,9 @@
#ifdef TARGET_NR_fgetxattr
{ TARGET_NR_fgetxattr, "fgetxattr" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_finit_module
{ TARGET_NR_finit_module, "finit_module" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_flistxattr
{ TARGET_NR_flistxattr, "flistxattr" , NULL, NULL, NULL },
#endif
@ -231,6 +261,9 @@
#ifdef TARGET_NR_futimesat
{ TARGET_NR_futimesat, "futimesat" , NULL, print_futimesat, NULL },
#endif
#ifdef TARGET_NR_getcpu
{ TARGET_NR_getcpu, "getcpu" , "%s(%p,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_getcwd
{ TARGET_NR_getcwd, "getcwd" , "%s(%p,%d)", NULL, NULL },
#endif
@ -306,6 +339,9 @@
#ifdef TARGET_NR_getpriority
{ TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL },
#endif
#ifdef TARGET_NR_getrandom
{ TARGET_NR_getrandom, "getrandom", NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getresgid
{ TARGET_NR_getresgid, "getresgid" , NULL, NULL, NULL },
#endif
@ -379,6 +415,9 @@
#ifdef TARGET_NR_inotify_init
{ TARGET_NR_inotify_init, "inotify_init" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_inotify_init1
{ TARGET_NR_inotify_init1, "inotify_init1" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_inotify_rm_watch
{ TARGET_NR_inotify_rm_watch, "inotify_rm_watch" , NULL, NULL, NULL },
#endif
@ -415,6 +454,9 @@
#ifdef TARGET_NR_ipc
{ TARGET_NR_ipc, "ipc" , NULL, print_ipc, NULL },
#endif
#ifdef TARGET_NR_kcmp
{ TARGET_NR_kcmp, "kcmp" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_kexec_load
{ TARGET_NR_kexec_load, "kexec_load" , NULL, NULL, NULL },
#endif
@ -484,6 +526,12 @@
#ifdef TARGET_NR_mbind
{ TARGET_NR_mbind, "mbind" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_membarrier
{ TARGET_NR_membarrier, "membarrier" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_memfd_create
{ TARGET_NR_memfd_create, "memfd_create" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_memory_ordering
{ TARGET_NR_memory_ordering, "memory_ordering" , NULL, NULL, NULL },
#endif
@ -511,6 +559,9 @@
#ifdef TARGET_NR_mlock
{ TARGET_NR_mlock, "mlock" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_mlock2
{ TARGET_NR_mlock2, "mlock2" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_mlockall
{ TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL },
#endif
@ -583,6 +634,9 @@
#ifdef TARGET_NR_munmap
{ TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL },
#endif
#ifdef TARGET_NR_name_to_handle_at
{ TARGET_NR_name_to_handle_at, "name_to_handle_at" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_nanosleep
{ TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL },
#endif
@ -952,6 +1006,9 @@
#ifdef TARGET_NR_pciconfig_write
{ TARGET_NR_pciconfig_write, "pciconfig_write" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_perf_event_open
{ TARGET_NR_perf_event_open, "perf_event_open" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_perfctr
{ TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL },
#endif
@ -976,6 +1033,18 @@
#ifdef TARGET_NR_pread64
{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_preadv
{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_prlimit64
{ TARGET_NR_prlimit64, "prlimit64" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_process_vm_readv
{ TARGET_NR_process_vm_readv, "process_vm_readv" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_process_vm_writev
{ TARGET_NR_process_vm_writev, "process_vm_writev" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_prof
{ TARGET_NR_prof, "prof" , NULL, NULL, NULL },
#endif
@ -994,6 +1063,9 @@
#ifdef TARGET_NR_pwrite64
{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_pwritev
{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_query_module
{ TARGET_NR_query_module, "query_module" , NULL, NULL, NULL },
#endif
@ -1027,6 +1099,9 @@
#ifdef TARGET_NR_recvfrom
{ TARGET_NR_recvfrom, "recvfrom" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_recvmmsg
{ TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_recvmsg
{ TARGET_NR_recvmsg, "recvmsg" , NULL, NULL, NULL },
#endif
@ -1042,9 +1117,18 @@
#ifdef TARGET_NR_renameat
{ TARGET_NR_renameat, "renameat" , NULL, print_renameat, NULL },
#endif
#ifdef TARGET_NR_renameat2
{ TARGET_NR_renameat2, "renameat2" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_request_key
{ TARGET_NR_request_key, "request_key" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_reserved177
{ TARGET_NR_reserved177, "reserved177" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_reserved193
{ TARGET_NR_reserved193, "reserved193" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_reserved221
{ TARGET_NR_reserved221, "reserved221" , NULL, NULL, NULL },
#endif
@ -1078,12 +1162,18 @@
#ifdef TARGET_NR_rt_sigtimedwait
{ TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_rt_tgsigqueueinfo
{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_getaffinity
{ TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_get_affinity
{ TARGET_NR_sched_get_affinity, "sched_get_affinity" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_getattr
{ TARGET_NR_sched_getattr, "sched_getattr" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_getparam
{ TARGET_NR_sched_getparam, "sched_getparam" , NULL, NULL, NULL },
#endif
@ -1102,6 +1192,9 @@
#ifdef TARGET_NR_sched_setaffinity
{ TARGET_NR_sched_setaffinity, "sched_setaffinity" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_setatt
{ TARGET_NR_sched_setatt, "sched_setatt" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sched_set_affinity
{ TARGET_NR_sched_set_affinity, "sched_set_affinity" , NULL, NULL, NULL },
#endif
@ -1114,6 +1207,9 @@
#ifdef TARGET_NR_sched_yield
{ TARGET_NR_sched_yield, "sched_yield" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_seccomp
{ TARGET_NR_seccomp, "seccomp" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_security
{ TARGET_NR_security, "security" , NULL, NULL, NULL },
#endif
@ -1141,6 +1237,9 @@
#ifdef TARGET_NR_sendfile64
{ TARGET_NR_sendfile64, "sendfile64" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sendmmsg
{ TARGET_NR_sendmmsg, "sendmmsg" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sendmsg
{ TARGET_NR_sendmsg, "sendmsg" , NULL, NULL, NULL },
#endif
@ -1280,6 +1379,12 @@
#ifdef TARGET_NR_signal
{ TARGET_NR_signal, "signal" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_signalfd
{ TARGET_NR_signalfd, "signalfd" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_signalfd4
{ TARGET_NR_signalfd4, "signalfd4" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sigpending
{ TARGET_NR_sigpending, "sigpending" , NULL, NULL, NULL },
#endif
@ -1352,6 +1457,9 @@
#ifdef TARGET_NR_sync_file_range
{ TARGET_NR_sync_file_range, "sync_file_range" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_syncfs
{ TARGET_NR_syncfs, "syncfs" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_syscall
{ TARGET_NR_syscall, "syscall" , NULL, NULL, NULL },
#endif
@ -1409,6 +1517,9 @@
#ifdef TARGET_NR_timer_settime
{ TARGET_NR_timer_settime, "timer_settime" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_timerfd
{ TARGET_NR_timerfd, "timerfd" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_timerfd_create
{ TARGET_NR_timerfd_create, "timerfd_create" , NULL, NULL, NULL },
#endif
@ -1460,6 +1571,9 @@
#ifdef TARGET_NR_unshare
{ TARGET_NR_unshare, "unshare" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_userfaultfd
{ TARGET_NR_userfaultfd, "userfaultfd" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_unused109
{ TARGET_NR_unused109, "unused109" , NULL, NULL, NULL },
#endif

View File

@ -658,7 +658,7 @@ static inline int next_free_host_timer(void)
static inline int regpairs_aligned(void *cpu_env) {
return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
}
#elif defined(TARGET_MIPS)
#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
static inline int regpairs_aligned(void *cpu_env) { return 1; }
#elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
/* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
@ -757,6 +757,7 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
[ENAVAIL] = TARGET_ENAVAIL,
[EISNAM] = TARGET_EISNAM,
[EREMOTEIO] = TARGET_EREMOTEIO,
[EDQUOT] = TARGET_EDQUOT,
[ESHUTDOWN] = TARGET_ESHUTDOWN,
[ETOOMANYREFS] = TARGET_ETOOMANYREFS,
[ETIMEDOUT] = TARGET_ETIMEDOUT,

View File

@ -898,7 +898,11 @@ struct target_pollfd {
#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
#define TARGET_KDSIGACCEPT 0x4B4E
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4)
#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
#else
#define TARGET_SIOCATMARK 0x8905
#endif
/* Networking ioctls */
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
@ -2160,7 +2164,7 @@ struct target_statfs64 {
#define TARGET_F_SETLK 6
#define TARGET_F_SETLKW 7
#define TARGET_F_SETOWN 24 /* for sockets. */
#define TARGET_F_GETOWN 25 /* for sockets. */
#define TARGET_F_GETOWN 23 /* for sockets. */
#else
#define TARGET_F_GETLK 5
#define TARGET_F_SETLK 6
@ -2329,7 +2333,13 @@ struct target_flock {
short l_whence;
abi_long l_start;
abi_long l_len;
#if defined(TARGET_MIPS)
abi_long l_sysid;
#endif
int l_pid;
#if defined(TARGET_MIPS)
abi_long pad[4];
#endif
};
struct target_flock64 {

View File

@ -13109,6 +13109,34 @@ static void gen_ldst_pair (DisasContext *ctx, uint32_t opc, int rd,
tcg_temp_free(t1);
}
static void gen_sync(int stype)
{
TCGBar tcg_mo = TCG_BAR_SC;
switch (stype) {
case 0x4: /* SYNC_WMB */
tcg_mo |= TCG_MO_ST_ST;
break;
case 0x10: /* SYNC_MB */
tcg_mo |= TCG_MO_ALL;
break;
case 0x11: /* SYNC_ACQUIRE */
tcg_mo |= TCG_MO_LD_LD | TCG_MO_LD_ST;
break;
case 0x12: /* SYNC_RELEASE */
tcg_mo |= TCG_MO_ST_ST | TCG_MO_LD_ST;
break;
case 0x13: /* SYNC_RMB */
tcg_mo |= TCG_MO_LD_LD;
break;
default:
tcg_mo |= TCG_MO_ALL;
break;
}
tcg_gen_mb(tcg_mo);
}
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs)
{
int extension = (ctx->opcode >> 6) & 0x3f;
@ -13384,7 +13412,7 @@ static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs)
case 0x2d:
switch (minor) {
case SYNC:
/* NOP */
gen_sync(extract32(ctx->opcode, 16, 5));
break;
case SYSCALL:
generate_exception_end(ctx, EXCP_SYSCALL);
@ -17201,7 +17229,7 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx)
break;
case OPC_SYNC:
check_insn(ctx, ISA_MIPS2);
/* Treat as NOP. */
gen_sync(extract32(ctx->opcode, 6, 5));
break;
#if defined(TARGET_MIPS64)

View File

@ -255,6 +255,28 @@ static const mips_def_t mips_defs[] =
.insn_flags = CPU_MIPS32R2 | ASE_MIPS16,
.mmu_type = MMU_TYPE_R4000,
},
{
.name = "24KEc",
.CP0_PRid = 0x00019600,
.CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
(MMU_TYPE_R4000 << CP0C0_MT),
.CP0_Config1 = MIPS_CONFIG1 | (15 << CP0C1_MMU) |
(0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
(0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
(1 << CP0C1_CA),
.CP0_Config2 = MIPS_CONFIG2,
.CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_DSPP) | (0 << CP0C3_VInt),
.CP0_LLAddr_rw_bitmask = 0,
.CP0_LLAddr_shift = 4,
.SYNCI_Step = 32,
.CCRes = 2,
/* we have a DSP, but no FPU */
.CP0_Status_rw_bitmask = 0x1378FF1F,
.SEGBITS = 32,
.PABITS = 32,
.insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP,
.mmu_type = MMU_TYPE_R4000,
},
{
.name = "24Kf",
.CP0_PRid = 0x00019300,