logoalt Hacker News

Why is the x86 undefined instruction called ud2? Why 2?

58 pointsby ibobevtoday at 12:30 PM16 commentsview on HN

Comments

ordutoday at 4:42 PM

> It’s called ud2 because the 0F FF variant was retroactively named ud0, and the 0F B9 variant was retroactively named ud1, leaving ud2 as the recommended undefined opcode.

It was a surprise for me as a reader. When I came to this sentence I assumed that 0f ff would become #1 and 0fb9 -- #2. But no, Intel counts from zero, so there is a third ud.

349ru3h4f03today at 3:21 PM

Nowadays UD0 UD1 UD2 are in the SDM and APM.

We also got UDB (D6), the one-byte variant that arrived with x86-64 for 64-bit mode.

And we have always had UDW (FF FF), aka group #5 (1st FF) with a modrm byte of mod=11b r/m=111b (/7) reg=111b (2nd FF) -- that one matters for memory with all bits set to 1, or for buses terminated to all 1 when no device claims an access.

Neywinytoday at 3:06 PM

I'm not much of an x86 person but on other architectures you can raise software interrupts/exceptions. Does x86 not have this or did those facilities not cover enough use cases?

show 3 replies
qbanetoday at 3:53 PM

It's like why the first (hard) drive letter is C.

show 1 reply
dataflowtoday at 3:41 PM

Is this just his speculation? Or is there evidence for it?

show 1 reply