[PATCH] Add support for Altera's Nios-II softcore architecture

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Sat Apr 18 20:46:19 UTC 2015



On 04/18/2015 05:33 PM, Ezequiel Garcia wrote:
> 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.
> 
> * Makefile.am, configure.ac: add nios2 files and support
> * cacheflush.c: support nios2 cacheflush syscall
> * linux/nios2/: arch-specific port
> 
> Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
> ---
>  Makefile.am                    |  8 ++++++++
>  cacheflush.c                   | 12 ++++++++++++
>  configure.ac                   |  5 +++++
>  linux/nios2/arch_regs.c        |  2 ++
>  linux/nios2/get_error.c        | 14 ++++++++++++++
>  linux/nios2/get_scno.c         |  1 +
>  linux/nios2/get_syscall_args.c |  6 ++++++
>  linux/nios2/ioctls_arch0.h     |  1 +
>  linux/nios2/ioctls_inc0.h      |  1 +
>  linux/nios2/print_pc.c         |  1 +
>  linux/nios2/syscallent.h       |  4 ++++
>  11 files changed, 55 insertions(+)

BTW, forgot to version this correctly. Current patch
is v4. For those interested, here's a link to the previous
version:

  http://marc.info/?l=strace&m=139170929111223&w=2

This v4 patch had to be completely re-written, for two reasons.
First, the Nios-II Linux port landed in mainline and now uses the
generic syscall ABI. And also, strace arch-specific code was re-organized.

The diffstat speaks for itself about the advantages of using the generic
syscall ABI and the impact of the strace cleanup (consider v3 had roughly
500 insertions!).

Finally, here's a tiny example of strace running Nios-II:

# strace ls
execve("/bin/ls", ["ls"], [/* 16 vars */]) = 0
brk(0)                                  = 0xb9000 
uname({sysname="Linux", nodename="buildroot", ...}) = 0
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=64, ...}) = 0
mmap2(NULL, 64, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2aac8000
close(3)                                = 0
openat(AT_FDCWD, "/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
fstatat64(AT_FDCWD, "/lib/tls", 0x7fb43588, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0q\0\1\0\0\0\274l\2\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1438528, ...}) = 0
mmap2(NULL, 1445956, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2aac9000
mmap2(0x2ac14000, 81920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14a000) = 0x2ac14000
mmap2(0x2ac28000, 8260, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2ac28000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac2b000
mprotect(0x2ac14000, 61440, PROT_READ)  = 0
mprotect(0x2aac5000, 4096, PROT_READ)   = 0
munmap(0x2aac8000, 64)                  = 0
getuid()                                = 0
gettimeofday({1167609616, 759566}, NULL) = 0
ioctl(0, TIOCGWINSZ, {ws_row=0, ws_col=0, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
brk(0)                                  = 0xb9000
brk(0xda000)                            = 0xda000
fstatat64(AT_FDCWD, ".", {st_mode=S_IFDIR|0700, st_size=0, ...}, 0) = 0
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
getdents64(3, /* 6 entries */, 32768)   = 192
getdents64(3, /* 0 entries */, 32768)   = 0
close(3)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Enjoy!
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar




More information about the Strace-devel mailing list