Add support for Altera's Nios-II softcore architecture

This commit adds strace support for Altera's Nios-II.  The architecture
is supported by Linux since v3.19, and it implements the generic syscall
ABI.

* configure.ac: Add nios2 support.
* cacheflush.c [NIOS2] (sys_cacheflush): New function.
* linux/nios2/*: New Nios-II specific files.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
This commit is contained in:
Ezequiel Garcia 2015-04-18 17:33:27 -03:00 committed by Dmitry V. Levin
parent 86b4fb5bc5
commit bd8dd776db
11 changed files with 54 additions and 0 deletions

View File

@ -341,6 +341,14 @@ EXTRA_DIST = \
linux/mips/syscallent.h \
linux/mips/userent.h \
linux/mtd-abi.h \
linux/nios2/arch_regs.c \
linux/nios2/get_error.c \
linux/nios2/get_scno.c \
linux/nios2/get_syscall_args.c \
linux/nios2/ioctls_arch0.h \
linux/nios2/ioctls_inc0.h \
linux/nios2/print_pc.c \
linux/nios2/syscallent.h \
linux/or1k/arch_regs.c \
linux/or1k/get_error.c \
linux/or1k/get_scno.c \

View File

@ -89,3 +89,15 @@ SYS_FUNC(cacheflush)
return 0;
}
#endif /* SH */
#ifdef NIOS2
SYS_FUNC(cacheflush)
{
if (entering(tcp)) {
/* addr and len */
tprintf("%#lx, %lu", tcp->u_arg[0], tcp->u_arg[3]);
/* scope and flags (cache type) are currently ignored */
}
return 0;
}
#endif /* NIOS2 */

View File

@ -125,6 +125,11 @@ microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
nios2*)
arch=nios2
AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
;;
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])

2
linux/nios2/arch_regs.c Normal file
View File

@ -0,0 +1,2 @@
static struct user_pt_regs nios2_regs;
# define ARCH_REGS_FOR_GETREGSET nios2_regs

13
linux/nios2/get_error.c Normal file
View File

@ -0,0 +1,13 @@
/*
* The system call convention specifies that r2 contains the return
* value on success or a positive error number on failure. A flag
* indicating successful completion is written to r7; r7=0 indicates
* the system call success, r7=1 indicates an error. The positive
* errno value written in r2.
*/
if (check_errno && nios2_regs.regs[7]) {
tcp->u_rval = -1;
tcp->u_error = nios2_regs.regs[2];
} else {
tcp->u_rval = nios2_regs.regs[2];
}

1
linux/nios2/get_scno.c Normal file
View File

@ -0,0 +1 @@
scno = nios2_regs.regs[2];

View File

@ -0,0 +1,6 @@
tcp->u_arg[0] = nios2_regs.regs[4];
tcp->u_arg[1] = nios2_regs.regs[5];
tcp->u_arg[2] = nios2_regs.regs[6];
tcp->u_arg[3] = nios2_regs.regs[7];
tcp->u_arg[4] = nios2_regs.regs[8];
tcp->u_arg[5] = nios2_regs.regs[9];

View File

@ -0,0 +1 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/nios2/include/ tree. */

View File

@ -0,0 +1 @@
#include "32/ioctls_inc.h"

1
linux/nios2/print_pc.c Normal file
View File

@ -0,0 +1 @@
tprintf(fmt, nios2_regs.regs[PTR_EA]);

4
linux/nios2/syscallent.h Normal file
View File

@ -0,0 +1,4 @@
#define ARCH_sys_mmap sys_mmap_pgoff
#include "32/syscallent.h"
[244] = {4, 0, sys_cacheflush, "cacheflush"},
[245 ... 259] = { },