Add support for the OpenRISC 1000 platform

* configure.ac: Added or1k architecture..
* defs.h: Added or1k to use register reading system.
* linux/or1k/ioctlent.h.in: Use i386 ioctls.
* linux/or1k/syscallent.h: New file.
* process.c: Added or1k register defs to struct_user_offsets[].
* syscall.c: Added or1k_io iovec for or1k GETREGSET,
  regset structure for or1k.
  (printcall): Added handling for or1k.
  (get_regs): Likewise.
  (get_scno): Likewise.
  (get_syscall_args): Likewise.
  (get_syscall_result): Likewise.
  (get_error): Likewise.
* util.c (change_syscall): Added dummy handling for or1k.
* system.c (sys_or1k_atomic): New function (or1k specific syscall).

Signed-off-by: Christian Svensson <blue@cmd.nu>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/system.c b/system.c
index 3d41006..d5900c4 100644
--- a/system.c
+++ b/system.c
@@ -1026,3 +1026,63 @@
 }
 
 #endif /* MIPS */
+
+#ifdef OR1K
+#define OR1K_ATOMIC_SWAP        1
+#define OR1K_ATOMIC_CMPXCHG     2
+#define OR1K_ATOMIC_XCHG        3
+#define OR1K_ATOMIC_ADD         4
+#define OR1K_ATOMIC_DECPOS      5
+#define OR1K_ATOMIC_AND         6
+#define OR1K_ATOMIC_OR          7
+#define OR1K_ATOMIC_UMAX        8
+#define OR1K_ATOMIC_UMIN        9
+
+static const struct xlat atomic_ops[] = {
+	{ OR1K_ATOMIC_SWAP,		"SWAP"		},
+	{ OR1K_ATOMIC_CMPXCHG,		"CMPXCHG"	},
+	{ OR1K_ATOMIC_XCHG,		"XCHG"		},
+	{ OR1K_ATOMIC_ADD,		"ADD"		},
+	{ OR1K_ATOMIC_DECPOS,		"DECPOS"	},
+	{ OR1K_ATOMIC_AND,		"AND"		},
+	{ OR1K_ATOMIC_OR,		"OR"		},
+	{ OR1K_ATOMIC_UMAX,		"UMAX"		},
+	{ OR1K_ATOMIC_UMIN,		"UMIN"		},
+	{ 0, NULL }
+};
+
+int sys_or1k_atomic(struct tcb *tcp)
+{
+	if (entering(tcp)) {
+		printxval(atomic_ops, tcp->u_arg[0], "???");
+		switch(tcp->u_arg[0]) {
+		case OR1K_ATOMIC_SWAP:
+			tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
+			break;
+		case OR1K_ATOMIC_CMPXCHG:
+			tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
+				tcp->u_arg[3]);
+			break;
+
+		case OR1K_ATOMIC_XCHG:
+		case OR1K_ATOMIC_ADD:
+		case OR1K_ATOMIC_AND:
+		case OR1K_ATOMIC_OR:
+		case OR1K_ATOMIC_UMAX:
+		case OR1K_ATOMIC_UMIN:
+			tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
+			break;
+
+		case OR1K_ATOMIC_DECPOS:
+			tprintf(", 0x%lx", tcp->u_arg[1]);
+			break;
+
+		default:
+			break;
+		}
+	}
+
+	return RVAL_HEX;
+}
+
+#endif /* OR1K */