[prev in list] [next in list] [prev in thread] [next in thread]
List: opensolaris-dtrace-discuss
Subject: [dtrace-discuss] NOP: 1 pid provider: 0
From: James McIlree <jmcilree () apple ! com>
Date: 2006-12-30 15:13:53
Message-ID: 66F51E23-AA2B-471D-BC1C-7F922D8600E7 () apple ! com
[Download RAW message or body]
I've been working on a project recently that uses multi-byte
NOPs. When I try to use the pid provider against that project, it
refuses
to instrument the NOPs.
I did some investigation and believe I have found the reason.
When fasttrap_tracepoint_init() runs, it attempts to find the size
of each instruction before installing a trap.
The instruction decoder does not have an entry for the multi-byte
NOPs, and returns a bogus size. This causes the trap install to fail.
I tested the following change:
m206-90:~/Projects/solaris/b50/usr/src/common/dis/i386> diff
dis_tables.c dis_tables-fixed.c
815c815
< /* [1C] */ INVALID, INVALID,
INVALID, INVALID,
---
> /* [1C] */ INVALID, INVALID,
INVALID, TS("nop",Mw),
Which seem to fix the issue for me.
Intel introduced the multi byte NOPs fairly recently, they are
documented in "IA-32 Intel® Architecture Software Developer’s Manual
Volume 2B", page 4 of chapter 4. My understanding is that these work
on AMD cpu's as well, but I have not been able to test that.
I used the following method for testing, you may find it useful
as well (this is gcc based, not sure how Sun's cc will do with it):
void nop() {
// 1 byte
asm volatile(".byte 0x90" "\n\t");
// 2 byte
asm volatile(".byte 0x66, 0x90" "\n\t");
// 3 byte
asm volatile(".byte 0x0F, 0x1f, 0x00" "\n\t");
// 4 byte
asm volatile(".byte 0x0F, 0x1f, 0x40, 0x00" "\n\t");
// 5 byte
asm volatile(".byte 0x0F, 0x1f, 0x44, 0x00, 0x00" "\n\t");
// 6 byte
asm volatile(".byte 0x66, 0x0F, 0x1f, 0x44, 0x00, 0x00" "\n
\t");
// 7 byte
asm volatile(".byte 0x0F, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00"
"\n\t");
// 8 byte
asm volatile(".byte 0x0F, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00,
0x00" "\n\t");
// 9 bytes
asm volatile(".byte 0x66, 0x0F, 0x1f, 0x84, 0x00, 0x00, 0x00,
0x00, 0x00" "\n\t");
}
James M
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic