Project

General

Profile

Bug #10217

mdb: r9w isn't r8w

Added by Robert Mustacchi over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
mdb - modular debugger
Start date:
2019-01-11
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

While debugging something I noticed something strange. Mainly that r9 was working in mdb but trying to use r9w was not working:

> <r9w=K
                0               
> <r9=K
                3e              
> <r9w=K
                0               
> $r
%rax = 0x0000000000000008       %r8  = 0x0000000000000000
%rbx = 0xfffffc7fffdff578       %r9  = 0x000000000000003e
%rcx = 0x000000000000000e       %r10 = 0x000000000000003f
%rdx = 0xfffffc7fffdff578       %r11 = 0xfffffc7fef20c238
%rsi = 0x000000000000003f       %r12 = 0x000000000042d240
%rdi = 0x0000000000000002       %r13 = 0x000000000000003f
                                %r14 = 0x000000000000003e
                                %r15 = 0x000000000000000e

%cs = 0x0053    %fs = 0x0000    %gs = 0x0000
%ds = 0x0000    %es = 0x0000    %ss = 0x004b

%rip = 0x000000000042d240 elfcap_hw2_to_str
%rbp = 0xfffffc7fffdff4e0
%rsp = 0xfffffc7fffdff468

%rflags = 0x00000246
  id=0 vip=0 vif=0 ac=0 vm=0 rf=0 nt=0 iopl=0x0
  status=<of,df,IF,tf,sf,ZF,af,PF,cf>

%gsbase = 0x0000000000000000
%fsbase = 0xfffffc7fef152a40
%trapno = 0x3
   %err = 0x0

Digging into this, I found that I was hoisted up by my own feature-pitard. Notably there's a bug in the logic for the user, but not the kernel side of mdb. Look at the following excerpt from the table today:

 76         { "r9",         REG_R9,         MDB_TGT_R_EXPORT },
 77         { "r9d",        REG_R8,         MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
 78         { "r9w",        REG_R8,         MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
 79         { "r9l",        REG_R8,         MDB_TGT_R_EXPORT | MDB_TGT_R_8L },

One of these things is not like the other.

History

#1

Updated by Electric Monk over 1 year ago

  • Status changed from New to Closed

git commit 161294fe5eab242f42189b33b59ebbe6ac9558f4

commit  161294fe5eab242f42189b33b59ebbe6ac9558f4
Author: Robert Mustacchi <rm@joyent.com>
Date:   2019-01-15T19:00:21.000Z

    10217 mdb: r9w isn't r8w
    10218 CONV_CAP_VAL_HW2_BUFSIZE wasn't updated
    10219 AV_386_2_AVX512VPOPCDQ elfcap name should be consistent
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Rob Johnston <rob.johnston@joyent.com>
    Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF