kdb: add rdmsr and wrmsr commands for i386

Jordan Crouse jordan.crouse at amd.com
Tue May 15 10:51:33 EDT 2007


On 15/05/07 01:56 -0400, Bernardo Innocenti wrote:
> The syntax is:
>    rdmsr <addr>
>    wrmsr <addr> <l> <h>

Awesome!  This will make all the difference in the world! :)
Just a few nitpicks...

> diff --git a/arch/i386/kdb/kdbasupport.c b/arch/i386/kdb/kdbasupport.c
> index 482b319..8ecef2e 100644
> --- a/arch/i386/kdb/kdbasupport.c
> +++ b/arch/i386/kdb/kdbasupport.c
> @@ -223,6 +223,47 @@ kdba_removedbreg(kdb_bp_t *bp)
>   	kdba_putdr7(dr7);
>   }
> 
> +static int
> +kdba_rdmsr(int argc, const char **argv)
> +{
> +	unsigned long addr;
> +	uint64_t val;
> +	int diag;
> +
> +	if (argc != 1) {
> +		return KDB_ARGCOUNT;
> +	}
> +
> +	if ((diag = kdbgetularg(argv[1], &addr)))
> +		return diag;
> +
> +	kdb_printf("msr(0x%lx) = ", addr);
> +	rdmsrl(addr, val);
> +	kdb_printf("0x%llx\n", val);

Can you break this up with a : between the high dword and the low dword?
That makes it easier to parse when debugging.

Also, would it make sense to coordinate the order of the high and low
dwords with the order they are specified with 'wrmsr'?  
I don't think it matters which order (lo-hi hi-lo) you use - The AMD
debuggers use hi:lo, and Mitch uses lo:hi -  as long as you pick one
and stay consistant, we'll be fine.

Thanks a billion!
Jordan





More information about the Devel mailing list