HomeFreeBSD

Add the MD parts of dtrace needed to use fbt on ARM. For this we need to

Description

Add the MD parts of dtrace needed to use fbt on ARM. For this we need to
emulate the instructions used in function entry and exit.

For function entry ARM will use a push instruction to push up to 16
registers to the stack. While we don't expect all 16 to be used we need to
handle any combination the compiler may generate, even if it doesn't make
sense (e.g. pushing the program counter).

On function return we will either have a pop or branch instruction. The
former is similar to the push instruction, but with care to make sure we
update the stack pointer and program counter correctly in the cases they
are either in the list of registers or not. For branch we need to take the
24-bit offset, sign-extend it, and add that number of 4-byte words to the
program counter. Care needs to be taken as, due to historical reasons, the
address the branch is relative to is not the current instruction, but 8
bytes later.

This allows us to use the following probes on ARM boards:

dtrace -n 'fbt::malloc:entry { stack() }'

and

dtrace -n 'fbt::free:return { stack() }'

Differential Revision: https://reviews.freebsd.org/D2007
Reviewed by: gnn, rpaulo
Sponsored by: ABT Systems Ltd

Details

Provenance
andrewAuthored on
Reviewer
gnn
Differential Revision
D2007: Get fbt working on ARM
Parents
rS279666: qsort(3): small style(9) cleanups.
Branches
Unknown
Tags
Unknown

Event Timeline