public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Johnson <ben@blarg.net>
To: LKML <linux-kernel@vger.kernel.org>
Subject: debug registers not working? 2.0 kernel
Date: Fri, 22 Aug 2003 08:51:02 -0700	[thread overview]
Message-ID: <20030822085102.A27952@blarg.net> (raw)

I'm experimenting with the debug registers in the 2.0 kernel.  My goal
is to implement data watchpoints.  This work seems to have been done
elsewhere and I plan to use that work, but in the meantime I'm just
experimenting.  I want to see a data watchpoint work.  so far it hasn't.
Can anyone help me figure out what I'm doing wrong?

I have verified that asm("int 1") results in the "debug" isr running.
If I understand correctly, setting the debug registers in a certain way
should result in interrupt line 1 firing.  so far I haven't seen it work
that way.  is there something I'm not getting?

Thanks a lot!

- Ben




details:
----------------------------------------------------------------

I added the following code to the top of the schedule() function as a
simple test.  I removed code elsewhere in the kernel that messes with
(disables) %db7, and part of the following verifies that %db7 is never
changed after I set it.  I think software interrupt 1 should fire when
'has_run_2' is sampled, and probably again when it's updated, but it
doesn't work.  I've tried many many variations of this.

----------------------------------------------------------------

static int odb7 = 0;
static int oaddr0 = 0;

int db7 = 0;
int addr0 = 0;

static int has_run = 0;
static unsigned long has_run_2 = 0;

asm ( "        movl %%db7, %0\n"
      "        movl %%db0, %1\n"
     :"=r"(db7), "r="(addr0) );

if( db7 != odb7 || addr0 != oaddr0 )
{
	printk(KERN_DEBUG
		"%s: change: a0:0x%8.8x oa0:0x%8.8x "
		"db7:0x%8.8x odb7:0x%8.8x\n",
		__FUNCTION__, addr0, oaddr0, db7, odb7);

	odb7 = db7;
	oaddr0 = addr0;
}

if( ! has_run && jiffies > 7000 )
{
	has_run = 1;

	asm ("  movl %0, %%db0\n"
	     "  movl %1, %%db7\n"
	     : /* no inputs */
	     :"r"(&has_run_2),
	      "r"(0x000f0202)  /*LEN0=3 R/W0=3 GE=1 G0=1 */
	    );
}

if( has_run && jiffies > 8000 )
{
	/* read has_run_2 should generate 'int 1' */
	if( ! has_run_2 )
	{
		printk(KERN_DEBUG
		"%s: tested and now setting has_run_2\n",
		__FUNCTION__);

                /* write has_run_2 should generate 'int 1' */
		has_run_2 = 1;
	}
}


                 reply	other threads:[~2003-08-22 15:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030822085102.A27952@blarg.net \
    --to=ben@blarg.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox