3 ms·
Official Intel program to detect the current processor (starts on page 16): http://kib.kiev.ua/x86docs/Intel/AppNote485/241618-005-mn.pdf http://kib.kiev.ua/x86
by shadowofneptune 4y ago
Official Intel program to detect the current processor (starts on page 16):
http://kib.kiev.ua/x86docs/Intel/AppNote485/241618-005-mn.pdf http://kib.kiev.ua/x86docs/Intel/AppNote485/241618-005-mn.pd...
- rep_lodsb 4y agoIt may be official, but relying on undefined flags can fail: http://www.rcollins.org/ddj/Sep96/Sep96.html http://www.rcollins.org/ddj/Sep96/Sep96.html http://www.rcollins.org/ddj/Nov96/Nov96.html http://www.rcollins.org/ddj/Nov96/Nov96.html For detecting 8086(/88) and NEC V30(/20) vs. 80186 and anything later, I'd recommend using a shift instruction with a count of 33. The 186 and later processors will mask it with 0x1F, resulting in a shift by 1 instead. A shift count of 32 would also behave differently, but not set any flags because a shift by 0 effectively becomes a NOP. This is true even on x86-64, only for 64 bit operands is the count masked with 0x3F.