Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Porting DTrace to ARM



Hi,

I'm working on porting DTrace to ARM.

The patch (*) is my WIP product on the work. It's not
still mature but it works anyway in some cases.

(*) https://gist.github.com/ozaki-r/8535846

I'm sending the patch because I would like to ask comments
and suggestions whether I'm going to the right direction.
Any comments and suggestions are appreciated.

Current status:
- The patch is tested on an AM3352 board
  - built with -m evbarm kernel=BEAGLEBONE
  - and it doesn't break builds of i386/amd64 and
    evbram w/o MKDTRACE=yes
- SDT works
- FBT works on 80% functions
  - ex. dtrace -n fbt::sys_open:return
- DScript doesn't work

Implementation notes:
- Undefined instructions are used to trap functions'
  entry/return
  - The least significant four bits are used to include
    the cond of a patched instruction
  - The cond is used to known quickly if the trapped
    instruction should be executed or not
- Unlike i386/amd64 versions, the dtrace trap handler
  is implemented as one of undefined_handlers as same
  as gdb
  - So the current implementation is slightly inefficient
- Unlike i386/amd64 versions, part of a patched
  instruction is returned by dtrace_probe to the trap
  handler to emulate the instruction correctly

The diffstat of the patch is:
$ diffstat dtrace-arm.patch
 common/lib/libc/arch/arm/string/ffs.S                |    2
 external/cddl/osnet/dev/cyclic/arm/cyclic_machdep.c  |  148 ++++++++
 external/cddl/osnet/dev/cyclic/i386/cyclic_machdep.c |    2
 external/cddl/osnet/dev/dtrace/arm/dtrace_asm.S      |   10
 external/cddl/osnet/dev/dtrace/arm/dtrace_isa.c      |   33 -
 external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c     |  327
+++++++++++++++++--
 external/cddl/osnet/dev/dtrace/dtrace_debug.c        |   60 ---
 external/cddl/osnet/dev/fbt/fbt.c                    |  266 ++++++++++++++-
 external/cddl/osnet/dist/uts/common/dtrace/dtrace.c  |    2
 external/cddl/osnet/dist/uts/common/sys/dtrace.h     |   17
 external/cddl/osnet/sys/kern/opensolaris.c           |    2
 external/cddl/osnet/sys/sys/cpuvar.h                 |    3
 external/cddl/osnet/sys/sys/mount.h                  |    2
 sys/arch/arm/arm/undefined.c                         |  157 +++++++++
 sys/arch/arm/arm32/db_interface.c                    |    2
 sys/arch/arm/include/armreg.h                        |   39 ++
 sys/arch/arm/include/trap.h                          |    5
 sys/conf/files                                       |    2
 sys/modules/cyclic/Makefile                          |   10
 sys/modules/dtrace/dtrace/Makefile                   |   10
 20 files changed, 962 insertions(+), 137 deletions(-)

Thanks in advance,
  ozaki-r


Home | Main Index | Thread Index | Old Index