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)
Wed, May 8, 12:01 PM
Unknown Object (File)
Mon, Apr 29, 9:27 PM
Unknown Object (File)
Apr 14 2024, 5:27 PM
Unknown Object (File)
Apr 8 2024, 1:54 PM
Unknown Object (File)
Mar 4 2024, 10:19 PM
Unknown Object (File)
Jan 27 2024, 9:21 PM
Unknown Object (File)
Jan 14 2024, 3:58 PM
Unknown Object (File)
Dec 28 2023, 11:39 PM
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).