* [PATCH] x86,mmiotrace: add support for tracing STOS instruction
@ 2010-07-31 20:51 Marcin Slusarz
2010-08-01 8:23 ` Pekka Paalanen
2010-08-02 7:58 ` [tip:perf/core] x86,mmiotrace: Add " tip-bot for Marcin Slusarz
0 siblings, 2 replies; 4+ messages in thread
From: Marcin Slusarz @ 2010-07-31 20:51 UTC (permalink / raw)
To: x86; +Cc: LKML, Pekka Paalanen, nouveau
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Pekka Paalanen <pq@iki.fi>
---
arch/x86/mm/pf_in.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 308e325..38e6d17 100644
--- a/arch/x86/mm/pf_in.c
+++ b/arch/x86/mm/pf_in.c
@@ -40,16 +40,16 @@ static unsigned char prefix_codes[] = {
static unsigned int reg_rop[] = {
0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
};
-static unsigned int reg_wop[] = { 0x88, 0x89 };
+static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
static unsigned int imm_wop[] = { 0xC6, 0xC7 };
/* IA32 Manual 3, 3-432*/
-static unsigned int rw8[] = { 0x88, 0x8A, 0xC6 };
+static unsigned int rw8[] = { 0x88, 0x8A, 0xC6, 0xAA };
static unsigned int rw32[] = {
- 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
+ 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
};
-static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F };
+static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F, 0xAA };
static unsigned int mw16[] = { 0xB70F, 0xBF0F };
-static unsigned int mw32[] = { 0x89, 0x8B, 0xC7 };
+static unsigned int mw32[] = { 0x89, 0x8B, 0xC7, 0xAB };
static unsigned int mw64[] = {};
#else /* not __i386__ */
static unsigned char prefix_codes[] = {
@@ -63,20 +63,20 @@ static unsigned char prefix_codes[] = {
static unsigned int reg_rop[] = {
0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
};
-static unsigned int reg_wop[] = { 0x88, 0x89 };
+static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
static unsigned int imm_wop[] = { 0xC6, 0xC7 };
-static unsigned int rw8[] = { 0xC6, 0x88, 0x8A };
+static unsigned int rw8[] = { 0xC6, 0x88, 0x8A, 0xAA };
static unsigned int rw32[] = {
- 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
+ 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
};
/* 8 bit only */
-static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F };
+static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F, 0xAA };
/* 16 bit only */
static unsigned int mw16[] = { 0xB70F, 0xBF0F };
/* 16 or 32 bit */
static unsigned int mw32[] = { 0xC7 };
/* 16, 32 or 64 bit */
-static unsigned int mw64[] = { 0x89, 0x8B };
+static unsigned int mw64[] = { 0x89, 0x8B, 0xAB };
#endif /* not __i386__ */
struct prefix_bits {
@@ -410,7 +410,6 @@ static unsigned long *get_reg_w32(int no, struct pt_regs *regs)
unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
{
unsigned int opcode;
- unsigned char mod_rm;
int reg;
unsigned char *p;
struct prefix_bits prf;
@@ -437,8 +436,13 @@ unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
goto err;
do_work:
- mod_rm = *p;
- reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
+ /* for STOS, source register is fixed */
+ if (opcode == 0xAA || opcode == 0xAB) {
+ reg = arg_AX;
+ } else {
+ unsigned char mod_rm = *p;
+ reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
+ }
switch (get_ins_reg_width(ins_addr)) {
case 1:
return *get_reg_w8(reg, prf.rex, regs);
--
1.7.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86,mmiotrace: add support for tracing STOS instruction
2010-07-31 20:51 [PATCH] x86,mmiotrace: add support for tracing STOS instruction Marcin Slusarz
@ 2010-08-01 8:23 ` Pekka Paalanen
2010-08-01 23:08 ` Frederic Weisbecker
2010-08-02 7:58 ` [tip:perf/core] x86,mmiotrace: Add " tip-bot for Marcin Slusarz
1 sibling, 1 reply; 4+ messages in thread
From: Pekka Paalanen @ 2010-08-01 8:23 UTC (permalink / raw)
To: Marcin Slusarz; +Cc: x86, LKML, nouveau
On Sat, 31 Jul 2010 22:51:01 +0200
Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Cc: Pekka Paalanen <pq@iki.fi>
I have not checked the correctness of this patch, but otherwise:
Acked-by: Pekka Paalanen <pq@iki.fi>
> ---
> arch/x86/mm/pf_in.c | 30 +++++++++++++++++-------------
> 1 files changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
> index 308e325..38e6d17 100644
> --- a/arch/x86/mm/pf_in.c
> +++ b/arch/x86/mm/pf_in.c
> @@ -40,16 +40,16 @@ static unsigned char prefix_codes[] = {
> static unsigned int reg_rop[] = {
> 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
> };
> -static unsigned int reg_wop[] = { 0x88, 0x89 };
> +static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
> static unsigned int imm_wop[] = { 0xC6, 0xC7 };
> /* IA32 Manual 3, 3-432*/
> -static unsigned int rw8[] = { 0x88, 0x8A, 0xC6 };
> +static unsigned int rw8[] = { 0x88, 0x8A, 0xC6, 0xAA };
> static unsigned int rw32[] = {
> - 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
> + 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
> };
> -static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F };
> +static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F,
> 0xAA }; static unsigned int mw16[] = { 0xB70F, 0xBF0F };
> -static unsigned int mw32[] = { 0x89, 0x8B, 0xC7 };
> +static unsigned int mw32[] = { 0x89, 0x8B, 0xC7, 0xAB };
> static unsigned int mw64[] = {};
> #else /* not __i386__ */
> static unsigned char prefix_codes[] = {
> @@ -63,20 +63,20 @@ static unsigned char prefix_codes[] = {
> static unsigned int reg_rop[] = {
> 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
> };
> -static unsigned int reg_wop[] = { 0x88, 0x89 };
> +static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
> static unsigned int imm_wop[] = { 0xC6, 0xC7 };
> -static unsigned int rw8[] = { 0xC6, 0x88, 0x8A };
> +static unsigned int rw8[] = { 0xC6, 0x88, 0x8A, 0xAA };
> static unsigned int rw32[] = {
> - 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
> + 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
> };
> /* 8 bit only */
> -static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F };
> +static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F,
> 0xAA }; /* 16 bit only */
> static unsigned int mw16[] = { 0xB70F, 0xBF0F };
> /* 16 or 32 bit */
> static unsigned int mw32[] = { 0xC7 };
> /* 16, 32 or 64 bit */
> -static unsigned int mw64[] = { 0x89, 0x8B };
> +static unsigned int mw64[] = { 0x89, 0x8B, 0xAB };
> #endif /* not __i386__ */
>
> struct prefix_bits {
> @@ -410,7 +410,6 @@ static unsigned long *get_reg_w32(int no,
> struct pt_regs *regs) unsigned long get_ins_reg_val(unsigned long
> ins_addr, struct pt_regs *regs) {
> unsigned int opcode;
> - unsigned char mod_rm;
> int reg;
> unsigned char *p;
> struct prefix_bits prf;
> @@ -437,8 +436,13 @@ unsigned long get_ins_reg_val(unsigned long
> ins_addr, struct pt_regs *regs) goto err;
>
> do_work:
> - mod_rm = *p;
> - reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
> + /* for STOS, source register is fixed */
> + if (opcode == 0xAA || opcode == 0xAB) {
> + reg = arg_AX;
> + } else {
> + unsigned char mod_rm = *p;
> + reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
> + }
> switch (get_ins_reg_width(ins_addr)) {
> case 1:
> return *get_reg_w8(reg, prf.rex, regs);
> --
> 1.7.1.1
--
Pekka Paalanen
http://www.iki.fi/pq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86,mmiotrace: add support for tracing STOS instruction
2010-08-01 8:23 ` Pekka Paalanen
@ 2010-08-01 23:08 ` Frederic Weisbecker
0 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2010-08-01 23:08 UTC (permalink / raw)
To: Pekka Paalanen; +Cc: Marcin Slusarz, x86, LKML, nouveau, Ingo Molnar
On Sun, Aug 01, 2010 at 11:23:03AM +0300, Pekka Paalanen wrote:
> On Sat, 31 Jul 2010 22:51:01 +0200
> Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
>
> > Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> > Cc: Pekka Paalanen <pq@iki.fi>
>
> I have not checked the correctness of this patch, but otherwise:
> Acked-by: Pekka Paalanen <pq@iki.fi>
Queued, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] x86,mmiotrace: Add support for tracing STOS instruction
2010-07-31 20:51 [PATCH] x86,mmiotrace: add support for tracing STOS instruction Marcin Slusarz
2010-08-01 8:23 ` Pekka Paalanen
@ 2010-08-02 7:58 ` tip-bot for Marcin Slusarz
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Marcin Slusarz @ 2010-08-02 7:58 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, marcin.slusarz, fweisbec, nouveau,
rostedt, pq, tglx, mingo
Commit-ID: cc05152ab72d7a65e6ea97d286af4f878c8f7371
Gitweb: http://git.kernel.org/tip/cc05152ab72d7a65e6ea97d286af4f878c8f7371
Author: Marcin Slusarz <marcin.slusarz@gmail.com>
AuthorDate: Sat, 31 Jul 2010 22:51:01 +0200
Committer: Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Mon, 2 Aug 2010 01:32:01 +0200
x86,mmiotrace: Add support for tracing STOS instruction
Add support for stos access tracing with mmiotrace.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Pekka Paalanen <pq@iki.fi>
Cc: Nouveau <nouveau@lists.freedesktop.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <20100731205101.GA5860@joi.lan>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
arch/x86/mm/pf_in.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 308e325..38e6d17 100644
--- a/arch/x86/mm/pf_in.c
+++ b/arch/x86/mm/pf_in.c
@@ -40,16 +40,16 @@ static unsigned char prefix_codes[] = {
static unsigned int reg_rop[] = {
0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
};
-static unsigned int reg_wop[] = { 0x88, 0x89 };
+static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
static unsigned int imm_wop[] = { 0xC6, 0xC7 };
/* IA32 Manual 3, 3-432*/
-static unsigned int rw8[] = { 0x88, 0x8A, 0xC6 };
+static unsigned int rw8[] = { 0x88, 0x8A, 0xC6, 0xAA };
static unsigned int rw32[] = {
- 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
+ 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
};
-static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F };
+static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F, 0xAA };
static unsigned int mw16[] = { 0xB70F, 0xBF0F };
-static unsigned int mw32[] = { 0x89, 0x8B, 0xC7 };
+static unsigned int mw32[] = { 0x89, 0x8B, 0xC7, 0xAB };
static unsigned int mw64[] = {};
#else /* not __i386__ */
static unsigned char prefix_codes[] = {
@@ -63,20 +63,20 @@ static unsigned char prefix_codes[] = {
static unsigned int reg_rop[] = {
0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
};
-static unsigned int reg_wop[] = { 0x88, 0x89 };
+static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
static unsigned int imm_wop[] = { 0xC6, 0xC7 };
-static unsigned int rw8[] = { 0xC6, 0x88, 0x8A };
+static unsigned int rw8[] = { 0xC6, 0x88, 0x8A, 0xAA };
static unsigned int rw32[] = {
- 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
+ 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
};
/* 8 bit only */
-static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F };
+static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F, 0xAA };
/* 16 bit only */
static unsigned int mw16[] = { 0xB70F, 0xBF0F };
/* 16 or 32 bit */
static unsigned int mw32[] = { 0xC7 };
/* 16, 32 or 64 bit */
-static unsigned int mw64[] = { 0x89, 0x8B };
+static unsigned int mw64[] = { 0x89, 0x8B, 0xAB };
#endif /* not __i386__ */
struct prefix_bits {
@@ -410,7 +410,6 @@ static unsigned long *get_reg_w32(int no, struct pt_regs *regs)
unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
{
unsigned int opcode;
- unsigned char mod_rm;
int reg;
unsigned char *p;
struct prefix_bits prf;
@@ -437,8 +436,13 @@ unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
goto err;
do_work:
- mod_rm = *p;
- reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
+ /* for STOS, source register is fixed */
+ if (opcode == 0xAA || opcode == 0xAB) {
+ reg = arg_AX;
+ } else {
+ unsigned char mod_rm = *p;
+ reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
+ }
switch (get_ins_reg_width(ins_addr)) {
case 1:
return *get_reg_w8(reg, prf.rex, regs);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-02 7:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-31 20:51 [PATCH] x86,mmiotrace: add support for tracing STOS instruction Marcin Slusarz
2010-08-01 8:23 ` Pekka Paalanen
2010-08-01 23:08 ` Frederic Weisbecker
2010-08-02 7:58 ` [tip:perf/core] x86,mmiotrace: Add " tip-bot for Marcin Slusarz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox