summaryrefslogtreecommitdiffstats
path: root/backends/csky_corenote.c
diff options
context:
space:
mode:
authorMao Han <han_mao@c-sky.com>2019-07-16 19:14:24 +0800
committerMark Wielaard <mark@klomp.org>2019-07-17 11:48:35 +0200
commit1b1433d5670b75c4bd5c9b598e0b00fba6e82d90 (patch)
treeb10b9a129ce8e2d4ee87ed3989fb7cd4a6cb19ed /backends/csky_corenote.c
parentb3233914074cb7eb19ea2fc3c70257679f867f68 (diff)
Add backend support for C-SKY
C-SKY V2 ABI manual: https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf C-SKY architecture user guide: https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf Signed-off-by: Mao Han <han_mao@c-sky.com>
Diffstat (limited to 'backends/csky_corenote.c')
-rw-r--r--backends/csky_corenote.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/backends/csky_corenote.c b/backends/csky_corenote.c
new file mode 100644
index 00000000..a1479bd3
--- /dev/null
+++ b/backends/csky_corenote.c
@@ -0,0 +1,61 @@
+/* C-SKY specific core note handling.
+ Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils 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 copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <elf.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/time.h>
+
+#define BACKEND csky_
+#include "libebl_CPU.h"
+
+#define ULONG uint32_t
+#define PID_T int32_t
+#define UID_T uint32_t
+#define GID_T uint32_t
+#define ALIGN_ULONG 4
+#define ALIGN_PID_T 4
+#define ALIGN_UID_T 4
+#define ALIGN_GID_T 4
+#define TYPE_ULONG ELF_T_WORD
+#define TYPE_PID_T ELF_T_SWORD
+#define TYPE_UID_T ELF_T_WORD
+#define TYPE_GID_T ELF_T_WORD
+
+static const Ebl_Register_Location prstatus_regs[] =
+ {
+ { .offset = 0, .regno = 0, .count = 36, .bits = 32 } /* r0..r31 */
+ };
+#define PRSTATUS_REGS_SIZE (36 * 4)
+
+#include "linux-core-note.c"