Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Mar 2011 21:14:23 +0100
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Artem Belevich <fbsdlist@src.cx>
Subject:   Re: svn commit: r219561 - in head/sys: cddl/dev/systrace modules/dtrace modules/dtrace/dtraceall modules/dtrace/systrace_freebsd32 modules/dtrace/systrace_linux32
Message-ID:  <20110312211423.00000f34@unknown>
In-Reply-To: <201103120909.p2C99P2j010783@svn.freebsd.org>
References:  <201103120909.p2C99P2j010783@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 12 Mar 2011 09:09:25 +0000 (UTC) Andriy Gapon <avg@FreeBSD.org>
wrote:

> Author: avg
> Date: Sat Mar 12 09:09:25 2011
> New Revision: 219561
> URL: http://svn.freebsd.org/changeset/base/219561
> 
> Log:
>   add DTrace systrace support for linux32 and freebsd32 on amd64
> syscalls 
>   Add systrace_linux32 and systrace_freebsd32 modules which provide
>   support for tracing compat system calls in addition to native system
>   call tracing provided by systrace module.
>   
>   Provided that all the systrace modules are loaded now you can select
>   what syscalls to trace in the following manner:
>   
>   syscall::xxx:yyy - work on all system calls that match the
> specification syscall:freebsd:xxx:yyy - only native system calls
>   syscall:linux32:xxx:yyy - linux32 compat system calls
>   syscall:freebsd32:xxx:yyy - freebsd32 compat system calls on amd64

I am working on some SDT probes for the linuxulator. The way I handle it
there is to use "linuxulator" for the native size, and "linuxulator32"
for the current 32-bit linux emulation on amd64. When the amd64 arch
gets a native linux emulation (dchagin@ has patches) this would allow to
trace both in a sane way.

Is it possible to have "linux" as the modname on i386? Is it easy to
have both linux syscall types (64 bit and 32 bit) on amd64 in case
native support arrives in this code?

> Modified: head/sys/cddl/dev/systrace/systrace.c
> ==============================================================================
> --- head/sys/cddl/dev/systrace/systrace.c	Sat Mar 12 08:58:19
> 2011	(r219560) +++
> head/sys/cddl/dev/systrace/systrace.c	Sat Mar 12 09:09:25
> 2011	(r219561) @@ -59,17 +59,38 @@ #include <sys/dtrace.h>
>  
>  #ifdef LINUX_SYSTRACE
> -#include <linux.h>
> -#include <linux_syscall.h>
> -#include <linux_proto.h>
> -#include <linux_syscallnames.c>
> -#include <linux_systrace.c>
> +#if defined(__amd64__)
> +#include <amd64/linux32/linux.h>
> +#include <amd64/linux32/linux32_proto.h>
> +#include <amd64/linux32/linux32_syscalls.c>
> +#include <amd64/linux32/linux32_systrace_args.c>
> +#elif defined(__i386__)
> +#include <i386/linux/linux.h>
> +#include <i386/linux/linux_proto.h>
> +#include <i386/linux/linux_syscalls.c>
> +#include <i386/linux/linux_systrace_args.c>

This looks like there is also support for linux syscalls on 386.

> +#else
> +#error Only i386 and amd64 are supported.
> +#endif
>  extern struct sysent linux_sysent[];
> -#define	DEVNAME		"dtrace/linsystrace"
> -#define	PROVNAME	"linsyscall"
> +#define	MODNAME		"linux32"

But this looks like it will be named linux32 in any case. In the short
term I would prefer:
---snip---
#if defined(__amd64__)
#define	MODNAME	"linux32"
#elif defined(__i386__)
#define	MODNAME	"linux"
#endif
---snip---

>  #define	MAXSYSCALL	LINUX_SYS_MAXSYSCALL
>  #define	SYSCALLNAMES	linux_syscallnames
>  #define	SYSENT		linux_sysent

Bye,
Alexander.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110312211423.00000f34>