Page MenuHomeFreeBSD

ddb disassembler: handle multi-byte nops
ClosedPublic

Authored by markj on Feb 12 2015, 8:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 10:47 AM
Unknown Object (File)
Sun, Nov 17, 12:21 AM
Unknown Object (File)
Mon, Nov 11, 6:00 PM
Unknown Object (File)
Sep 29 2024, 9:29 AM
Unknown Object (File)
Sep 24 2024, 2:56 AM
Unknown Object (File)
Sep 23 2024, 8:21 AM
Unknown Object (File)
Sep 23 2024, 8:21 AM
Unknown Object (File)
Sep 23 2024, 8:21 AM
Subscribers
None

Details

Summary

x86_64 has supported multibyte nops for a while; they have an opcode of 0f 1f, sometimes prefixed with 0x66 (operand size override) and 0x2e (cs segment override). The ddb disassembler doesn't support them, but they seem to appear fairly frequently (see cam_strvis() for several examples).

This change just adds an instruction table for 0x0f1, with a single entry for 1f. I use "nopl" by default, and "nopw" if the 0x66 prefix is used, for consistency with binutils.

Test Plan

ddb is able to disassemble all the instructions in cam_strvis() and sysctl_sysctl_next_ls() (the latter contains a 15-byte nop on my laptop running HEAD).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj retitled this revision from to ddb disassembler: handle multi-byte nops.
markj updated this object.
markj edited the test plan for this revision. (Show Details)
markj added reviewers: jhb, kib.
kib edited edge metadata.

I never read the ddb disassembler code, but I have no objections against the change.

Does i386 need the same patch ?

This revision is now accepted and ready to land.Feb 12 2015, 9:31 PM
jhb edited edge metadata.
markj edited edge metadata.
  • Detect multibyte nops on i386.
This revision now requires review to proceed.Feb 12 2015, 9:59 PM
In D1830#3, @kostikbel wrote:

I never read the ddb disassembler code, but I have no objections against the change.

Does i386 need the same patch ?

Yes, according to the ia32 manual. For some reason clang doesn't appear to emit them though (looking at ref11-i386's kernel). I uploaded the corresponding change anyway, it shouldn't hurt.

kib edited edge metadata.
This revision is now accepted and ready to land.Feb 12 2015, 10:05 PM
markj updated this revision to Diff 3753.

Closed by commit rS278655 (authored by @markj).