From patchwork Mon Feb 16 13:50:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 440116 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DE1AD140190 for ; Tue, 17 Feb 2015 00:43:50 +1100 (AEDT) Received: from localhost ([::1]:39550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNLxj-0005vO-5Z for incoming@patchwork.ozlabs.org; Mon, 16 Feb 2015 08:43:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNLxK-0005LO-Dt for qemu-devel@nongnu.org; Mon, 16 Feb 2015 08:43:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNLxH-0003Oy-4R for qemu-devel@nongnu.org; Mon, 16 Feb 2015 08:43:22 -0500 Received: from out1134-218.mail.aliyun.com ([42.120.134.218]:10116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNLxG-0003Od-BK for qemu-devel@nongnu.org; Mon, 16 Feb 2015 08:43:19 -0500 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.07423284|-1; FP=0|0|0|0|0|-1|-1|-1; HT=r41f05020; MF=gang.chen@sunrus.com.cn; PH=DS; RN=6; RT=6; SR=0; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:gang.chen@sunrus.com.cn ip:223.72.65.78) by smtp.aliyun-inc.com(10.194.100.11); Mon, 16 Feb 2015 21:43:09 +0800 Message-ID: <54E1F5C3.50701@sunrus.com.cn> Date: Mon, 16 Feb 2015 21:50:59 +0800 From: Chen Gang S User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Maydell , Chris Metcalf , Riku Voipio , "rth@twiddle.net" , "walt@tilera.com" References: <54E1F540.5070900@sunrus.com.cn> In-Reply-To: <54E1F540.5070900@sunrus.com.cn> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 42.120.134.218 Cc: qemu-devel Subject: [Qemu-devel] [PATCH 3/6 v2] linux-user: tilegx: Add target features support within qemu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org They are for target features within qemu which independent from outside. Signed-off-by: Chen Gang --- 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 . + */ +#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 . + */ +#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