All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang S <gang.chen@sunrus.com.cn>
To: Chris Metcalf <cmetcalf@ezchip.com>,
	"rth@twiddle.net" <rth@twiddle.net>,
	Peter Maydell <peter.maydell@linaro.org>,
	Riku Voipio <riku.voipio@iki.fi>,
	"walt@tilera.com" <walt@tilera.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 3/6 v4] linux-user: tilegx: Add target features support within qemu
Date: Sun, 22 Feb 2015 21:35:13 +0800	[thread overview]
Message-ID: <54E9DB11.6050105@sunrus.com.cn> (raw)
In-Reply-To: <54E9DA4D.1050702@sunrus.com.cn>

They are for target features within qemu which independent from outside.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 linux-user/tilegx/target_cpu.h     | 35 +++++++++++++++++++++++++++
 linux-user/tilegx/target_signal.h  | 28 ++++++++++++++++++++++
 linux-user/tilegx/target_structs.h | 48 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 linux-user/tilegx/target_cpu.h
 create mode 100644 linux-user/tilegx/target_signal.h
 create mode 100644 linux-user/tilegx/target_structs.h

diff --git a/linux-user/tilegx/target_cpu.h b/linux-user/tilegx/target_cpu.h
new file mode 100644
index 0000000..93329fc
--- /dev/null
+++ b/linux-user/tilegx/target_cpu.h
@@ -0,0 +1,35 @@
+/*
+ * Tilegx specific CPU ABI and functions for linux-user
+ *
+ * Copyright (c) 2015 Chen Gang
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef TARGET_CPU_H
+#define TARGET_CPU_H
+
+static inline void cpu_clone_regs(CPUTLState *env, target_ulong newsp)
+{
+    if (newsp) {
+        env->regs[TILEGX_R_SP] = newsp;
+    }
+    env->regs[TILEGX_R_RE] = 0;
+}
+
+static inline void cpu_set_tls(CPUTLState *env, target_ulong newtls)
+{
+    env->regs[TILEGX_R_TP] = newtls;
+}
+
+#endif
diff --git a/linux-user/tilegx/target_signal.h b/linux-user/tilegx/target_signal.h
new file mode 100644
index 0000000..8c7b02a
--- /dev/null
+++ b/linux-user/tilegx/target_signal.h
@@ -0,0 +1,28 @@
+#ifndef TARGET_SIGNAL_H
+#define TARGET_SIGNAL_H
+
+#include "cpu.h"
+
+/* this struct defines a stack used during syscall handling */
+
+typedef struct target_sigaltstack {
+    abi_ulong ss_sp;
+    abi_ulong ss_size;
+    abi_long ss_flags;
+} target_stack_t;
+
+/*
+ * sigaltstack controls
+ */
+#define TARGET_SS_ONSTACK     1
+#define TARGET_SS_DISABLE     2
+
+#define TARGET_MINSIGSTKSZ    2048
+#define TARGET_SIGSTKSZ       8192
+
+static inline abi_ulong get_sp_from_cpustate(CPUTLState *state)
+{
+    return state->regs[TILEGX_R_SP];
+}
+
+#endif /* TARGET_SIGNAL_H */
diff --git a/linux-user/tilegx/target_structs.h b/linux-user/tilegx/target_structs.h
new file mode 100644
index 0000000..6ed6741
--- /dev/null
+++ b/linux-user/tilegx/target_structs.h
@@ -0,0 +1,48 @@
+/*
+ * Tilegx specific structures for linux-user
+ *
+ * Copyright (c) 2015 Chen Gang
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef TARGET_STRUCTS_H
+#define TARGET_STRUCTS_H
+
+struct target_ipc_perm {
+    abi_int __key;                      /* Key.  */
+    abi_uint uid;                       /* Owner's user ID.  */
+    abi_uint gid;                       /* Owner's group ID.  */
+    abi_uint cuid;                      /* Creator's user ID.  */
+    abi_uint cgid;                      /* Creator's group ID.  */
+    abi_uint mode;                    /* Read/write permission.  */
+    abi_ushort __seq;                   /* Sequence number.  */
+    abi_ushort __pad2;
+    abi_ulong __unused1;
+    abi_ulong __unused2;
+};
+
+struct target_shmid_ds {
+    struct target_ipc_perm shm_perm;    /* operation permission struct */
+    abi_long shm_segsz;                 /* size of segment in bytes */
+    abi_ulong shm_atime;                /* time of last shmat() */
+    abi_ulong shm_dtime;                /* time of last shmdt() */
+    abi_ulong shm_ctime;                /* time of last change by shmctl() */
+    abi_int shm_cpid;                   /* pid of creator */
+    abi_int shm_lpid;                   /* pid of last shmop */
+    abi_ulong shm_nattch;               /* number of current attaches */
+    abi_ulong __unused4;
+    abi_ulong __unused5;
+};
+
+#endif
-- 
1.9.3

  parent reply	other threads:[~2015-02-22 13:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-22 13:31 [Qemu-devel] [PATCH 0/6 v4] tilegx: Can load elf64 tilegx binary successfully for linux-user Chen Gang S
2015-02-22 13:33 ` [Qemu-devel] [PATCH 1/6 v4] target-tilegx: Firstly add to qemu with minimized features Chen Gang S
2015-02-27 17:36   ` Andreas Färber
2015-02-27 21:49     ` Chris Metcalf
2015-02-28  2:10       ` Chen Gang S
2015-02-28  2:09         ` Chris Metcalf
2015-02-28  4:39           ` Chen Gang S
2015-02-28  5:20     ` Chen Gang S
2015-02-28 20:04       ` Chen Gang S
2015-02-28 19:19     ` Chen Gang S
2015-02-22 13:35 ` Chen Gang S [this message]
2015-02-22 13:36 ` [Qemu-devel] [PATCH 4/6 v4] linux-user: Support tilegx architecture in syscall Chen Gang S
2015-02-27 17:40   ` Andreas Färber
2015-02-27 23:10     ` Chen Gang S
2015-02-22 13:36 ` [Qemu-devel] [PATCH 5/6 v4] linux-user: Support tilegx architecture in linux-user Chen Gang S
2015-02-22 13:37 ` [Qemu-devel] [PATCH 6/6 v4] linux-user/syscall.c: Switch all macros which are not defined in tilegx Chen Gang S
2015-02-27 18:24   ` Andreas Färber
2015-02-27 23:06     ` Chen Gang S
2015-02-22 18:29 ` [Qemu-devel] [PATCH 0/6 v4] tilegx: Can load elf64 tilegx binary successfully for linux-user Richard Henderson
2015-02-23  1:40   ` Chen Gang S
2015-02-22 22:32 ` Bastian Koppelmann
2015-02-23  1:37   ` Chen Gang S
2015-02-26 23:56   ` Chen Gang S
2015-02-27  0:32     ` Chen Gang S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E9DB11.6050105@sunrus.com.cn \
    --to=gang.chen@sunrus.com.cn \
    --cc=cmetcalf@ezchip.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=walt@tilera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.